|
15054
|
673
|
48
|
2026-05-11T06:11:51.620360+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778479911620_m2.jpg...
|
PhpStorm
|
faVsco.js – MatchCrmData.php
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.09541223,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8057862210374731819
|
-8204420481362449466
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
PhpStormFV faVsco.jsVIewINavicareCode%9 JY-20725-handle-HS-search-rate-limit-KeractorProletey© ImportTwilioVideosCoIsActivitykeaayrortmatchermbata.ongc UpoatecrmrielaDac) Upoatecustomerm?J Justcall> D PushSummaryToCrm> C RingCentral> D ZoomPhone© ActivityChangeCatego© AssignOwnership.phpc) ConterencecrmMatch©DeleteActivities.phpC) DeleteTeamchurndata© Delete TeamsRetentiorC) HardDeleteActivities.o©HardDeleteActivity.phy© MatchMeetingOwner.p©ReindexForAccountJol(c) RoindeysorContact.lot© ReindexForGroupJob.f© ReindexForLeadJob.pt© ReindexForOpportunit!© ReindexForUserJob.pr© RetryActivitySyncJob./© syncacuvity.onpolewalaWailewladialalh© HubspotSyncStrategyBase.phpy syneermenttes tralt.onpCachedcrmservicebecorator.onp© ProspectCache.php© CheckAndRetryRemoteMatch.php© MatchactivityermData.png© ermactivilyservice.phpMatchermbata.ono xclass Matchermbata 1mpLements ShouldoueueoUbLIerunction nandle a=| A7X2 A y 15return;if (! SrateLimiter->canMakeRequest(Sactivity->getCrm())) {$this->logMessage('Rate limit reached, retrying');$this-›release( delay: $rateLimiter-›requestAvailableIn($activity->getCrm()) + random_int(1, 60));Tecurlr$this->LogMessage('Resolving CRM objects');$crmObjects = $crmObjectsResolver->resolveFromCall($this->crmService, $this->call);SrateLimiter->incrementRequestCount($activity->getCrm());if Cempty($crmObjects)) {sth1s-> Loqhessage"Could not resolve cki obzects, retryinq')nSthis->release( delav: 3600):Console xLog xChanaes 12 filed=.env.local app© Client.php app/Services/Crm/Hubspot© HandleHubspotRateLimit.php app/Jobs/Middleware© HubspotClientinterface.php app/Services/Crm/Hubspot© HubspotPaginationService.php app/Services/Crm/Hubspot/Pagination©JiminnyDebugCommand.php app/Console/Commandsphe logging.php config©MatchActivityCrmData.php app/Jobs/Crm© MatchCrmData.php app/Jobs/Activity/lmport© PaginationState.php app/Services/Crm/Hubspot/Pagination© RateLimitException.php app/Exceptions© Service.php app/Services/Crm/HubspotUnversioned Files 9 filesE .env.nikilocal appE.env.other app© CanAccessAiReportsTest.php tests/Unit/Policies© CreateMockAskJiminnyReportResultCommand.php app/Console/Commands/Rep6 favicon.ico public= ids.txt appiaraw sol querv sall aoolosimuev ehookscon mand php rar/console/Comands/Crm/HubspotHelper Code will help IDE to understand your Laravel app code. // Generate // Don't Show Anymore (3 minutes ago)T + 0+ → Side-by-side viewer -Do not ignoreCurrent version tests/Unit/Policies/CanAccessAiReportsTest.php<?ohpHighlight words →X B?declare(strict types=1)namespace Tests Unit Policles:use JaminnvcontractsAcu.Permisszonenumuse Jiminny Models. Teamuse Jiminny\Models\User;use Jiminny Policies UserPolicv:use Jiminny|Repositories\AutomatedReportsRepository;use PlPlni+ Sramework Attrihutes DataProviden:use PHPUnit\Framework\Mock0bject\Mock0bject;use puPllni+ Enamewonk Tectrase:class CanAccessAiReportsTest extends TestCaseprivate AutomatedReportsRepository&Mock0bject $automatedReportsRepository;private UserPolicy $policy;laravel.log# console [PKob.A console (EU]A SF jiminny@localhost]A console (STAGING]A HS_Jocal (jiminny@localhost]accept-encoding"],w V19 ^V"access-control-allow-credentials": ["false"],"server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3)",cfr;desc=\"9f80deb8e7c6dc3a-IAD)""],"x-content-type-options": ["nosniff"],"x-hubspot-correlation-id" : ["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],"Set-Cookie":["_cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-1.0.107-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None"],"керогс-10":"1enapolnus"."url":nccos:a.nel.cloudtlare.comredorcV4.S=NYALSVIPorymszorSUnxY24S0ZKh"max_age\":6048005"J,"NEL": ["{"success fraction":0.01.\"report_tol":\"cf-nell","max ade".604800-""Server": ["cloudflare"]f}{"correlation_id":"95236535-ec98-4541-b92a-adfa73b69eab" ,"trace 1d"."c7ab8365-903f-46d4-9403-0e5b551e3545"CascadeNew CascadeSO lыo| Daily - Platform - in 34mAskJiminnyReportActivityServiceTest100%C4.•&• Mon 11 May 9:11:51e a t+0 ..Cascade Code * •.Kick oft a new oroiect. Make chancesacross vour entire codebase.© HubSpot CRM Call Review© Investigating Rate Limit Errors© HubSpot Rate Limit Reviewvbe dit. Se not oneses aitier and make a very ctre+ ‹› CodeSAdaptiveies. Wi Char break anyhing Ase lokn,on.pnp delient.onp @raginacionstate.pnpW Windsurf Teams 112:54 UTF-8 P 4 spaces...
|
15052
|
NULL
|
NULL
|
NULL
|
|
15092
|
674
|
13
|
2026-05-11T06:16:06.249719+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778480166249_m1.jpg...
|
PhpStorm
|
faVsco.js – Hubspot/Service.php
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8057862210374731819
|
-8204420481362449466
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
iTerm2•00ShellEditViewSessionScriptsProfilesWindowHelpDEV (docker)DOCKERO 81DEV (docker)882APP (-zsh)• жзmasterJY-20818-move-AJ-reports-to-separated-datadog-metricJY-20773-fix-automated-reports-user-pilot-trackingJY-20157-AJ-report-not-send-notificationJY-20508-notify-before-AJ-report-expirationJY-20372-ai-reports-promotion-pagesJY-20352-sync-opportunities-without-a-local-owner-user-id-is-nullJY-20738-debug-AJ-tracking-UPJY-18909-automated-reports-ask-jiminnyJY-20692-fix-integration-app-[API_KEY] laysJY-20698-fix-SF-activity-types-on-new-playbookJY-20543-AJ-report-trackingJY-20384-handle-auto-sync-with-no-access-to-event-typeJY-20458-ask-Jiminny-user-definitionsJY-19666-fix-import-contacts-account-associationJY-19666-HS-import-contacts-and-accounts-batch-jobJY-20458-Ask-Jiminny-ReportsJY-20200-batch-update-CRM-objects-SalesforceJY-19666-HS-webhooks-add-contact-and-companyJY-20348-trigger-setup-DI-layout-on-team-creationJY-20326-refactor-info-message-in-commandJY-20317-fix-auto-log-delay-issue-on-all-channels-disabledJY-20312-remove-on-update-change-last-synced-at-crm-configurationsJY-20306-SF-skip-auto-sync-for-task-based-playbookJY-20192-remove-deleted-team-from-saved-search-filtersJY-20197-import-opportunity-batch-jobJY-20293-enable-status-field-for-pipedrive-dealsJY-20191-remove-commands-interactive-promptsJY-20118-change-default-sync-strategyJY-20183-add-cache-on-auto-log-delayJY-20197-add-import-opportunity-batch-job20118-hs-opportunity-make-webhook-strategy-defaultJY-20118-make-default-hs-opportunity-sync-strategy-webhook-basedJY-20196-handle-opportunity-without-noteJY-20118-improve-opportunity-importJY-20189-handle-activity-search-on-deleted-groupsJY-20160JY-20145-filter-out-converted-leads-when-matchingJY-20150-skip-push-summary-on-summary-ready-1f-autologJY-20132-fix-note-encodingJY-19792-clean-logslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20725-handle-HS-search-rate-limit) $ devroot@docker_lamp_1:/home/jiminny# ](ahl| Daily - Platform • in 29 mA100% C47 8• Mon 11 May 9:16:051881-zsh-zsh885screenpipe"0 ₴6DEV...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
15117
|
677
|
5
|
2026-05-11T06:18:09.366640+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778480289366_m2.jpg...
|
PhpStorm
|
faVsco.js – Client.php
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.09541223,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8057862210374731819
|
-8204420481362449466
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
PhostormFV faVsco.jsVIewINavicareCode%9 JY-20725-handle-HS-search-rate-limit-Keractorroledey© BatchSyncCollectore balchsynckealsse© HubspotSyncStrategyBase.phpCachedcrmservicebecorator.onp© SyncRelatedActivityManager.php© ProspectCache.phpo closeaDealstagess)MatchactivitycrmData.ong© CrmActivityService.phgDealrielasservice.g© CrmObiectsResolver.phpc)Decorateacuivilv.or© FieldDefinitions.phpC) FieldT vpeconverteclass sacent extends Baseulzent amplements hubspotelzentintertacepublic function deleteEngagement(string SengagementId): voide Hubspotclientinterc) Hubspotlokenman$this->getInstance() ->engagements()->delete((int) $engagementId);© PayloadBuilder.phpC) Remotecrmobiectr© ResponseNormalizec) Service,ono948 0public function getAssociationsData(array $ids, string $from0bject, string $to0bject): array© SyncFieldAction.phC) SvncRelatedActivitC) WebhookSvncBatclSassociationData = [];SidChunks = arnav chunk(Sids!length: self::ASSOCIATIONS_BATCH_SIZE_LIMIT);v O IntegrationApp> O Accessors• MAnConfigODTOFiltersJobsDProspectSearchStraforeach ($idChunks as $idChunk) {try{$batchInput = new \HubSpot\CLient\Crm\Associations\Model\BatchInputPublic0bjectId();$batchInput->setInputs(array_map(function ($id) {$publicObjectId = new \HubSpot\CLient\Crm\Associations\Model\Public0bjectId();soubuicudecclo>sectas10W service lralts© DataClient.phpreturn $public0bjectId;}, $idChunk)):A2 A64 X1 21 A L 15II 1 IMHM= 241 31MіH-ITConsole,LOg XChanges 12 files= env.local aonC) Client.oho aon/Services/Crm/Hubsooti© HandleHubspotRateLimit.php app/Jobs/Middleware© HubspotClientinterface.php app/Services/Crm/Hubspot© HubspotPaginationService.php app/Services/Crm/Hubspot/Pagination©JiminnyDebugCommand.php app/Console/Commandsphe logging.php config©MatchActivityCrmData.php app/Jobs/Crm© MatchCrmData.php app/Jobs/Activity/lmport© PaginationState.php app/Services/Crm/Hubspot/Pagination© RateLimitException.php app/Exceptions© Service.php app/Services/Crm/Hubspot~ Unversioned Files 9 files= env.nikilocal apoE.env.other app© CanAccessAiReportsTest.php tests/Unit/Policies© CreateMockAskJiminnyReportResultCommand.php app/Console/Commands/Repki tavicon.ico public= ids.txt appiaraw sol querv sall aool© SimulateWebhooksCommand.php app/Console/Commands/Crm/HubspotT + 0+ → Side-by-side viewer -8 35f036ac app/Services/Crm/Hubspot/Client.phgDo not ignoreHighight words -X 1 ?// Fallback toSmessace = strtolower(se->cetressadeoo:return str contains(Smessage..'401 unauthorized') |1'http 401') |1str contains(Smessage, 'status code 401') 11|(preg_match('/\b401\b/', $message) && str_contains($message, 'unauthorized'));/*** Validates and refreshes the access token if needed before API requests.} StoAssociations)•} catch (\Exception $e) {Sthis->log->error('[Hubspotl Failed to fetch associations'. lE laravel.log# console [PKob.A console (EU]A SF jiminny@localhost]A console (STAGING]A HS_Jocal (jiminny@localhost]accept-encoding"],"access-control-allow-credentials": ["false"],"server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3)",cfr;desc=\"9f80deb8e7c6dc3a-IAD)""],"x-content-type-options": ["nosniff"],"x-nuDspor-correlac1on-1d:l "0ryeuzdu-or0o-/812-baba-oosl/ccbsees"Set-Cookie":["_cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-1.0.107-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None"],"керогс-10":"1enapolnus"."url":nccos:a.nel.cloudtlare.comredorcV4.S=NYALSVIPorymszorSUnxY24S0ZKh"max_age\":6048005"J,"NEL": ["{"success fraction":0.01."max ade".604800-""Server": ["cloudflare"]}}{"correlation_id":"95236535-ec98-4541-b92a-adfa73b69eab" ,"trace id":"c7ab8365-903f-46d4-9403-0e5b551e3545"}Curront vorcion40Dally - Platorm• In 2/nU AskJiminnyReportActivityServiceTest~100% L2&• Mon 11 May 9:18:09CascadeO HubSpot Pagination+0 ..sull request #12057 from jiminny/JY-20819-increase-download-transctip-rate-Limit75 -20817-T1x-deleting-old-tracksbse8t38768 Mr20 17 Fredete #12 o1 toa Kiminy/JY-29662-remaxe-vord-boostget /Users/ukas/jiminny/app Log -onetine --all - app/Services/Crm/Hubspot/Pag4nation/HubspotPaginationServiCe.php 261 |56973040d6 3Y-29456 code review sugesen6de4385261 JY-19401 extract HS pagination logic to separated classesCommand git, grep, headO git -C /Users/lukas/jiminny/app branch --all | grep -j "ratel|match\|pagination)|crm" | head -20 2>&1Run se+ SkipAsk anything (2AL)+ <> CodeSAdaptive• 014 differencesreturn se-›getresponseo?->getstatuscode === 4017Smessage = strtolower ($e->getMessage());return str contains(Smessage.'401 unauthorized') 11str_contains($message,"http 401') |1str contains(Smessage."status code 401')(preg_match('/\b401\b/', $message) === 1 && str_contains($message, 'unauthorized'));/*** Validates and refreshes the access token if needed before API requests.StoAssociations).} catch (RateLimitException $e) {thnow So.WN Windsurf Teamcf?4 spaces...
|
15115
|
NULL
|
NULL
|
NULL
|
|
15214
|
NULL
|
0
|
2026-05-11T06:27:41.136628+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778480861136_m2.jpg...
|
PhpStorm
|
faVsco.js – Client.php
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.09541223,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8057862210374731819
|
-8204420481362449466
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
PhostormVIewINavicareCodeFV faVsco.js?9 JY-20725-handle-HS-search-rate-limitroledey© [EMAIL]© ProspectCache.phpC)DecorateActivitv.on© MatchactivityermData.png© CrmActivityService.phgC) FieldTvoeConverteHubsnotclientinten© CrmObiectsResolver.php© HubspotTokenMan© PayloadBuilder.phpC) RemoteCrmObiectiResponseNormalize© Service.php© SyncFieldAction.ph© SyncRelatedActivit© WebhookSyncBatcl• Ca IntegrationApp› Oa Accessorsclass Cllent extends Baseclient 1mpLements HubspotclientintertaceA2 A65 K1AV1public function makeRequest(strina Sendpoint. Smethod = 'GET'. Spavload = [l. 2strina SauervString = null)sresponse = schis->gerinstance-›gecculentr-›requescenapoinc. senapoinc,query scrino: squeryscrino} else {Sresponse = Sthis->getInstance@->getClient(->request(Smethod. Sendpoint. ["ason' => (spavload)WApI•• contioODTOw rilters745/1 "110""109"DJOOS• Prospecisearchstr> → ServiceTraitsC) Dataclient.oho© DecorateActivitv.phC)Loca|Search.ohv1)Loca SearchintertaC) RemoteSearch.onoSremaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'):Sinterval= $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // "10000"$body= ison decode(((strina) Sresponse->aetBodvO true):ItsaIlluminate\Support\Facades\Log::channel('custom_channel')->info('$max'. PHP_EOL • print_r($max,lI kIlluminate\Support \Facades\Log::channel('custom_channel')->info('$remaining' . PHP_EOL • print_r(SiTlluminate Sunnont Cacades loa: •channel("custom channel!)->info(icintenvall• PHP_EOL • print_r(Sin\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$body' . PHP_EOL . print_r($bod\=ShelConcoleChanaes 12 filed= env.local aonC) Client.oho aon/Services/Crm/HubsootiTJ0 + → Side-by-side viewer •Do not ignore8 35f036ac app/Services/Crm/Hubspot/Client.phgSthis->setVersion(self::MIN_API_VERSION):Hiahliaht wordsy© HandleHubspotRateLimit.php app/Jobs/Middleware© HubspotClientinterface.php app/Services/Crm/Hubspot© HubspotPaginationService.php app/Services/Crm/Hubspot/Pagination@ JiminnyDebugCommand.php app/Console/Commandsphp logging.php config© MatchActivityCrmData.php app/Jobs/Crm© MatchCrmData.php app/Jobs/Activity/Import© PaginationState.php app/Services/Crm/Hubspot/Pagination© RateLimitException.php app/Exceptions© Service.php app/Services/Crm/HubspotUnversioned Files 9 filesououic tunction cetranmumaoiversiono: strinoreturn self::MIN APT VERSION:SlastRecordtdi= env.nikilocal apoE.env.other appC) CanAccessAiReportsTest.php tests/Unit/Policies© CreateMockAskJiminnvReportResultCommand.php app/Console/Commands/Re* Athrows NealAniFycention* Athrows ErmSycentionki tavicon.ico publicEids.txt aprpublic function getOpportunityById(string $crmId, array $fields): arrayiaraw sol querv sall aoolSimaneebnkscommandpht a/m/Console/Commands/Crm/Hubspoolner Code will hoin INF to underctand vour Laravel ann code II Generate II Don't Show Anvmore (19 minutes aao)trySdeal = Sthis->getNewInstance->crm->deals->basicApi->qetById(Dally - Platrorm • In 1om100% S2• • Mon 11 May 9:27:40AskJiminnyReportActivityServiceTest v+0 ..= custom.loa XA SF (jiminny@localhost]4 HS_local (jiminny@localhost]# console [PKOb.# console leu)A console [STAGING]accept-encoding"],"access-control-allow-credentials":["false"]."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\",cfr;desc=|"9f80deb8e7c6dc3a-IAD\""],"x-content-type-options": ["nosniff"],"x-hubspot-correlation-id":("019e02d0-6fd8-7812-bdba-885b7ccb3ee3"].MMi9.У"ser-Lookle:ct.dm=sLurcaugxvrzksopacronzvyknzinubzavrabeccmoy-1//81050/5-1.0.207-May-26 14:51:15 GMT: domain=.hubapi.com;: Http0nly: Secure: SameSite=None"]."керогс-10":"1enapolnus"."url":nccos:a.nel.cloudtlare.comredorcv4?s=NYALsVIPorymszorsunxy24S0zk"max_age\":6048005"J,"NEL":["{"success fraction":0.01."max ade".604800-""Server":"cloudflare"l?,,"correlation_id":"95236535-ec98-4541-b92a-adfa73b69eab","trace id":"c7ab8365-903f-46d4-9403-0e5b551e3545"CascadeHubspot Rate Limit Re9. Matchcrmbata rate limiter move is logically correct but asymmetric with the quardMatchCrmData.oho:103-1131 SrateLimite->canMakeRequest (Sactivitv->oetcrmo))4$this->release(...)return;ScrmObjects = $crm0bjectsResolver->resolveFromCall(...):SrateLimiter→>incrementRequestCount(Sactivity->getCrm0));Movina increlestCount to after resolveFromCall is correct — oreviouslv it counted the attemot even if the call failed. However. resolveFrondall canmake multiple CRM API calls (email match + phone match + domain match). The rate limiter counts this whole resolver as 1 request. If a preventive rate limiter wereadded inside Client, the ProviderRateLimiter at the job level would count "1 request" while the client made 3 calls - so the two counters would diverge and thepreventive limiter would still be meaninaful independentlv.Rate Limit counter Interaction — vatchcrnbata vs Cllent-Side Preventive LimitThe question about how the ProviderRateLimiter would interact with a preventive client-side rate limit:Current flowMData):1. canMakeRequestlo checks the Laravel cache-oased counter + 1ob-level, coarse-arained, oer-cRM-contic2. resolveFromCall() makes 2-3 actual HubSpot API calls3. incremIt a prevent ve rate limit were added in Client (e.a, before searcho):Ask anything (&AL)+ <> CodeSAdaptiveQ differencesct »Curront vorcionreturn 10:public function getMinimumApiVersion@: strinareturn self::MIN APT VERSION:SlastRecordId* Execute a search request against HubSpot CRM objects with rate limiting.* Qparam string $objectType The object type ('deals','companies', 'contacts', 'calls')* @panam array<string, mixed> $payload The search payload with filters, sorts, properties, etc.* @return array The search response with 'results', 'total', 'paging' keys* Athrows RateLimitException When rate limit is hit+ Athnowe Hubeno+Gycention An APT ennonclWN Windsurf Teams724•60 UITF.8io 4 spaces...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
16519
|
740
|
14
|
2026-05-11T09:02:03.609092+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778490123609_m1.jpg...
|
PhpStorm
|
faVsco.js – Client.php
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8057862210374731819
|
-8204420481362449466
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
SlackFileEditViewGoHistoryWindowHelpDOCKERO 81DEV (docker)882DEV (d)APP (-zsh)• xзmasterJY-20818-move-AJ-reports-to-separated-datadog-metricJY-20773-fix-automated-reports-user-pilot-trackingJY-20157-AJ-report-not-send-notificationJY-20508-notify-before-AJ-report-expirationJY-20372-ai-reports-promotion-pagesJY-20352-sync-opportunities-without-a-local-owner-user-id-is-nullJY-20738-debug-AJ-tracking-UPJY-18909-automated-reports-ask-jiminnyJY-20692-fix-integration-app-[API_KEY] laysJY-20698-fix-SF-activity-types-on-new-playbookJY-20543-AJ-report-trackingJY-20384-handle-auto-sync-with-no-access-to-event-typeJY-20458-ask-Jiminny-user-definitionsJY-19666-fix-import-contacts-account-associationJY-19666-HS-import-contacts-and-accounts-batch-jobJY-20458-Ask-Jiminny-ReportsJY-20200-batch-update-CRM-objects-SalesforceJY-19666-HS-webhooks-add-contact-and-companyJY-20348-trigger-setup-DI-layout-on-team-creationJY-20326-refactor-info-message-in-commandJY-20317-fix-auto-log-delay-issue-on-all-channels-disabledJY-20312-remove-on-update-change-last-synced-at-crm-configurationsJY-20306-SF-skip-auto-sync-for-task-based-playbookJY-20192-remove-deleted-team-from-saved-search-filtersJY-20197-import-opportunity-batch-jobJY-20293-enable-status-field-for-pipedrive-dealsJY-20191-remove-commands-interactive-promptsJY-20118-change-default-sync-strategyJY-20183-add-cache-on-auto-log-delayJY-20197-add-import-opportunity-batch-job20118-hs-opportunity-make-webhook-strategy-defaultJY-20118-make-default-hs-opportunity-sync-strategy-webhook-basedJY-20196-handle-opportunity-without-noteJY-20118-improve-opportunity-importJY-20189-handle-activity-search-on-deleted-groupsJY-20145-filter-out-converted-leads-when-matchingJY-20150-skip-push-summary-on-summary-ready-1f-autologJY-20132-fix-note-encodingJY-19792-clean-logslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20725-handle-HS-search-rate-Lirroot@docker_lamp_1:/home/jiminny# ]HomeDMsActivityFilesLater..•More• Support Daily - in 2h 58 m100% C8• Mon 11 May 12:02:03ED→Describe what you are looking forJiminny ...crsmecruus# general# jiminny-bg# platform-tickets# product_launches# random# releases# sofia-office# support# thank-yous# the_people_of_jimi...0 Direct messagesa. Stefka Stoyanova€. Vasil Vasilevo Nikolay Ivanov. Galya DimitrovaAneliya Angelova, .... Stoyan TanevVes®. Aneliya Angelova& James GrahamE Lukas Kovalik y…..:: AppsJira CloudLToastGoogle Cale...Stefka Stoyanova• Messages7 Untitled+C Files7 Untitledluesaay, April 28th ~Today ~Stefka Stoyanova 10:08 AMЛукаш, щом пре-рефайнмънта и рефайнмънтаще са само за МСР ако искаш не идвай да сигубиш времетоLukas Kovalik 10:12 AMда, няма да идвамStefka Stoyanova 11:35 AMЛукаш, ще сложиш ли естимейт наhttps://jiminny.atlassian.net/browse/JY-20818Jira Cloud -Move Ask Jiminny reports to separate...Bug JY-20818 in Jira CloudStatusDeployedPriority= MediumAssigneeLukas Koval...As of today at 11:35 AMOpen in Jira* SummariseMessage Stefka Stoyanova......
|
16515
|
NULL
|
NULL
|
NULL
|
|
14298
|
636
|
0
|
2026-05-09T17:15:04.732206+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-09/1778 /Users/lukas/.screenpipe/data/data/2026-05-09/1778346904732_m2.jpg...
|
Firefox
|
April 2026 spending by category - Claude — Persona April 2026 spending by category - Claude — Personal...
|
True
|
claude.ai/chat/d8c55802-ed9f-4664-b944-a97a6ff9941 claude.ai/chat/d8c55802-ed9f-4664-b944-a97a6ff99417...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Pull requests · screenpipe/screenpipe · GitHub
Clo Pull requests · screenpipe/screenpipe · GitHub
Close tab
DNS / Nameservers | Hostinger
Close tab
Nginx Proxy Manager
Close tab
Screenpipe — Archive
Close tab
SQLite Web: archive.db
Close tab
SQLite Web: db.sqlite
Close tab
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
Close tab
DXP4800PLUS-B5F8
Close tab
AFFiNE - All In One KnowledgeOS
Close tab
All docs · AFFiNE
Close tab
Payments Logger
Close tab
Your old PC can run Windows 11 in a VM, but not on bare metal - [EMAIL] - Gmail
Close tab
Location Logger
Close tab
Finance Hub
Close tab
Finance Hub
Close tab
Select: transactions - db - Adminer
Close tab
Claude Code | Claude Platform
Close tab
April 2026 spending by category - Claude
Close tab
lakylak/finance-hub - finance-hub - Gitea: Git with a cup of tea
Close tab
Applications - Admin - authentik
Close tab
New Tab
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
Customize sidebar
Home
Close sidebar
New chat
New chat
⇧⌘O
Search
Search
⌘K
Chats
Chats
Projects
Projects
Code
Code
Customize
Customize
Design
Design
More
More
Starred
Starred
Bulgarian citizenship application process for EU residents
Bulgarian citizenship application process for EU residents
Dawarich location tracking project
Dawarich location tracking project
Recents Hide
Recents
Hide
Code diff review
Code diff review
HubSpot rate limit implementation strategy
HubSpot rate limit implementation strategy
Screenpipe retention policy code location
Screenpipe retention policy code location
Viewing retention policy in screenpipe
Viewing retention policy in screenpipe
Clean shot x video recording termination issue
Clean shot x video recording termination issue
HubSpot rate limit handling with executeRequest
HubSpot rate limit handling with executeRequest
Untitled
Untitled
💬 Screen pipe. Is there ability…
💬 Screen pipe. Is there ability…
SMB mount access inconsistency between Finder and iTerm
SMB mount access inconsistency between Finder and iTerm
💬 What is the best switch I can…
💬 What is the best switch I can…
Permission denied on screenpipe volume
Permission denied on screenpipe volume
Screenpipe sync database attachment error
Screenpipe sync database attachment error
Last swimming outing with Dani
Last swimming outing with Dani
Definition of incarcerated
Definition of incarcerated
Chromecast remote volume buttons not working
Chromecast remote volume buttons not working
Salesforce API errors with Organization and FieldDefinition queries
Salesforce API errors with Organization and FieldDefinition queries
Daily activity summary from screenpipe data
Daily activity summary from screenpipe data
MacBook unexpected restarts and kanji screen
MacBook unexpected restarts and kanji screen
Security patch review and testing guidance
Security patch review and testing guidance
Food calorie values reference
Food calorie values reference
Tracking location history from last week
Tracking location history from last week
Screenpipe WAL processing when stopped
Screenpipe WAL processing when stopped
Reviewing recent conversation highlights
Reviewing recent conversation highlights
Mac aliases not recognized
Mac aliases not recognized
Boosteroid still recording despite ignored windows setting
Boosteroid still recording despite ignored windows setting
Missing JavaScript promise in authorization response
Missing JavaScript promise in authorization response
Linux SQLite UI for NAS
Linux SQLite UI for NAS
Claude API 500 internal server error
Claude API 500 internal server error
Screenpipe query capabilities and usage
Screenpipe query capabilities and usage
eGPU compatibility with Mac mini and Studio
eGPU compatibility with Mac mini and Studio
All chats
All chats
Lukas Kovalik, Settings
LK
Lukas Kovalik
Pro plan
Get apps and extensions
April 2026 spending by category, rename chat
April 2026 spending by category
More options for April 2026 spending by category
Claude is responding
You said: Show me my spending by category for April 2026
You said: Show me my spending by category for April 2026
Show me my spending by category for April 2026
20:12
Edit
Copy
Categorizing transactions and segregating spending data
Categorizing transactions and segregating spending data
Categorizing transactions and segregating spending data
Most of April's transactions aren't tagged yet, so the breakdown by tag isn't very useful — only one item is categorized (and "Salary" is income, not spending). Let me pull the actual transactions so we can see what's there.
Organized spending categories and architected visualization layout
Organized spending categories and architected visualization layout
Organized spending categories and architected visualization layout
Almost everything in April is untagged in Finance Hub, so the built-in spending_by_tag breakdown only shows "Salary" and one big untagged bucket. I went through all 49 POS transactions plus one debit and grouped them by merchant. Total spending:
851.39 EUR
(excluding the 4325.26 EUR salary and 1000 EUR incoming transfer).
Bar chart of April 2026 spending grouped by category, totaling 851.39 EUR across 49 transactions, with health and medical at 275.67 EUR being the largest category.
Bar chart of April 2026 spending grouped by category, totaling 851.39 EUR across 49 transactions, with health and medical at 275.67 EUR being the largest category.
Total spent
€851.39
Transactions
50
Avg / day
€28.38
Largest single
€224.86
Widget actions
A few things worth flagging:
The data is essentially untagged.
Only the salary credit has a tag. Because of that, the breakdown above is my best-guess merchant grouping rather than something the system computed. Health & medical is dominated by one 224.86 EUR charge at REMEDIKOR on 22.04 — without that, total spending is closer to 626 EUR.
Notable items inside categories:
Groceries split roughly: Lidl 172, CBA 53, Billa 20, Kaufland 8
Subscriptions: Vivacom 45.05, Claude.ai 21.60, Boosteroid 9.89, Dennikn.sk 7.99, Anthropic API 6.00, Google 2.81
Transport & fuel is mostly one Botevgrad fuel stop (83.40) plus a Sofia transit micro-charge
Travel + the Slovak pharmacy charges (Lekáreň Beata, Dr.Max) cluster on 30.04 — looks like a day trip to Slovakia
Want me to actually tag these?
I can run
add_tag
across the April transactions so future
spending_by_tag
calls return useful data without me having to eyeball merchant names every time. If yes, just say the word and
Scroll to bottom
Want to be notified when Claude responds?
Notify
Write a message…
Write a message…
Add files, connectors, and more
Model: Opus 4.7 Adaptive
Opus 4.7
Adaptive
Stop response
Claude is AI and can make mistakes. Please double-check responses.
Claude is AI and can make mistakes. Please double-check responses....
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Pull requests · screenpipe/screenpipe · GitHub","depth":4,"bounds":{"left":0.0,"top":0.0518755,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.0518755,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"DNS / Nameservers | Hostinger","depth":4,"bounds":{"left":0.0,"top":0.08459697,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.08459697,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.0,"top":0.11731844,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.11731844,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.0,"top":0.15003991,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.15003991,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"SQLite Web: archive.db","depth":4,"bounds":{"left":0.0,"top":0.18276137,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.18276137,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"SQLite Web: db.sqlite","depth":4,"bounds":{"left":0.0,"top":0.21548285,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.21548285,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub","depth":4,"bounds":{"left":0.0,"top":0.2482043,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.2482043,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.0,"top":0.28092578,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.28092578,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"AFFiNE - All In One KnowledgeOS","depth":4,"bounds":{"left":0.0,"top":0.31364724,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.31364724,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"All docs · AFFiNE","depth":4,"bounds":{"left":0.0,"top":0.3463687,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.3463687,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Payments Logger","depth":4,"bounds":{"left":0.0,"top":0.3790902,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.3790902,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Your old PC can run Windows 11 in a VM, but not on bare metal - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.0,"top":0.41181165,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.41181165,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.0,"top":0.4445331,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.4445331,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Finance Hub","depth":4,"bounds":{"left":0.0,"top":0.4772546,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.4772546,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Finance Hub","depth":4,"bounds":{"left":0.0,"top":0.509976,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.509976,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Select: transactions - db - Adminer","depth":4,"bounds":{"left":0.0,"top":0.54269755,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.54269755,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Claude Code | Claude Platform","depth":4,"bounds":{"left":0.0,"top":0.575419,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.575419,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"April 2026 spending by category - Claude","depth":4,"bounds":{"left":0.0,"top":0.60814047,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.60814047,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"lakylak/finance-hub - finance-hub - Gitea: Git with a cup of tea","depth":4,"bounds":{"left":0.0,"top":0.6408619,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.6408619,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Applications - Admin - authentik","depth":4,"bounds":{"left":0.0,"top":0.6735834,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.6735834,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.70790106,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.0,"top":0.8547486,"width":0.016123671,"height":0.0311253},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.0,"top":0.8858739,"width":0.016123671,"height":0.027533919},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.0,"top":0.9134078,"width":0.016123671,"height":0.02793296},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden","depth":6,"bounds":{"left":0.0,"top":0.9413408,"width":0.016123671,"height":0.027533919},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0,"top":0.9688747,"width":0.016123671,"height":0.0311253},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Home","depth":10,"bounds":{"left":0.02144282,"top":0.06464485,"width":0.022606382,"height":0.012769354},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Close sidebar","depth":11,"bounds":{"left":0.09840426,"top":0.058260176,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New chat","depth":12,"bounds":{"left":0.018783245,"top":0.096568234,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New chat","depth":16,"bounds":{"left":0.030751329,"top":0.10215483,"width":0.020777926,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"⇧⌘O","depth":15,"bounds":{"left":0.09225399,"top":0.10335196,"width":0.010804521,"height":0.012370312},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Search","depth":12,"bounds":{"left":0.018783245,"top":0.12290503,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search","depth":16,"bounds":{"left":0.030751329,"top":0.12849163,"width":0.01512633,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"⌘K","depth":15,"bounds":{"left":0.0965758,"top":0.12968874,"width":0.006482713,"height":0.012370312},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Chats","depth":13,"bounds":{"left":0.018783245,"top":0.14924182,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Chats","depth":17,"bounds":{"left":0.030751329,"top":0.15482841,"width":0.013131649,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Projects","depth":13,"bounds":{"left":0.018783245,"top":0.17557861,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Projects","depth":17,"bounds":{"left":0.030751329,"top":0.1811652,"width":0.018284574,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Code","depth":13,"bounds":{"left":0.018783245,"top":0.20231445,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Code","depth":17,"bounds":{"left":0.030751329,"top":0.20790103,"width":0.011801862,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Customize","depth":13,"bounds":{"left":0.018783245,"top":0.22865124,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Customize","depth":17,"bounds":{"left":0.030751329,"top":0.23423783,"width":0.023271276,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Design","depth":13,"bounds":{"left":0.018783245,"top":0.25538707,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Design","depth":16,"bounds":{"left":0.030751329,"top":0.26097366,"width":0.01512633,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"More","depth":12,"bounds":{"left":0.018783245,"top":0.28172386,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":15,"bounds":{"left":0.030751329,"top":0.28731045,"width":0.011635638,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Starred","depth":13,"bounds":{"left":0.018783245,"top":0.32322428,"width":0.090259306,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Starred","depth":14,"bounds":{"left":0.02144282,"top":0.3236233,"width":0.01412899,"height":0.012370312},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Bulgarian citizenship application process for EU residents","depth":16,"bounds":{"left":0.018783245,"top":0.3423783,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Bulgarian citizenship application process for EU residents","depth":19,"bounds":{"left":0.02144282,"top":0.34796488,"width":0.12533244,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Dawarich location tracking project","depth":16,"bounds":{"left":0.018783245,"top":0.36871508,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Dawarich location tracking project","depth":19,"bounds":{"left":0.02144282,"top":0.37430167,"width":0.07480053,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Recents Hide","depth":13,"bounds":{"left":0.018783245,"top":0.4102155,"width":0.032247342,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"Recents","depth":14,"bounds":{"left":0.02144282,"top":0.41061452,"width":0.015458777,"height":0.012370312},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Hide","depth":15,"bounds":{"left":0.03956117,"top":0.41061452,"width":0.00880984,"height":0.012370312},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Code diff review","depth":16,"bounds":{"left":0.018783245,"top":0.4293695,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Code diff review","depth":19,"bounds":{"left":0.02144282,"top":0.4349561,"width":0.036402926,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"HubSpot rate limit implementation strategy","depth":16,"bounds":{"left":0.018783245,"top":0.4557063,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"HubSpot rate limit implementation strategy","depth":19,"bounds":{"left":0.02144282,"top":0.4612929,"width":0.09424867,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Screenpipe retention policy code location","depth":16,"bounds":{"left":0.018783245,"top":0.4820431,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe retention policy code location","depth":19,"bounds":{"left":0.02144282,"top":0.48762968,"width":0.09075798,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Viewing retention policy in screenpipe","depth":16,"bounds":{"left":0.018783245,"top":0.5083799,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Viewing retention policy in screenpipe","depth":19,"bounds":{"left":0.02144282,"top":0.5139665,"width":0.08361037,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Clean shot x video recording termination issue","depth":16,"bounds":{"left":0.018783245,"top":0.53471667,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Clean shot x video recording termination issue","depth":19,"bounds":{"left":0.02144282,"top":0.5403033,"width":0.101230055,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"HubSpot rate limit handling with executeRequest","depth":16,"bounds":{"left":0.018783245,"top":0.56105345,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"HubSpot rate limit handling with executeRequest","depth":19,"bounds":{"left":0.02144282,"top":0.5666401,"width":0.10688165,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Untitled","depth":16,"bounds":{"left":0.018783245,"top":0.58739024,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Untitled","depth":19,"bounds":{"left":0.02144282,"top":0.59297687,"width":0.017952127,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"💬 Screen pipe. Is there ability…","depth":16,"bounds":{"left":0.018783245,"top":0.61372703,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬 Screen pipe. Is there ability…","depth":19,"bounds":{"left":0.02144282,"top":0.61931366,"width":0.06931516,"height":0.014764565},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SMB mount access inconsistency between Finder and iTerm","depth":16,"bounds":{"left":0.018783245,"top":0.6400638,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SMB mount access inconsistency between Finder and iTerm","depth":19,"bounds":{"left":0.02144282,"top":0.64565045,"width":0.13031915,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"💬 What is the best switch I can…","depth":16,"bounds":{"left":0.018783245,"top":0.6664006,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬 What is the best switch I can…","depth":19,"bounds":{"left":0.02144282,"top":0.67198724,"width":0.07263963,"height":0.014764565},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Permission denied on screenpipe volume","depth":16,"bounds":{"left":0.018783245,"top":0.6927374,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Permission denied on screenpipe volume","depth":19,"bounds":{"left":0.02144282,"top":0.698324,"width":0.08892952,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Screenpipe sync database attachment error","depth":16,"bounds":{"left":0.018783245,"top":0.71907425,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe sync database attachment error","depth":19,"bounds":{"left":0.02144282,"top":0.7246608,"width":0.09607713,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Last swimming outing with Dani","depth":16,"bounds":{"left":0.018783245,"top":0.74541104,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Last swimming outing with Dani","depth":19,"bounds":{"left":0.02144282,"top":0.7509976,"width":0.06898271,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Definition of incarcerated","depth":16,"bounds":{"left":0.018783245,"top":0.7717478,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Definition of incarcerated","depth":19,"bounds":{"left":0.02144282,"top":0.7773344,"width":0.056349736,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Chromecast remote volume buttons not working","depth":16,"bounds":{"left":0.018783245,"top":0.7980846,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Chromecast remote volume buttons not working","depth":19,"bounds":{"left":0.02144282,"top":0.8036712,"width":0.10571808,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Salesforce API errors with Organization and FieldDefinition queries","depth":16,"bounds":{"left":0.018783245,"top":0.8244214,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Salesforce API errors with Organization and FieldDefinition queries","depth":19,"bounds":{"left":0.02144282,"top":0.830008,"width":0.14577793,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Daily activity summary from screenpipe data","depth":16,"bounds":{"left":0.018783245,"top":0.8507582,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Daily activity summary from screenpipe data","depth":19,"bounds":{"left":0.02144282,"top":0.85634476,"width":0.09773936,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"MacBook unexpected restarts and kanji screen","depth":16,"bounds":{"left":0.018783245,"top":0.877095,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"MacBook unexpected restarts and kanji screen","depth":19,"bounds":{"left":0.02144282,"top":0.88268155,"width":0.102726065,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Security patch review and testing guidance","depth":16,"bounds":{"left":0.018783245,"top":0.9034318,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Security patch review and testing guidance","depth":19,"bounds":{"left":0.02144282,"top":0.90901834,"width":0.09424867,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Food calorie values reference","depth":16,"bounds":{"left":0.018783245,"top":0.92976856,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Food calorie values reference","depth":19,"bounds":{"left":0.02144282,"top":0.9353551,"width":0.06416223,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Tracking location history from last week","depth":16,"bounds":{"left":0.018783245,"top":0.95610535,"width":0.090259306,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Tracking location history from last week","depth":19,"bounds":{"left":0.02144282,"top":0.9616919,"width":0.08643617,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Screenpipe WAL processing when stopped","depth":16,"bounds":{"left":0.018783245,"top":0.98244214,"width":0.090259306,"height":0.01755786},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe WAL processing when stopped","depth":19,"bounds":{"left":0.02144282,"top":0.9880287,"width":0.09375,"height":0.011971295},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Reviewing recent conversation highlights","depth":16,"bounds":{"left":0.018783245,"top":1.0,"width":0.090259306,"height":-0.00877893},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reviewing recent conversation highlights","depth":19,"bounds":{"left":0.02144282,"top":1.0,"width":0.08976064,"height":-0.014365554},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Mac aliases not recognized","depth":16,"bounds":{"left":0.018783245,"top":1.0,"width":0.090259306,"height":-0.03511572},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Mac aliases not recognized","depth":19,"bounds":{"left":0.02144282,"top":1.0,"width":0.058843084,"height":-0.040702343},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Boosteroid still recording despite ignored windows setting","depth":16,"bounds":{"left":0.018783245,"top":1.0,"width":0.090259306,"height":-0.061452508},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Boosteroid still recording despite ignored windows setting","depth":19,"bounds":{"left":0.02144282,"top":1.0,"width":0.12699468,"height":-0.06703913},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Missing JavaScript promise in authorization response","depth":16,"bounds":{"left":0.018783245,"top":1.0,"width":0.090259306,"height":-0.0877893},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Missing JavaScript promise in authorization response","depth":19,"bounds":{"left":0.02144282,"top":1.0,"width":0.11619016,"height":-0.09337592},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Linux SQLite UI for NAS","depth":16,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Linux SQLite UI for NAS","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Claude API 500 internal server error","depth":16,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Claude API 500 internal server error","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Screenpipe query capabilities and usage","depth":16,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe query capabilities and usage","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"eGPU compatibility with Mac mini and Studio","depth":16,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"eGPU compatibility with Mac mini and Studio","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"All chats","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"All chats","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Lukas Kovalik, Settings","depth":12,"bounds":{"left":0.016123671,"top":0.9489226,"width":0.095578454,"height":0.051077414},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"LK","depth":13,"bounds":{"left":0.024102394,"top":0.96648043,"width":0.006981383,"height":0.016360734},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Lukas Kovalik","depth":14,"bounds":{"left":0.037732713,"top":0.96089387,"width":0.029920213,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Pro plan","depth":14,"bounds":{"left":0.037732713,"top":0.9764565,"width":0.015292553,"height":0.012370312},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Get apps and extensions","depth":14,"bounds":{"left":0.08843085,"top":0.9616919,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"April 2026 spending by category, rename chat","depth":12,"bounds":{"left":0.11585771,"top":0.059856344,"width":0.07363697,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"April 2026 spending by category","depth":14,"bounds":{"left":0.1171875,"top":0.06384677,"width":0.0709774,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"More options for April 2026 spending by category","depth":12,"bounds":{"left":0.18999335,"top":0.059856344,"width":0.0066489363,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Claude is responding","depth":13,"bounds":{"left":0.21193483,"top":0.10055866,"width":0.05236037,"height":0.016360734},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"You said: Show me my spending by category for April 2026","depth":13,"bounds":{"left":0.21725398,"top":0.121308856,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You said: Show me my spending by category for April 2026","depth":14,"bounds":{"left":0.21725398,"top":0.12290503,"width":0.14361702,"height":0.016360734},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Show me my spending by category for April 2026","depth":16,"bounds":{"left":0.3309508,"top":0.13248204,"width":0.120678194,"height":0.016360734},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20:12","depth":15,"bounds":{"left":0.42353722,"top":0.16919394,"width":0.009474734,"height":0.012370312},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Edit","depth":15,"bounds":{"left":0.43567154,"top":0.16241021,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":15,"bounds":{"left":0.44630983,"top":0.16241021,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Categorizing transactions and segregating spending data","depth":14,"bounds":{"left":0.22024602,"top":0.19592977,"width":0.23670213,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Categorizing transactions and segregating spending data","depth":16,"bounds":{"left":0.22024602,"top":0.19992019,"width":0.12416888,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Categorizing transactions and segregating spending data","depth":15,"bounds":{"left":0.21991356,"top":0.21947326,"width":0.13979389,"height":0.016360734},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Most of April's transactions aren't tagged yet, so the breakdown by tag isn't very useful — only one item is categorized (and \"Salary\" is income, not spending). Let me pull the actual transactions so we can see what's there.","depth":15,"bounds":{"left":0.22024602,"top":0.22426178,"width":0.21825133,"height":0.054668795},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Organized spending categories and architected visualization layout","depth":14,"bounds":{"left":0.22024602,"top":0.2980846,"width":0.23670213,"height":0.021947326},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Organized spending categories and architected visualization layout","depth":16,"bounds":{"left":0.22024602,"top":0.30167598,"width":0.14594415,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Organized spending categories and architected visualization layout","depth":15,"bounds":{"left":0.21991356,"top":0.3216281,"width":0.16472739,"height":0.016360734},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Almost everything in April is untagged in Finance Hub, so the built-in spending_by_tag breakdown only shows \"Salary\" and one big untagged bucket. I went through all 49 POS transactions plus one debit and grouped them by merchant. Total spending:","depth":15,"bounds":{"left":0.22024602,"top":0.32601756,"width":0.21459441,"height":0.054668795},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"851.39 EUR","depth":16,"bounds":{"left":0.40608376,"top":0.3643256,"width":0.029421542,"height":0.016360734},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(excluding the 4325.26 EUR salary and 1000 EUR incoming transfer).","depth":15,"bounds":{"left":0.22024602,"top":0.38347965,"width":0.1690492,"height":0.016360734},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Bar chart of April 2026 spending grouped by category, totaling 851.39 EUR across 49 transactions, with health and medical at 275.67 EUR being the largest category.","depth":21,"bounds":{"left":0.21725398,"top":0.4102155,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Bar chart of April 2026 spending grouped by category, totaling 851.39 EUR across 49 transactions, with health and medical at 275.67 EUR being the largest category.","depth":22,"bounds":{"left":0.21725398,"top":0.4102155,"width":0.63331115,"height":0.02434158},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Total spent","depth":22,"bounds":{"left":0.22290559,"top":0.4237829,"width":0.022273935,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"€851.39","depth":22,"bounds":{"left":0.22290559,"top":0.44014364,"width":0.028091755,"height":0.02434158},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Transactions","depth":22,"bounds":{"left":0.28374335,"top":0.4237829,"width":0.025764627,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"50","depth":22,"bounds":{"left":0.28374335,"top":0.44014364,"width":0.00930851,"height":0.02434158},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Avg / day","depth":22,"bounds":{"left":0.34458113,"top":0.4237829,"width":0.018118352,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"€28.38","depth":22,"bounds":{"left":0.34458113,"top":0.44014364,"width":0.025265958,"height":0.02434158},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Largest single","depth":22,"bounds":{"left":0.40541887,"top":0.4237829,"width":0.028091755,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"€224.86","depth":22,"bounds":{"left":0.40541887,"top":0.44014364,"width":0.03025266,"height":0.02434158},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Widget actions","depth":21,"bounds":{"left":0.44498006,"top":0.41739824,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"A few things worth flagging:","depth":15,"bounds":{"left":0.22024602,"top":0.887071,"width":0.06948138,"height":0.016360734},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"The data is essentially untagged.","depth":16,"bounds":{"left":0.22024602,"top":0.91580206,"width":0.08261303,"height":0.016360734},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Only the salary credit has a tag. Because of that, the breakdown above is my best-guess merchant grouping rather than something the system computed. Health & medical is dominated by one 224.86 EUR charge at REMEDIKOR on 22.04 — without that, total spending is closer to 626 EUR.","depth":15,"bounds":{"left":0.22024602,"top":0.91580206,"width":0.21791889,"height":0.073822826},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Notable items inside categories:","depth":16,"bounds":{"left":0.22024602,"top":1.0,"width":0.08061835,"height":-0.0019952059},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Groceries split roughly: Lidl 172, CBA 53, Billa 20, Kaufland 8","depth":16,"bounds":{"left":0.23088431,"top":1.0,"width":0.14727394,"height":-0.031125307},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Subscriptions: Vivacom 45.05, Claude.ai 21.60, Boosteroid 9.89, Dennikn.sk 7.99, Anthropic API 6.00, Google 2.81","depth":16,"bounds":{"left":0.23088431,"top":1.0,"width":0.19581117,"height":-0.053471684},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Transport & fuel is mostly one Botevgrad fuel stop (83.40) plus a Sofia transit micro-charge","depth":16,"bounds":{"left":0.23088431,"top":1.0,"width":0.2052859,"height":-0.09537113},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Travel + the Slovak pharmacy charges (Lekáreň Beata, Dr.Max) cluster on 30.04 — looks like a day trip to Slovakia","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Want me to actually tag these?","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"I can run","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"add_tag","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"across the April transactions so future","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"spending_by_tag","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"calls return useful data without me having to eyeball merchant names every time. If yes, just say the word and","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Scroll to bottom","depth":13,"bounds":{"left":0.33128324,"top":0.81085396,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Want to be notified when Claude responds?","depth":16,"bounds":{"left":0.21974733,"top":0.867917,"width":0.095578454,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Notify","depth":15,"bounds":{"left":0.42287233,"top":0.86233044,"width":0.021276595,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"Write a message…","depth":16,"bounds":{"left":0.21924867,"top":0.9094174,"width":0.23869681,"height":0.017956903},"on_screen":true,"value":"Write a message…","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Write a message…","depth":18,"bounds":{"left":0.21924867,"top":0.9102155,"width":0.04637633,"height":0.016360734},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add files, connectors, and more","depth":16,"bounds":{"left":0.21791889,"top":0.93695134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Model: Opus 4.7 Adaptive","depth":17,"bounds":{"left":0.39228722,"top":0.93695134,"width":0.05236037,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Opus 4.7","depth":19,"bounds":{"left":0.3956117,"top":0.9425379,"width":0.019115692,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Adaptive","depth":19,"bounds":{"left":0.4167221,"top":0.9425379,"width":0.019946808,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Stop response","depth":15,"bounds":{"left":0.44730717,"top":0.93695134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Claude is AI and can make mistakes. Please double-check responses.","depth":14,"bounds":{"left":0.27310506,"top":0.98124504,"width":0.12815824,"height":0.012370312},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Claude is AI and can make mistakes. Please double-check responses.","depth":15,"bounds":{"left":0.27310506,"top":0.98124504,"width":0.12815824,"height":0.012370312},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8057512382395913693
|
-6170475490843850660
|
visual_change
|
accessibility
|
NULL
|
Pull requests · screenpipe/screenpipe · GitHub
Clo Pull requests · screenpipe/screenpipe · GitHub
Close tab
DNS / Nameservers | Hostinger
Close tab
Nginx Proxy Manager
Close tab
Screenpipe — Archive
Close tab
SQLite Web: archive.db
Close tab
SQLite Web: db.sqlite
Close tab
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
Close tab
DXP4800PLUS-B5F8
Close tab
AFFiNE - All In One KnowledgeOS
Close tab
All docs · AFFiNE
Close tab
Payments Logger
Close tab
Your old PC can run Windows 11 in a VM, but not on bare metal - [EMAIL] - Gmail
Close tab
Location Logger
Close tab
Finance Hub
Close tab
Finance Hub
Close tab
Select: transactions - db - Adminer
Close tab
Claude Code | Claude Platform
Close tab
April 2026 spending by category - Claude
Close tab
lakylak/finance-hub - finance-hub - Gitea: Git with a cup of tea
Close tab
Applications - Admin - authentik
Close tab
New Tab
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
Customize sidebar
Home
Close sidebar
New chat
New chat
⇧⌘O
Search
Search
⌘K
Chats
Chats
Projects
Projects
Code
Code
Customize
Customize
Design
Design
More
More
Starred
Starred
Bulgarian citizenship application process for EU residents
Bulgarian citizenship application process for EU residents
Dawarich location tracking project
Dawarich location tracking project
Recents Hide
Recents
Hide
Code diff review
Code diff review
HubSpot rate limit implementation strategy
HubSpot rate limit implementation strategy
Screenpipe retention policy code location
Screenpipe retention policy code location
Viewing retention policy in screenpipe
Viewing retention policy in screenpipe
Clean shot x video recording termination issue
Clean shot x video recording termination issue
HubSpot rate limit handling with executeRequest
HubSpot rate limit handling with executeRequest
Untitled
Untitled
💬 Screen pipe. Is there ability…
💬 Screen pipe. Is there ability…
SMB mount access inconsistency between Finder and iTerm
SMB mount access inconsistency between Finder and iTerm
💬 What is the best switch I can…
💬 What is the best switch I can…
Permission denied on screenpipe volume
Permission denied on screenpipe volume
Screenpipe sync database attachment error
Screenpipe sync database attachment error
Last swimming outing with Dani
Last swimming outing with Dani
Definition of incarcerated
Definition of incarcerated
Chromecast remote volume buttons not working
Chromecast remote volume buttons not working
Salesforce API errors with Organization and FieldDefinition queries
Salesforce API errors with Organization and FieldDefinition queries
Daily activity summary from screenpipe data
Daily activity summary from screenpipe data
MacBook unexpected restarts and kanji screen
MacBook unexpected restarts and kanji screen
Security patch review and testing guidance
Security patch review and testing guidance
Food calorie values reference
Food calorie values reference
Tracking location history from last week
Tracking location history from last week
Screenpipe WAL processing when stopped
Screenpipe WAL processing when stopped
Reviewing recent conversation highlights
Reviewing recent conversation highlights
Mac aliases not recognized
Mac aliases not recognized
Boosteroid still recording despite ignored windows setting
Boosteroid still recording despite ignored windows setting
Missing JavaScript promise in authorization response
Missing JavaScript promise in authorization response
Linux SQLite UI for NAS
Linux SQLite UI for NAS
Claude API 500 internal server error
Claude API 500 internal server error
Screenpipe query capabilities and usage
Screenpipe query capabilities and usage
eGPU compatibility with Mac mini and Studio
eGPU compatibility with Mac mini and Studio
All chats
All chats
Lukas Kovalik, Settings
LK
Lukas Kovalik
Pro plan
Get apps and extensions
April 2026 spending by category, rename chat
April 2026 spending by category
More options for April 2026 spending by category
Claude is responding
You said: Show me my spending by category for April 2026
You said: Show me my spending by category for April 2026
Show me my spending by category for April 2026
20:12
Edit
Copy
Categorizing transactions and segregating spending data
Categorizing transactions and segregating spending data
Categorizing transactions and segregating spending data
Most of April's transactions aren't tagged yet, so the breakdown by tag isn't very useful — only one item is categorized (and "Salary" is income, not spending). Let me pull the actual transactions so we can see what's there.
Organized spending categories and architected visualization layout
Organized spending categories and architected visualization layout
Organized spending categories and architected visualization layout
Almost everything in April is untagged in Finance Hub, so the built-in spending_by_tag breakdown only shows "Salary" and one big untagged bucket. I went through all 49 POS transactions plus one debit and grouped them by merchant. Total spending:
851.39 EUR
(excluding the 4325.26 EUR salary and 1000 EUR incoming transfer).
Bar chart of April 2026 spending grouped by category, totaling 851.39 EUR across 49 transactions, with health and medical at 275.67 EUR being the largest category.
Bar chart of April 2026 spending grouped by category, totaling 851.39 EUR across 49 transactions, with health and medical at 275.67 EUR being the largest category.
Total spent
€851.39
Transactions
50
Avg / day
€28.38
Largest single
€224.86
Widget actions
A few things worth flagging:
The data is essentially untagged.
Only the salary credit has a tag. Because of that, the breakdown above is my best-guess merchant grouping rather than something the system computed. Health & medical is dominated by one 224.86 EUR charge at REMEDIKOR on 22.04 — without that, total spending is closer to 626 EUR.
Notable items inside categories:
Groceries split roughly: Lidl 172, CBA 53, Billa 20, Kaufland 8
Subscriptions: Vivacom 45.05, Claude.ai 21.60, Boosteroid 9.89, Dennikn.sk 7.99, Anthropic API 6.00, Google 2.81
Transport & fuel is mostly one Botevgrad fuel stop (83.40) plus a Sofia transit micro-charge
Travel + the Slovak pharmacy charges (Lekáreň Beata, Dr.Max) cluster on 30.04 — looks like a day trip to Slovakia
Want me to actually tag these?
I can run
add_tag
across the April transactions so future
spending_by_tag
calls return useful data without me having to eyeball merchant names every time. If yes, just say the word and
Scroll to bottom
Want to be notified when Claude responds?
Notify
Write a message…
Write a message…
Add files, connectors, and more
Model: Opus 4.7 Adaptive
Opus 4.7
Adaptive
Stop response
Claude is AI and can make mistakes. Please double-check responses.
Claude is AI and can make mistakes. Please double-check responses....
|
NULL
|
NULL
|
NULL
|
NULL
|
|
2563
|
108
|
17
|
2026-05-07T11:27:09.291443+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778153229291_m2.jpg...
|
Claude
|
Claude
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Skip to content
Skip to content
Click to collapse
Skip to content
Skip to content
Click to collapse
⌘B
Drag to resize
Open sidebar
Chat
Cowork
Code
New chat ⌘N
New chat
⌘N
Projects
Artifacts
Customize
Pinned
Bulgarian citizenship application process for EU residents
More options for Bulgarian citizenship application process for EU residents
Dawarich location tracking project
More options for Dawarich location tracking project
Recents
View all
HubSpot rate limit implementation strategy
More options for HubSpot rate limit implementation strategy
Screenpipe retention policy code location
More options for Screenpipe retention policy code location
Viewing retention policy in screenpipe
More options for Viewing retention policy in screenpipe
Clean shot x video recording termination issue
More options for Clean shot x video recording termination issue
HubSpot rate limit handling with executeRequest
More options for HubSpot rate limit handling with executeRequest
Untitled
More options
💬 Screen pipe. Is there ability…
More options for 💬 Screen pipe. Is there ability…
SMB mount access inconsistency between Finder and iTerm
More options for SMB mount access inconsistency between Finder and iTerm
💬 What is the best switch I can…
More options for 💬 What is the best switch I can…
Permission denied on screenpipe volume
More options for Permission denied on screenpipe volume
Screenpipe sync database attachment error
More options for Screenpipe sync database attachment error
Last swimming outing with Dani
More options for Last swimming outing with Dani
Definition of incarcerated
More options for Definition of incarcerated
Chromecast remote volume buttons not working
More options for Chromecast remote volume buttons not working
Salesforce API errors with Organization and FieldDefinition queries
More options for Salesforce API errors with Organization and FieldDefinition queries
Daily activity summary from screenpipe data
More options for Daily activity summary from screenpipe data
MacBook unexpected restarts and kanji screen
More options for MacBook unexpected restarts and kanji screen
Security patch review and testing guidance
More options for Security patch review and testing guidance
Food calorie values reference
More options for Food calorie values reference
Tracking location history from last week
More options for Tracking location history from last week
Lukas Pro
Get apps and extensions
HubSpot rate limit implementation strategy, rename chat
HubSpot rate limit implementation strategy
More options for HubSpot rate limit implementation strategy
Open sidebar
Claude is responding
You said: So just a solution for rate limit implementation.
You said: So just a solution for rate limit implementation.
So just a solution for rate limit implementation. The situation currently is that there are some daily and secondary limits for HubSpot. I would like to make sure I never reach a 429 error rate limit. The requests can come from any flow. It can be:
updating activity (engagement, meeting, call, note)
searching for a company or contact
updating deal
patching IDs
Review what the limit is at the moment in the HubSpot documentation and then think of the solution:
where to store it
how to read it
how to work with multiple jobs
how to work with paginated requests Let's consider a situation when there are 600 opportunities to sync. What would be the flow? How would the rate limit be recognized? How would it be handled? What are the potential issues? [API usage guidelines and limits - HubSpot docs](
https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines
https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines
). Example of such a error Client error:
POST https://api.hubapi.com/crm/v3/objects/contact/search
resulted in a
429 Too Many Requests
response: {"status":"error","message":"You have reached your secondly limit.","errorType":"RATE_LIMIT","correlationId":"019dffc4-4 (truncated...). Think carefully about the implementation and potential issue and bottlenecks.
Show more
10:42
Edit
Copy
Claude responded: Current HubSpot limits (Apr 2026)
Claude responded: Current HubSpot limits (Apr 2026)
Synthesized HubSpot rate limit architecture with Redis storage and sliding window algorithms
Synthesized HubSpot rate limit architecture with Redis storage and sliding window algorithms
Current HubSpot limits (Apr 2026)
Current HubSpot limits (Apr 2026)
For privately distributed apps (which is what Jiminny presumably uses with HubSpot), the limits are layered: a per-app burst window of 100/10s on Free/Starter, 190/10s on Pro/Enterprise, or 250/10s with the API Limit Increase add-on
, plus a per-account daily cap of 250k / 625k / 1M depending on tier — shared across all private apps in the account
. The burst window is per app; the daily quota is per portal.
hubspot
hubspot
hubspot
hubspot
The Search API is special: five requests per second per account, capped at 200 records per page, with a hard 10,000-result ceiling per query
. That's the limit the 429 in your example is hitting (
secondly limit
on
/crm/v3/objects/contact/search
). It's a separate bucket from the 190/10s, and critically, search responses do not include the
X-HubSpot-RateLimit-*
headers
— you can't read remaining capacity off the response, you have to track it yourself.
hubspot
hubspot
hubspot
hubspot
Non-search endpoints return
X-HubSpot-RateLimit-Remaining
,
-Max
, and
-Interval-Milliseconds
. The daily headers are not returned for OAuth-authenticated calls
, so for those you check the account-info endpoint or maintain your own counter. There's also a soft rule: errors should stay under 5% of total daily requests
— that's enforced for marketplace listing, but it's also a sane operational target.
hubspot
hubspot
hubspot
hubspot
So you have
four buckets
to track at minimum: app-burst (10s sliding), search-secondly (1s sliding), account-daily (24h fixed, midnight in HubSpot's TZ), and per-app daily share (your own budgeting on top of the account cap).
Where to store it
Where to store it
Redis. It's the only realistic option once you have multiple queue workers — DB-backed counters serialize too much, and in-process state can't coordinate across workers. Laravel already speaks Redis natively, and you get atomic
INCR
/
EXPIRE
plus Lua scripting for true CAS semantics.
Key layout I'd use:
Copy to clipboard
hubspot:rl:burst:{portalId}:{appId} ZSET (sliding 10s)
hubspot:rl:search:{portalId} ZSET (sliding 1s)
hubspot:rl:daily:{portalId} STRING + TTL to midnight TZ
hubspot:rl:meta:{portalId} HASH (last seen headers)
The two short-window buckets are sliding-window-log (Redis ZSET, score =
microtime
, member = unique request id). Lua script removes entries older than the window, counts remaining slots, and only adds the new one if there's room — all atomic. Fixed windows are simpler but allow 2× the limit at the boundary, which on a 5/s window is brutal.
The daily bucket is a plain
INCR
with TTL set to seconds-until-midnight in
HubSpot's account timezone
, not yours — Sofia is UTC+2/+3 but your portal might be set to US Eastern. Get this once and cache it.
How to read it
How to read it
Two-phase: optimistic pre-check, authoritative post-update.
Before a call, run the Lua acquire script. If it returns "denied," sleep until a slot frees up (the script can return ms-until-next-slot) or push the job back to the queue with a delay. Don't busy-loop.
After the call, parse
X-HubSpot-RateLimit-Remaining
/
-Max
/
-Interval-Milliseconds
and store them in
hubspot:rl:meta:{portalId}
. This is your reality check — if your local counter says 50 remaining but HubSpot's header says 5, you trust HubSpot and clamp your counter. This handles clock drift, missed accounting (e.g., crashed worker that took a token but never made the request), and other apps in the same account consuming the daily budget invisibly.
For search specifically, since headers don't come back, the local counter
is
the source of truth — meaning if you ever crash mid-flight, you've under-counted. Always release tokens on connection-level failure but
not
on 429 (you really did make that request).
How to work with multiple jobs
How to work with multiple jobs
The queue layer needs to enforce concurrency separately from the rate limiter. Both work together:
Concurrency cap
via
Queue::throttle()
or a Redis semaphore — limits how many sync workers run in parallel against HubSpot. Without this, you can have 50 workers all blocked waiting for tokens, which is wasteful and creates retry storms.
Per-tenant fairness
— if you sync many Jiminny customers into different HubSpot portals, each portal has its own bucket but you still want one slow portal not to starve others. Either separate queues per portal or a fair-share scheduler.
Priority lanes
— webhook-driven updates (user-visible latency) should outrank background batch syncs. Two queues:
hubspot-priority
and
hubspot-bulk
, with priority workers taking 70% of the burst budget and bulk taking 30% (enforce via separate sub-buckets if you really want hard separation, otherwise just pull from priority first).
Backoff on 429
— respect the
Retry-After
header. If absent, exponential with jitter (e.g.,
min(2^attempt * 250ms, 30s) ± 20%
). The jitter is non-negotiable; without it, simultaneous 429s retry in lockstep and you get thundering-herd 429s on retry.
How to work with paginated requests
How to work with paginated requests
The trap is treating "fetch all" as one logical operation. Each page is its own API call and competes for tokens with everything else.
Two practical rules:
Don't hold the worker idle while paginating.
If page N takes 500ms and page N+1 needs to wait 800ms for a token, you've burned 800ms of worker time doing nothing. Instead, fetch page N, dispatch the
processing
of page N as a separate job, and queue a "fetch page N+1" job with a delay equal to the wait time. Each page becomes its own atomic unit.
Always batch where HubSpot offers it.
POST /crm/v3/objects/{type}/batch/{read|update|create}
accepts up to 100 IDs per call. For your "patching IDs" flow this is the difference between 600 calls and 6.
Walkthrough: 600 opportunities
Walkthrough: 600 opportunities
Naive flow (one PATCH per deal): 600 calls. At 190/10s that's ~32s of API time, well under daily. You'd hit burst easily without throttling. Plus likely 1-3 search calls upfront and N association calls.
Sane flow:
Identify deltas
— if you can avoid Search at all, do. Use
lastmodifieddate
filter on a single search if you must, paginate at limit=200. For 600 deals that's 3 search calls @ 5/s = ~600ms naturally throttled.
Batch read
current state —
POST /crm/v3/objects/deals/batch/read
with 100 IDs per call → 6 calls. Burst weight 6.
Compute diff
in your code (no API).
Batch update
—
POST /crm/v3/objects/deals/batch/update
with 100 per call → 6 calls.
Associations
—
POST /crm/v4/associations/{from}/{to}/batch/create
if needed → another few batch calls.
Total: ~15-20 API calls for 600 deals. Burst budget consumed: 20/190 over ~5s. Daily impact: trivial.
Recognition: pre-check denies if
<weight>
slots aren't free; on 429 the response surfaces
policyName
(DAILY/SECONDLY) — log it, push the job back with
Retry-After
delay, increment a metric so you can alarm on sustained 429 rate.
Pitfalls & bottlenecks worth pre-empting
Pitfalls & bottlenecks worth pre-empting
Daily quota is shared across the whole portal
, including any n8n flows, other private apps, marketing automation calling APIs, etc. Budget for ~70-80% of the documented limit, not 100%. Add an internal per-app daily cap so a runaway sync can't starve other apps.
Search is uniquely fragile
: separate 5/s bucket, no headers to read, 10k-result cap per query. If you ever hit 10k+ deals matching a filter, partition by
hs_object_id
ranges or by
lastmodifieddate
windows.
Retry storms after HubSpot incidents
— always jitter, always cap total retries (e.g., 5 attempts, then dead-letter).
Webhook → sync → webhook loops
— when your update fires a HubSpot webhook that triggers another sync. Tag your own writes (e.g., a custom property
jy_last_sync_id
) and ignore webhooks where it just changed.
Token refresh
— OAuth refresh itself counts against burst. Cache the access token in Redis with TTL =
expires_in - 60s
, single-flight the refresh (only one worker refreshes; others wait on a lock).
Search latency for fresh writes
— newly created/updated objects don't appear in search instantly. Don't write-then-search; use returned IDs directly.
Clock skew
— Redis is authoritative. Don't use
time()
from each worker for window scoring; use
redis.call('TIME')
inside the Lua script.
Dead workers with held tokens
— sliding-window-log handles this naturally because tokens expire by score; token-bucket implementations need explicit release-on-crash logic.
The 5% error rule
counts every 429 toward your error budget, even successfully retried ones. If your pre-check is working well, 429s should be near zero — if they're not, your pre-check is wrong, not just slow.
Phantom contention with Laravel
RateLimited
middleware
: it's per-job-class by default, not per-portal. If your
SyncDealJob
and
UpdateActivityJob
are different classes both calling HubSpot, they don't share a Laravel-level limiter — you need a single
HubspotRateLimiter
service that everything routes through.
If you want, I can sketch the Lua script for the sliding-window acquire and the Laravel service wrapper around it.
Copy
Give positive feedback
Give negative feedback
You said: What will happen if there are two different types of rate limits?
You said: What will happen if there are two different types of rate limits?
What will happen if there are two different types of rate limits?
Search requests that have 5 requests per second
The other rate limit that has, let's say, 100 requests per 10 seconds How do these work together? Is there some conflict? Can I reach the limit with one request and block either as well, or are these separated? Can I still continue making search requests once I hit the normal requests limits?
13:40
Edit
Copy
Claude responded: They're independent buckets — with one shared bucket on top.
Claude responded: They're independent buckets — with one shared bucket on top.
Analyzed independent rate limit buckets and their practical interactions
Analyzed independent rate limit buckets and their practical interactions
They're independent buckets — with one shared bucket on top.
The three buckets and what each call hits
The three buckets and what each call hits
Copy to clipboard
┌──────────────────┐
Search request ──→ │ Search: 5/sec │ ──┐
└──────────────────┘ │
├──→ ┌─────────────────┐
┌──────────────────┐ │ │ Daily: 250k–1M │
Non-search call ──→ │ Burst: 190/10s │ ──┘ │ (per portal) │
└──────────────────┘ └─────────────────┘
A search call is only metered against the search bucket and the daily bucket. A non-search call (batch read/update, single PATCH, associations, etc.) is only metered against the burst bucket and the daily bucket. The two short-window buckets do not share counters.
What this means practically
What this means practically
Hitting search secondly limit (5/s):
Only further
/search
calls 429. Your batch reads, batch updates, single PATCHes, association calls — all keep working at full burst speed. This is actually useful: if your sync is bottlenecked on Search, you can pivot to using
lastmodifieddate
filters via batch endpoints, or use the IDs you already have to do batch reads, while Search cools off.
Hitting burst limit (190/10s):
Only non-search calls 429. You can still issue Search calls at 5/s. Useful for: continuing to identify deltas for queueing while in-flight updates drain, or refreshing a small set of records via Search even though your write pipeline is paused.
Hitting daily limit:
Everything stops. Search and non-search alike. Doesn't unblock until midnight in your portal's configured timezone — and remember this is shared across every private app in the portal, plus n8n flows, marketing tools, anything else hitting the API with that account.
So can one type of request block the other?
So can one type of request block the other?
Search → Burst:
No.
Saturating Search at 50 calls per 10s leaves your full 190/10s burst untouched.
Burst → Search:
No.
Saturating burst leaves Search's 5/s untouched.
Either → Daily:
Yes
, but only by contributing to the same daily counter. It's volume that kills you here, not the type.
In theory you can sustain ~50 search + ~190 other =
~240 calls per 10 seconds
indefinitely (until daily runs out), because the two buckets bill independently.
Implementation consequence
Implementation consequence
Your rate limiter needs to know which bucket a request hits before it acquires. Cleanest pattern:
Copy to clipboard
php
$limiter
->
acquire
(
'search'
,
$weight
=
1
)
;
// for search endpoints only
$limiter
->
acquire
(
'burst'
,
$weight
=
1
)
;
// for everything else
$limiter
->
acquire
(
'daily'
,
$weight
=
1
)
;
// every call, both kinds
In Redis: three separate keys, three separate Lua acquire scripts (or one script with a bucket parameter). A search call calls
acquire('search')
+
acquire('daily')
. A batch update calls
acquire('burst')
+
acquire('daily')
.
One subtle pitfall: when you backoff on a 429,
inspect
policyName
in the response body
to know which bucket actually fired. If you see
SECONDLY
from a search endpoint, you only need to delay search-bound jobs — burst-bound jobs in the queue can keep running. If you blanket-pause everything on any 429, you waste capacity on the bucket that's still healthy. Two queues (or two throttle keys) make this clean; one global pause is the lazy version.
The other subtlety: the burst response gives you
X-HubSpot-RateLimit-Remaining...
|
[{"role":"AXLink","text":& [{"role":"AXLink","text":"Skip to content","depth":14,"bounds":{"left":0.029587766,"top":0.03830806,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Skip to content","depth":15,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Click to collapse","depth":16,"bounds":{"left":0.10239362,"top":0.06703911,"width":0.030585106,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.10239362,"top":0.06703911,"width":0.0029920214,"height":0.011971269}},{"char_start":1,"char_count":16,"bounds":{"left":0.10538564,"top":0.06703911,"width":0.027925532,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"⌘B","depth":16,"bounds":{"left":0.1349734,"top":0.06703911,"width":0.0063164895,"height":0.011971269},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Drag to resize","depth":16,"bounds":{"left":0.10239362,"top":0.079010375,"width":0.025930852,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.10239362,"top":0.079010375,"width":0.0029920214,"height":0.011971269}},{"char_start":1,"char_count":13,"bounds":{"left":0.10538564,"top":0.079010375,"width":0.022938829,"height":0.011971269}}],"role_description":"text"},{"role":"AXButton","text":"Open sidebar","depth":14,"bounds":{"left":0.029920213,"top":0.02793296,"width":0.00930851,"height":0.022346368},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Chat","depth":16,"bounds":{"left":0.004986702,"top":0.059856344,"width":0.025930852,"height":0.022346368},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cowork","depth":16,"bounds":{"left":0.03158245,"top":0.059856344,"width":0.03125,"height":0.022346368},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code","depth":16,"bounds":{"left":0.0631649,"top":0.059856344,"width":0.026928192,"height":0.022346368},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New chat ⌘N","depth":15,"bounds":{"left":0.0043218085,"top":0.08938547,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"New chat","depth":16,"bounds":{"left":0.014295213,"top":0.0933759,"width":0.018949468,"height":0.012769354},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.014295213,"top":0.0933759,"width":0.003656915,"height":0.013567438}},{"char_start":1,"char_count":7,"bounds":{"left":0.01761968,"top":0.0933759,"width":0.015957447,"height":0.013567438}}],"role_description":"text"},{"role":"AXStaticText","text":"⌘N","depth":17,"bounds":{"left":0.08178192,"top":0.0933759,"width":0.006981383,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Projects","depth":15,"bounds":{"left":0.0043218085,"top":0.110135674,"width":0.08643617,"height":0.019952115},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Artifacts","depth":15,"bounds":{"left":0.0043218085,"top":0.1300878,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Customize","depth":15,"bounds":{"left":0.0043218085,"top":0.15003991,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Pinned","depth":16,"bounds":{"left":0.0063164895,"top":0.18914606,"width":0.08377659,"height":0.013567438},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXButton","text":"Bulgarian citizenship application process for EU residents","depth":18,"bounds":{"left":0.0043218085,"top":0.20590582,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Bulgarian citizenship application process for EU residents","depth":19,"bounds":{"left":0.08344415,"top":0.20909816,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Dawarich location tracking project","depth":18,"bounds":{"left":0.0043218085,"top":0.22745411,"width":0.08643617,"height":0.019952115},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Dawarich location tracking project","depth":19,"bounds":{"left":0.08344415,"top":0.22984837,"width":0.005984043,"height":0.015163607},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Recents","depth":16,"bounds":{"left":0.0063164895,"top":0.25698325,"width":0.06349734,"height":0.012769354},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXButton","text":"View all","depth":16,"bounds":{"left":0.07114362,"top":0.25698325,"width":0.018949468,"height":0.012769354},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HubSpot rate limit implementation strategy","depth":18,"bounds":{"left":0.0043218085,"top":0.27294493,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for HubSpot rate limit implementation strategy","depth":19,"bounds":{"left":0.08344415,"top":0.27613726,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Screenpipe retention policy code location","depth":18,"bounds":{"left":0.0043218085,"top":0.29449323,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Screenpipe retention policy code location","depth":19,"bounds":{"left":0.08344415,"top":0.29768556,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Viewing retention policy in screenpipe","depth":18,"bounds":{"left":0.0043218085,"top":0.31524342,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Viewing retention policy in screenpipe","depth":19,"bounds":{"left":0.08344415,"top":0.31843576,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Clean shot x video recording termination issue","depth":18,"bounds":{"left":0.0043218085,"top":0.3367917,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Clean shot x video recording termination issue","depth":19,"bounds":{"left":0.08344415,"top":0.33998403,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HubSpot rate limit handling with executeRequest","depth":18,"bounds":{"left":0.0043218085,"top":0.3575419,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for HubSpot rate limit handling with executeRequest","depth":19,"bounds":{"left":0.08344415,"top":0.36073422,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Untitled","depth":18,"bounds":{"left":0.0043218085,"top":0.3790902,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options","depth":19,"bounds":{"left":0.08344415,"top":0.38228253,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"💬 Screen pipe. Is there ability…","depth":18,"bounds":{"left":0.0043218085,"top":0.39984038,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for 💬 Screen pipe. Is there ability…","depth":19,"bounds":{"left":0.08344415,"top":0.40303272,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"SMB mount access inconsistency between Finder and iTerm","depth":18,"bounds":{"left":0.0043218085,"top":0.42138866,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for SMB mount access inconsistency between Finder and iTerm","depth":19,"bounds":{"left":0.08344415,"top":0.4237829,"width":0.005984043,"height":0.015163607},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"💬 What is the best switch I can…","depth":18,"bounds":{"left":0.0043218085,"top":0.44213888,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for 💬 What is the best switch I can…","depth":19,"bounds":{"left":0.08344415,"top":0.44533122,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Permission denied on screenpipe volume","depth":18,"bounds":{"left":0.0043218085,"top":0.46288908,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Permission denied on screenpipe volume","depth":19,"bounds":{"left":0.08344415,"top":0.4660814,"width":0.005984043,"height":0.015163607},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Screenpipe sync database attachment error","depth":18,"bounds":{"left":0.0043218085,"top":0.48443735,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Screenpipe sync database attachment error","depth":19,"bounds":{"left":0.08344415,"top":0.48762968,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Last swimming outing with Dani","depth":18,"bounds":{"left":0.0043218085,"top":0.5051876,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Last swimming outing with Dani","depth":19,"bounds":{"left":0.08344415,"top":0.5083799,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Definition of incarcerated","depth":18,"bounds":{"left":0.0043218085,"top":0.52673584,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Definition of incarcerated","depth":19,"bounds":{"left":0.08344415,"top":0.52992815,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Chromecast remote volume buttons not working","depth":18,"bounds":{"left":0.0043218085,"top":0.547486,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Chromecast remote volume buttons not working","depth":19,"bounds":{"left":0.08344415,"top":0.5506784,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Salesforce API errors with Organization and FieldDefinition queries","depth":18,"bounds":{"left":0.0043218085,"top":0.56903434,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Salesforce API errors with Organization and FieldDefinition queries","depth":19,"bounds":{"left":0.08344415,"top":0.57222664,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Daily activity summary from screenpipe data","depth":18,"bounds":{"left":0.0043218085,"top":0.5897845,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Daily activity summary from screenpipe data","depth":19,"bounds":{"left":0.08344415,"top":0.59297687,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"MacBook unexpected restarts and kanji screen","depth":18,"bounds":{"left":0.0043218085,"top":0.6113328,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for MacBook unexpected restarts and kanji screen","depth":19,"bounds":{"left":0.08344415,"top":0.61452514,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Security patch review and testing guidance","depth":18,"bounds":{"left":0.0043218085,"top":0.632083,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Security patch review and testing guidance","depth":19,"bounds":{"left":0.08344415,"top":0.63527536,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Food calorie values reference","depth":18,"bounds":{"left":0.0043218085,"top":0.65363127,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Food calorie values reference","depth":19,"bounds":{"left":0.08344415,"top":0.65682364,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tracking location history from last week","depth":18,"bounds":{"left":0.0043218085,"top":0.6743815,"width":0.08643617,"height":0.011173184},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Tracking location history from last week","depth":19,"bounds":{"left":0.08344415,"top":0.6775738,"width":0.005984043,"height":0.007980846},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"Lukas Pro","depth":15,"bounds":{"left":0.0043218085,"top":0.6943336,"width":0.037898935,"height":0.01915403},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Get apps and extensions","depth":15,"bounds":{"left":0.08277926,"top":0.6943336,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HubSpot rate limit implementation strategy, rename chat","depth":19,"bounds":{"left":0.043218084,"top":0.02793296,"width":0.09773936,"height":0.022346368},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"HubSpot rate limit implementation strategy","depth":21,"bounds":{"left":0.04454787,"top":0.031923383,"width":0.09507979,"height":0.014365523},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.04454787,"top":0.031923383,"width":0.003656915,"height":0.014365523}},{"char_start":1,"char_count":41,"bounds":{"left":0.048204787,"top":0.031923383,"width":0.09142287,"height":0.014365523}}],"role_description":"text"},{"role":"AXPopUpButton","text":"More options for HubSpot rate limit implementation strategy","depth":19,"bounds":{"left":0.14128989,"top":0.02793296,"width":0.0066489363,"height":0.022346368},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open sidebar","depth":21,"bounds":{"left":0.48537233,"top":0.026336791,"width":0.010638298,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Claude is responding","depth":21,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"You said: So just a solution for rate limit implementation.","depth":20,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"You said: So just a solution for rate limit implementation.","depth":21,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"So just a solution for rate limit implementation. The situation currently is that there are some daily and secondary limits for HubSpot. I would like to make sure I never reach a 429 error rate limit. The requests can come from any flow. It can be:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"updating activity (engagement, meeting, call, note)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"searching for a company or contact","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"updating deal","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"patching IDs\nReview what the limit is at the moment in the HubSpot documentation and then think of the solution:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"where to store it","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"how to read it","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"how to work with multiple jobs","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"how to work with paginated requests Let's consider a situation when there are 600 opportunities to sync. What would be the flow? How would the rate limit be recognized? How would it be handled? What are the potential issues? [API usage guidelines and limits - HubSpot docs](","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines","depth":25,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"). Example of such a error Client error:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"POST https://api.hubapi.com/crm/v3/objects/contact/search","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"resulted in a","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"429 Too Many Requests","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT\",\"correlationId\":\"019dffc4-4 (truncated...). Think carefully about the implementation and potential issue and bottlenecks.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Show more","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"10:42","depth":22,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Edit","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"Claude responded: Current HubSpot limits (Apr 2026)","depth":21,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Claude responded: Current HubSpot limits (Apr 2026)","depth":22,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Synthesized HubSpot rate limit architecture with Redis storage and sliding window algorithms","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Synthesized HubSpot rate limit architecture with Redis storage and sliding window algorithms","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Current HubSpot limits (Apr 2026)","depth":24,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Current HubSpot limits (Apr 2026)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"For privately distributed apps (which is what Jiminny presumably uses with HubSpot), the limits are layered: a per-app burst window of 100/10s on Free/Starter, 190/10s on Pro/Enterprise, or 250/10s with the API Limit Increase add-on","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", plus a per-account daily cap of 250k / 625k / 1M depending on tier — shared across all private apps in the account","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":". The burst window is per app; the daily quota is per portal.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"hubspot","depth":26,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"hubspot","depth":26,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The Search API is special: five requests per second per account, capped at 200 records per page, with a hard 10,000-result ceiling per query","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":". That's the limit the 429 in your example is hitting (","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"secondly limit","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"on","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/crm/v3/objects/contact/search","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"). It's a separate bucket from the 190/10s, and critically, search responses do not include the","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"X-HubSpot-RateLimit-*","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"headers","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— you can't read remaining capacity off the response, you have to track it yourself.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"hubspot","depth":26,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"hubspot","depth":26,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Non-search endpoints return","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"X-HubSpot-RateLimit-Remaining","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":",","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"-Max","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", and","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"-Interval-Milliseconds","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":". The daily headers are not returned for OAuth-authenticated calls","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", so for those you check the account-info endpoint or maintain your own counter. There's also a soft rule: errors should stay under 5% of total daily requests","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— that's enforced for marketplace listing, but it's also a sane operational target.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"hubspot","depth":26,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"hubspot","depth":26,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"So you have","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"four buckets","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"to track at minimum: app-burst (10s sliding), search-secondly (1s sliding), account-daily (24h fixed, midnight in HubSpot's TZ), and per-app daily share (your own budgeting on top of the account cap).","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Where to store it","depth":24,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Where to store it","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Redis. It's the only realistic option once you have multiple queue workers — DB-backed counters serialize too much, and in-process state can't coordinate across workers. Laravel already speaks Redis natively, and you get atomic","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"INCR","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"EXPIRE","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"plus Lua scripting for true CAS semantics.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Key layout I'd use:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy to clipboard","depth":27,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot:rl:burst:{portalId}:{appId} ZSET (sliding 10s)","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hubspot:rl:search:{portalId} ZSET (sliding 1s)","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hubspot:rl:daily:{portalId} STRING + TTL to midnight TZ","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hubspot:rl:meta:{portalId} HASH (last seen headers)","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The two short-window buckets are sliding-window-log (Redis ZSET, score =","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"microtime","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", member = unique request id). Lua script removes entries older than the window, counts remaining slots, and only adds the new one if there's room — all atomic. Fixed windows are simpler but allow 2× the limit at the boundary, which on a 5/s window is brutal.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The daily bucket is a plain","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"INCR","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"with TTL set to seconds-until-midnight in","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"HubSpot's account timezone","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", not yours — Sofia is UTC+2/+3 but your portal might be set to US Eastern. Get this once and cache it.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"How to read it","depth":24,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"How to read it","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Two-phase: optimistic pre-check, authoritative post-update.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Before a call, run the Lua acquire script. If it returns \"denied,\" sleep until a slot frees up (the script can return ms-until-next-slot) or push the job back to the queue with a delay. Don't busy-loop.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"After the call, parse","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"X-HubSpot-RateLimit-Remaining","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"-Max","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"-Interval-Milliseconds","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"and store them in","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hubspot:rl:meta:{portalId}","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":". This is your reality check — if your local counter says 50 remaining but HubSpot's header says 5, you trust HubSpot and clamp your counter. This handles clock drift, missed accounting (e.g., crashed worker that took a token but never made the request), and other apps in the same account consuming the daily budget invisibly.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"For search specifically, since headers don't come back, the local counter","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"is","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"the source of truth — meaning if you ever crash mid-flight, you've under-counted. Always release tokens on connection-level failure but","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"not","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"on 429 (you really did make that request).","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"How to work with multiple jobs","depth":24,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"How to work with multiple jobs","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The queue layer needs to enforce concurrency separately from the rate limiter. Both work together:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Concurrency cap","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"via","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Queue::throttle()","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"or a Redis semaphore — limits how many sync workers run in parallel against HubSpot. Without this, you can have 50 workers all blocked waiting for tokens, which is wasteful and creates retry storms.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Per-tenant fairness","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— if you sync many Jiminny customers into different HubSpot portals, each portal has its own bucket but you still want one slow portal not to starve others. Either separate queues per portal or a fair-share scheduler.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Priority lanes","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— webhook-driven updates (user-visible latency) should outrank background batch syncs. Two queues:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hubspot-priority","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"and","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hubspot-bulk","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", with priority workers taking 70% of the burst budget and bulk taking 30% (enforce via separate sub-buckets if you really want hard separation, otherwise just pull from priority first).","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Backoff on 429","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— respect the","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Retry-After","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"header. If absent, exponential with jitter (e.g.,","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"min(2^attempt * 250ms, 30s) ± 20%","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"). The jitter is non-negotiable; without it, simultaneous 429s retry in lockstep and you get thundering-herd 429s on retry.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"How to work with paginated requests","depth":24,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"How to work with paginated requests","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The trap is treating \"fetch all\" as one logical operation. Each page is its own API call and competes for tokens with everything else.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Two practical rules:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Don't hold the worker idle while paginating.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"If page N takes 500ms and page N+1 needs to wait 800ms for a token, you've burned 800ms of worker time doing nothing. Instead, fetch page N, dispatch the","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"processing","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"of page N as a separate job, and queue a \"fetch page N+1\" job with a delay equal to the wait time. Each page becomes its own atomic unit.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Always batch where HubSpot offers it.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"POST /crm/v3/objects/{type}/batch/{read|update|create}","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"accepts up to 100 IDs per call. For your \"patching IDs\" flow this is the difference between 600 calls and 6.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Walkthrough: 600 opportunities","depth":24,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Walkthrough: 600 opportunities","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Naive flow (one PATCH per deal): 600 calls. At 190/10s that's ~32s of API time, well under daily. You'd hit burst easily without throttling. Plus likely 1-3 search calls upfront and N association calls.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Sane flow:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Identify deltas","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— if you can avoid Search at all, do. Use","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"lastmodifieddate","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"filter on a single search if you must, paginate at limit=200. For 600 deals that's 3 search calls @ 5/s = ~600ms naturally throttled.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Batch read","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"current state —","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"POST /crm/v3/objects/deals/batch/read","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"with 100 IDs per call → 6 calls. Burst weight 6.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Compute diff","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"in your code (no API).","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Batch update","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"—","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"POST /crm/v3/objects/deals/batch/update","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"with 100 per call → 6 calls.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Associations","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"—","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"POST /crm/v4/associations/{from}/{to}/batch/create","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"if needed → another few batch calls.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Total: ~15-20 API calls for 600 deals. Burst budget consumed: 20/190 over ~5s. Daily impact: trivial.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Recognition: pre-check denies if","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"<weight>","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"slots aren't free; on 429 the response surfaces","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"policyName","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"(DAILY/SECONDLY) — log it, push the job back with","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Retry-After","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"delay, increment a metric so you can alarm on sustained 429 rate.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Pitfalls & bottlenecks worth pre-empting","depth":24,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Pitfalls & bottlenecks worth pre-empting","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Daily quota is shared across the whole portal","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", including any n8n flows, other private apps, marketing automation calling APIs, etc. Budget for ~70-80% of the documented limit, not 100%. Add an internal per-app daily cap so a runaway sync can't starve other apps.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Search is uniquely fragile","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":": separate 5/s bucket, no headers to read, 10k-result cap per query. If you ever hit 10k+ deals matching a filter, partition by","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hs_object_id","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ranges or by","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"lastmodifieddate","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"windows.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Retry storms after HubSpot incidents","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— always jitter, always cap total retries (e.g., 5 attempts, then dead-letter).","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Webhook → sync → webhook loops","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— when your update fires a HubSpot webhook that triggers another sync. Tag your own writes (e.g., a custom property","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"jy_last_sync_id","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":") and ignore webhooks where it just changed.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Token refresh","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— OAuth refresh itself counts against burst. Cache the access token in Redis with TTL =","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"expires_in - 60s","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", single-flight the refresh (only one worker refreshes; others wait on a lock).","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Search latency for fresh writes","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— newly created/updated objects don't appear in search instantly. Don't write-then-search; use returned IDs directly.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Clock skew","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— Redis is authoritative. Don't use","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"time()","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"from each worker for window scoring; use","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"redis.call('TIME')","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"inside the Lua script.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Dead workers with held tokens","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— sliding-window-log handles this naturally because tokens expire by score; token-bucket implementations need explicit release-on-crash logic.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The 5% error rule","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"counts every 429 toward your error budget, even successfully retried ones. If your pre-check is working well, 429s should be near zero — if they're not, your pre-check is wrong, not just slow.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Phantom contention with Laravel","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RateLimited","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"middleware","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":": it's per-job-class by default, not per-portal. If your","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncDealJob","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"and","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"UpdateActivityJob","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"are different classes both calling HubSpot, they don't share a Laravel-level limiter — you need a single","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"HubspotRateLimiter","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"service that everything routes through.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"If you want, I can sketch the Lua script for the sliding-window acquire and the Laravel service wrapper around it.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Give positive feedback","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Give negative feedback","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"You said: What will happen if there are two different types of rate limits?","depth":20,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"You said: What will happen if there are two different types of rate limits?","depth":21,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"What will happen if there are two different types of rate limits?","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Search requests that have 5 requests per second","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The other rate limit that has, let's say, 100 requests per 10 seconds How do these work together? Is there some conflict? Can I reach the limit with one request and block either as well, or are these separated? Can I still continue making search requests once I hit the normal requests limits?","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"13:40","depth":22,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Edit","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"Claude responded: They're independent buckets — with one shared bucket on top.","depth":21,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Claude responded: They're independent buckets — with one shared bucket on top.","depth":22,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Analyzed independent rate limit buckets and their practical interactions","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Analyzed independent rate limit buckets and their practical interactions","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"They're independent buckets — with one shared bucket on top.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"The three buckets and what each call hits","depth":24,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"The three buckets and what each call hits","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy to clipboard","depth":27,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"┌──────────────────┐","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Search request ──→ │ Search: 5/sec │ ──┐","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"└──────────────────┘ │","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"├──→ ┌─────────────────┐","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"┌──────────────────┐ │ │ Daily: 250k–1M │","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Non-search call ──→ │ Burst: 190/10s │ ──┘ │ (per portal) │","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"└──────────────────┘ └─────────────────┘","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"A search call is only metered against the search bucket and the daily bucket. A non-search call (batch read/update, single PATCH, associations, etc.) is only metered against the burst bucket and the daily bucket. The two short-window buckets do not share counters.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"What this means practically","depth":24,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"What this means practically","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Hitting search secondly limit (5/s):","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Only further","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/search","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"calls 429. Your batch reads, batch updates, single PATCHes, association calls — all keep working at full burst speed. This is actually useful: if your sync is bottlenecked on Search, you can pivot to using","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"lastmodifieddate","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"filters via batch endpoints, or use the IDs you already have to do batch reads, while Search cools off.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Hitting burst limit (190/10s):","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Only non-search calls 429. You can still issue Search calls at 5/s. Useful for: continuing to identify deltas for queueing while in-flight updates drain, or refreshing a small set of records via Search even though your write pipeline is paused.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Hitting daily limit:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Everything stops. Search and non-search alike. Doesn't unblock until midnight in your portal's configured timezone — and remember this is shared across every private app in the portal, plus n8n flows, marketing tools, anything else hitting the API with that account.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"So can one type of request block the other?","depth":24,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"So can one type of request block the other?","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Search → Burst:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"No.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Saturating Search at 50 calls per 10s leaves your full 190/10s burst untouched.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Burst → Search:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"No.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Saturating burst leaves Search's 5/s untouched.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Either → Daily:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Yes","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", but only by contributing to the same daily counter. It's volume that kills you here, not the type.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"In theory you can sustain ~50 search + ~190 other =","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"~240 calls per 10 seconds","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"indefinitely (until daily runs out), because the two buckets bill independently.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Implementation consequence","depth":24,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Implementation consequence","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Your rate limiter needs to know which bucket a request hits before it acquires. Cleanest pattern:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy to clipboard","depth":27,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"php","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$limiter","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"->","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"acquire","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"(","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"'search'","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":",","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$weight","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"=","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":")","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":";","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"// for search endpoints only","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$limiter","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"->","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"acquire","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"(","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"'burst'","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":",","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$weight","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"=","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":")","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":";","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"// for everything else","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$limiter","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"->","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"acquire","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"(","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"'daily'","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":",","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$weight","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"=","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":")","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":";","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"// every call, both kinds","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"In Redis: three separate keys, three separate Lua acquire scripts (or one script with a bucket parameter). A search call calls","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"acquire('search')","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"+","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"acquire('daily')","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":". A batch update calls","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"acquire('burst')","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"+","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"acquire('daily')","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"One subtle pitfall: when you backoff on a 429,","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"inspect","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"policyName","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"in the response body","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"to know which bucket actually fired. If you see","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SECONDLY","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"from a search endpoint, you only need to delay search-bound jobs — burst-bound jobs in the queue can keep running. If you blanket-pause everything on any 429, you waste capacity on the bucket that's still healthy. Two queues (or two throttle keys) make this clean; one global pause is the lazy version.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The other subtlety: the burst response gives you","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"X-HubSpot-RateLimit-Remaining","depth":26,"on_screen":false,"role_description":"text"}]...
|
-8056958582961017572
|
4183509203691592796
|
idle
|
accessibility
|
NULL
|
Skip to content
Skip to content
Click to collapse
Skip to content
Skip to content
Click to collapse
⌘B
Drag to resize
Open sidebar
Chat
Cowork
Code
New chat ⌘N
New chat
⌘N
Projects
Artifacts
Customize
Pinned
Bulgarian citizenship application process for EU residents
More options for Bulgarian citizenship application process for EU residents
Dawarich location tracking project
More options for Dawarich location tracking project
Recents
View all
HubSpot rate limit implementation strategy
More options for HubSpot rate limit implementation strategy
Screenpipe retention policy code location
More options for Screenpipe retention policy code location
Viewing retention policy in screenpipe
More options for Viewing retention policy in screenpipe
Clean shot x video recording termination issue
More options for Clean shot x video recording termination issue
HubSpot rate limit handling with executeRequest
More options for HubSpot rate limit handling with executeRequest
Untitled
More options
💬 Screen pipe. Is there ability…
More options for 💬 Screen pipe. Is there ability…
SMB mount access inconsistency between Finder and iTerm
More options for SMB mount access inconsistency between Finder and iTerm
💬 What is the best switch I can…
More options for 💬 What is the best switch I can…
Permission denied on screenpipe volume
More options for Permission denied on screenpipe volume
Screenpipe sync database attachment error
More options for Screenpipe sync database attachment error
Last swimming outing with Dani
More options for Last swimming outing with Dani
Definition of incarcerated
More options for Definition of incarcerated
Chromecast remote volume buttons not working
More options for Chromecast remote volume buttons not working
Salesforce API errors with Organization and FieldDefinition queries
More options for Salesforce API errors with Organization and FieldDefinition queries
Daily activity summary from screenpipe data
More options for Daily activity summary from screenpipe data
MacBook unexpected restarts and kanji screen
More options for MacBook unexpected restarts and kanji screen
Security patch review and testing guidance
More options for Security patch review and testing guidance
Food calorie values reference
More options for Food calorie values reference
Tracking location history from last week
More options for Tracking location history from last week
Lukas Pro
Get apps and extensions
HubSpot rate limit implementation strategy, rename chat
HubSpot rate limit implementation strategy
More options for HubSpot rate limit implementation strategy
Open sidebar
Claude is responding
You said: So just a solution for rate limit implementation.
You said: So just a solution for rate limit implementation.
So just a solution for rate limit implementation. The situation currently is that there are some daily and secondary limits for HubSpot. I would like to make sure I never reach a 429 error rate limit. The requests can come from any flow. It can be:
updating activity (engagement, meeting, call, note)
searching for a company or contact
updating deal
patching IDs
Review what the limit is at the moment in the HubSpot documentation and then think of the solution:
where to store it
how to read it
how to work with multiple jobs
how to work with paginated requests Let's consider a situation when there are 600 opportunities to sync. What would be the flow? How would the rate limit be recognized? How would it be handled? What are the potential issues? [API usage guidelines and limits - HubSpot docs](
https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines
https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines
). Example of such a error Client error:
POST https://api.hubapi.com/crm/v3/objects/contact/search
resulted in a
429 Too Many Requests
response: {"status":"error","message":"You have reached your secondly limit.","errorType":"RATE_LIMIT","correlationId":"019dffc4-4 (truncated...). Think carefully about the implementation and potential issue and bottlenecks.
Show more
10:42
Edit
Copy
Claude responded: Current HubSpot limits (Apr 2026)
Claude responded: Current HubSpot limits (Apr 2026)
Synthesized HubSpot rate limit architecture with Redis storage and sliding window algorithms
Synthesized HubSpot rate limit architecture with Redis storage and sliding window algorithms
Current HubSpot limits (Apr 2026)
Current HubSpot limits (Apr 2026)
For privately distributed apps (which is what Jiminny presumably uses with HubSpot), the limits are layered: a per-app burst window of 100/10s on Free/Starter, 190/10s on Pro/Enterprise, or 250/10s with the API Limit Increase add-on
, plus a per-account daily cap of 250k / 625k / 1M depending on tier — shared across all private apps in the account
. The burst window is per app; the daily quota is per portal.
hubspot
hubspot
hubspot
hubspot
The Search API is special: five requests per second per account, capped at 200 records per page, with a hard 10,000-result ceiling per query
. That's the limit the 429 in your example is hitting (
secondly limit
on
/crm/v3/objects/contact/search
). It's a separate bucket from the 190/10s, and critically, search responses do not include the
X-HubSpot-RateLimit-*
headers
— you can't read remaining capacity off the response, you have to track it yourself.
hubspot
hubspot
hubspot
hubspot
Non-search endpoints return
X-HubSpot-RateLimit-Remaining
,
-Max
, and
-Interval-Milliseconds
. The daily headers are not returned for OAuth-authenticated calls
, so for those you check the account-info endpoint or maintain your own counter. There's also a soft rule: errors should stay under 5% of total daily requests
— that's enforced for marketplace listing, but it's also a sane operational target.
hubspot
hubspot
hubspot
hubspot
So you have
four buckets
to track at minimum: app-burst (10s sliding), search-secondly (1s sliding), account-daily (24h fixed, midnight in HubSpot's TZ), and per-app daily share (your own budgeting on top of the account cap).
Where to store it
Where to store it
Redis. It's the only realistic option once you have multiple queue workers — DB-backed counters serialize too much, and in-process state can't coordinate across workers. Laravel already speaks Redis natively, and you get atomic
INCR
/
EXPIRE
plus Lua scripting for true CAS semantics.
Key layout I'd use:
Copy to clipboard
hubspot:rl:burst:{portalId}:{appId} ZSET (sliding 10s)
hubspot:rl:search:{portalId} ZSET (sliding 1s)
hubspot:rl:daily:{portalId} STRING + TTL to midnight TZ
hubspot:rl:meta:{portalId} HASH (last seen headers)
The two short-window buckets are sliding-window-log (Redis ZSET, score =
microtime
, member = unique request id). Lua script removes entries older than the window, counts remaining slots, and only adds the new one if there's room — all atomic. Fixed windows are simpler but allow 2× the limit at the boundary, which on a 5/s window is brutal.
The daily bucket is a plain
INCR
with TTL set to seconds-until-midnight in
HubSpot's account timezone
, not yours — Sofia is UTC+2/+3 but your portal might be set to US Eastern. Get this once and cache it.
How to read it
How to read it
Two-phase: optimistic pre-check, authoritative post-update.
Before a call, run the Lua acquire script. If it returns "denied," sleep until a slot frees up (the script can return ms-until-next-slot) or push the job back to the queue with a delay. Don't busy-loop.
After the call, parse
X-HubSpot-RateLimit-Remaining
/
-Max
/
-Interval-Milliseconds
and store them in
hubspot:rl:meta:{portalId}
. This is your reality check — if your local counter says 50 remaining but HubSpot's header says 5, you trust HubSpot and clamp your counter. This handles clock drift, missed accounting (e.g., crashed worker that took a token but never made the request), and other apps in the same account consuming the daily budget invisibly.
For search specifically, since headers don't come back, the local counter
is
the source of truth — meaning if you ever crash mid-flight, you've under-counted. Always release tokens on connection-level failure but
not
on 429 (you really did make that request).
How to work with multiple jobs
How to work with multiple jobs
The queue layer needs to enforce concurrency separately from the rate limiter. Both work together:
Concurrency cap
via
Queue::throttle()
or a Redis semaphore — limits how many sync workers run in parallel against HubSpot. Without this, you can have 50 workers all blocked waiting for tokens, which is wasteful and creates retry storms.
Per-tenant fairness
— if you sync many Jiminny customers into different HubSpot portals, each portal has its own bucket but you still want one slow portal not to starve others. Either separate queues per portal or a fair-share scheduler.
Priority lanes
— webhook-driven updates (user-visible latency) should outrank background batch syncs. Two queues:
hubspot-priority
and
hubspot-bulk
, with priority workers taking 70% of the burst budget and bulk taking 30% (enforce via separate sub-buckets if you really want hard separation, otherwise just pull from priority first).
Backoff on 429
— respect the
Retry-After
header. If absent, exponential with jitter (e.g.,
min(2^attempt * 250ms, 30s) ± 20%
). The jitter is non-negotiable; without it, simultaneous 429s retry in lockstep and you get thundering-herd 429s on retry.
How to work with paginated requests
How to work with paginated requests
The trap is treating "fetch all" as one logical operation. Each page is its own API call and competes for tokens with everything else.
Two practical rules:
Don't hold the worker idle while paginating.
If page N takes 500ms and page N+1 needs to wait 800ms for a token, you've burned 800ms of worker time doing nothing. Instead, fetch page N, dispatch the
processing
of page N as a separate job, and queue a "fetch page N+1" job with a delay equal to the wait time. Each page becomes its own atomic unit.
Always batch where HubSpot offers it.
POST /crm/v3/objects/{type}/batch/{read|update|create}
accepts up to 100 IDs per call. For your "patching IDs" flow this is the difference between 600 calls and 6.
Walkthrough: 600 opportunities
Walkthrough: 600 opportunities
Naive flow (one PATCH per deal): 600 calls. At 190/10s that's ~32s of API time, well under daily. You'd hit burst easily without throttling. Plus likely 1-3 search calls upfront and N association calls.
Sane flow:
Identify deltas
— if you can avoid Search at all, do. Use
lastmodifieddate
filter on a single search if you must, paginate at limit=200. For 600 deals that's 3 search calls @ 5/s = ~600ms naturally throttled.
Batch read
current state —
POST /crm/v3/objects/deals/batch/read
with 100 IDs per call → 6 calls. Burst weight 6.
Compute diff
in your code (no API).
Batch update
—
POST /crm/v3/objects/deals/batch/update
with 100 per call → 6 calls.
Associations
—
POST /crm/v4/associations/{from}/{to}/batch/create
if needed → another few batch calls.
Total: ~15-20 API calls for 600 deals. Burst budget consumed: 20/190 over ~5s. Daily impact: trivial.
Recognition: pre-check denies if
<weight>
slots aren't free; on 429 the response surfaces
policyName
(DAILY/SECONDLY) — log it, push the job back with
Retry-After
delay, increment a metric so you can alarm on sustained 429 rate.
Pitfalls & bottlenecks worth pre-empting
Pitfalls & bottlenecks worth pre-empting
Daily quota is shared across the whole portal
, including any n8n flows, other private apps, marketing automation calling APIs, etc. Budget for ~70-80% of the documented limit, not 100%. Add an internal per-app daily cap so a runaway sync can't starve other apps.
Search is uniquely fragile
: separate 5/s bucket, no headers to read, 10k-result cap per query. If you ever hit 10k+ deals matching a filter, partition by
hs_object_id
ranges or by
lastmodifieddate
windows.
Retry storms after HubSpot incidents
— always jitter, always cap total retries (e.g., 5 attempts, then dead-letter).
Webhook → sync → webhook loops
— when your update fires a HubSpot webhook that triggers another sync. Tag your own writes (e.g., a custom property
jy_last_sync_id
) and ignore webhooks where it just changed.
Token refresh
— OAuth refresh itself counts against burst. Cache the access token in Redis with TTL =
expires_in - 60s
, single-flight the refresh (only one worker refreshes; others wait on a lock).
Search latency for fresh writes
— newly created/updated objects don't appear in search instantly. Don't write-then-search; use returned IDs directly.
Clock skew
— Redis is authoritative. Don't use
time()
from each worker for window scoring; use
redis.call('TIME')
inside the Lua script.
Dead workers with held tokens
— sliding-window-log handles this naturally because tokens expire by score; token-bucket implementations need explicit release-on-crash logic.
The 5% error rule
counts every 429 toward your error budget, even successfully retried ones. If your pre-check is working well, 429s should be near zero — if they're not, your pre-check is wrong, not just slow.
Phantom contention with Laravel
RateLimited
middleware
: it's per-job-class by default, not per-portal. If your
SyncDealJob
and
UpdateActivityJob
are different classes both calling HubSpot, they don't share a Laravel-level limiter — you need a single
HubspotRateLimiter
service that everything routes through.
If you want, I can sketch the Lua script for the sliding-window acquire and the Laravel service wrapper around it.
Copy
Give positive feedback
Give negative feedback
You said: What will happen if there are two different types of rate limits?
You said: What will happen if there are two different types of rate limits?
What will happen if there are two different types of rate limits?
Search requests that have 5 requests per second
The other rate limit that has, let's say, 100 requests per 10 seconds How do these work together? Is there some conflict? Can I reach the limit with one request and block either as well, or are these separated? Can I still continue making search requests once I hit the normal requests limits?
13:40
Edit
Copy
Claude responded: They're independent buckets — with one shared bucket on top.
Claude responded: They're independent buckets — with one shared bucket on top.
Analyzed independent rate limit buckets and their practical interactions
Analyzed independent rate limit buckets and their practical interactions
They're independent buckets — with one shared bucket on top.
The three buckets and what each call hits
The three buckets and what each call hits
Copy to clipboard
┌──────────────────┐
Search request ──→ │ Search: 5/sec │ ──┐
└──────────────────┘ │
├──→ ┌─────────────────┐
┌──────────────────┐ │ │ Daily: 250k–1M │
Non-search call ──→ │ Burst: 190/10s │ ──┘ │ (per portal) │
└──────────────────┘ └─────────────────┘
A search call is only metered against the search bucket and the daily bucket. A non-search call (batch read/update, single PATCH, associations, etc.) is only metered against the burst bucket and the daily bucket. The two short-window buckets do not share counters.
What this means practically
What this means practically
Hitting search secondly limit (5/s):
Only further
/search
calls 429. Your batch reads, batch updates, single PATCHes, association calls — all keep working at full burst speed. This is actually useful: if your sync is bottlenecked on Search, you can pivot to using
lastmodifieddate
filters via batch endpoints, or use the IDs you already have to do batch reads, while Search cools off.
Hitting burst limit (190/10s):
Only non-search calls 429. You can still issue Search calls at 5/s. Useful for: continuing to identify deltas for queueing while in-flight updates drain, or refreshing a small set of records via Search even though your write pipeline is paused.
Hitting daily limit:
Everything stops. Search and non-search alike. Doesn't unblock until midnight in your portal's configured timezone — and remember this is shared across every private app in the portal, plus n8n flows, marketing tools, anything else hitting the API with that account.
So can one type of request block the other?
So can one type of request block the other?
Search → Burst:
No.
Saturating Search at 50 calls per 10s leaves your full 190/10s burst untouched.
Burst → Search:
No.
Saturating burst leaves Search's 5/s untouched.
Either → Daily:
Yes
, but only by contributing to the same daily counter. It's volume that kills you here, not the type.
In theory you can sustain ~50 search + ~190 other =
~240 calls per 10 seconds
indefinitely (until daily runs out), because the two buckets bill independently.
Implementation consequence
Implementation consequence
Your rate limiter needs to know which bucket a request hits before it acquires. Cleanest pattern:
Copy to clipboard
php
$limiter
->
acquire
(
'search'
,
$weight
=
1
)
;
// for search endpoints only
$limiter
->
acquire
(
'burst'
,
$weight
=
1
)
;
// for everything else
$limiter
->
acquire
(
'daily'
,
$weight
=
1
)
;
// every call, both kinds
In Redis: three separate keys, three separate Lua acquire scripts (or one script with a bucket parameter). A search call calls
acquire('search')
+
acquire('daily')
. A batch update calls
acquire('burst')
+
acquire('daily')
.
One subtle pitfall: when you backoff on a 429,
inspect
policyName
in the response body
to know which bucket actually fired. If you see
SECONDLY
from a search endpoint, you only need to delay search-bound jobs — burst-bound jobs in the queue can keep running. If you blanket-pause everything on any 429, you waste capacity on the bucket that's still healthy. Two queues (or two throttle keys) make this clean; one global pause is the lazy version.
The other subtlety: the burst response gives you
X-HubSpot-RateLimit-Remaining...
|
2561
|
NULL
|
NULL
|
NULL
|
|
25296
|
1063
|
2
|
2026-05-12T11:04:55.841055+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-12/1778 /Users/lukas/.screenpipe/data/data/2026-05-12/1778583895841_m2.jpg...
|
Firefox
|
Pipelines - jiminny/app — Work
|
True
|
app.circleci.com/pipelines/github/jiminny/app
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Ask Google Gemini
Unnamed Group
TypeError: League\ Ask Google Gemini
Unnamed Group
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
CloudWatch | us-east-2
CloudWatch | us-east-2
Unnamed Group
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
Pipelines - jiminny/app
Pipelines - jiminny/app
Pull requests · jiminny/app
Pull requests · jiminny/app
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-20773 fix user pilot tracking for automated report generated by LakyLak · Pull Request #12024 · jiminny/app
JY-20773 fix user pilot tracking for automated report generated by LakyLak · Pull Request #12024 · jiminny/app
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
Data Explorer
Data Explorer
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
Jiminny
Jiminny
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Platform Team - Backlog - Jira
Platform Team - Backlog - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-20773 fix user pilot tracking for automated report generated by LakyLak · Pull Request #12024 · jiminny/app
JY-20773 fix user pilot tracking for automated report generated by LakyLak · Pull Request #12024 · jiminny/app
Pipelines - jiminny/app
Pipelines - jiminny/app
Close tab
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Go to home page
Auto theme
Open notifications
Open support menu
Open user menu
org avatar Current organization: jiminny
Home
Home
Pipelines
Pipelines
Projects
Projects
Deploys
Deploys
Insights
Insights
Runners
Runners
Org
Org
Plan
Plan
Chunk sidecars
Chunk sidecars
PREVIEW
Chunk
Chunk
Dashboard All Pipelines
All Pipelines
Project Outline app
app
app
app
Overview
Overview
Settings
Settings
Deploys
Deploys
Lightning Manage triggers
Manage triggers
Trigger Pipeline
Pipelines All pipelines my-pipelines-filter
All pipelines
app Project Filter. Selected "app"
app
All branches Branch Filter. Selected "All branches"
All branches
Start Time Cutoff date Arrow Drop Down
Cutoff date
All statuses Arrow Drop Down
All
statuses
Filter
Pipeline
Status
Workflow
Checkout source
Trigger event
Start/Duration
Actions
app
58250
58250
RUNNING workflow build_accept_deploy. Collapse the workflow jobs list.
Status Running Running
Running
13m 35s
remain
Info Outline
build_accept_deploy
build_accept_deploy
JY-20606-desktop-app-recall
JY-20606-desktop-app-recall
Open commit on version control site
13a63f7
JY-20606: add provider detection
Push
Commit pushed
Copy timestamp to clipboard
10m ago
Copy timestamp duration to clipboard
Cancel workflow
Fix workflow
More Actions
Jobs
SUCCESS job checkout-code
checkout-code
885223
1m 16s
1m 16s
SUCCESS job build-frontend
build-frontend
885224
1m 17s
1m 17s
SUCCESS job test-frontend
test-frontend
885225
1m 53s
1m 53s
SUCCESS job build-backend
build-backend
885226
55s
55s
SUCCESS job phpstan
phpstan
885239
1m 25s
1m 25s
SUCCESS job prepare_deploy_revision_subenv
prepare_deploy_revision_subenv
885230
1m 2s
1m 2s
SUCCESS job build_docker_backend_code_subenv
build_docker_backend_code_subenv
885231
1m 54s
1m 54s
SUCCESS job build_docker_worker_code_subenv
build_docker_worker_code_subenv
885232
1m 56s
1m 56s
SUCCESS job build_docker_worker_video_code_subenv
build_docker_worker_video_code_subenv
885233
1m 50s
1m 50s
SUCCESS job db_migrations_subenv
db_migrations_subenv
885235
19s
19s
RUNNING job deploy_docker_backend_code_subenv
deploy_docker_backend_code_subenv
885237
5m 6s
5m 6s
SUCCESS job deploy_docker_worker_code_subenv
deploy_docker_worker_code_subenv
885238
2m 5s
2m 5s
SUCCESS job deploy_docker_worker_video_code_subenv
deploy_docker_worker_video_code_subenv
885236
30s
30s
SUCCESS job deploy_frontend_assets_to_s3_subenv
deploy_frontend_assets_to_s3_subenv
885234
57s
57s
SUCCESS job setup
setup
885228
1m 5s
1m 5s
RUNNING job test
test
885229
7m 47s
7m 47s
SUCCESS job test-backend-lint
test-backend-lint
885227
4m 17s
4m 17s
sonar_cloud
885240
SUCCESS workflow setup-workflow. Collapse the workflow jobs list.
Status Passed Success
Success
setup-workflow
setup-workflow
SETUP
JY-20606-desktop-app-recall
JY-20606-desktop-app-recall
Open commit on version control site
13a63f7
JY-20606: add provider detection
Push
Commit pushed
Copy timestamp to clipboard
11m ago
Copy timestamp duration to clipboard
Rerun workflow from start
Fix workflow
More Actions
Jobs
SUCCESS job setup
setup
885222
47s
47s
app
58249
58249
RUNNING workflow build_accept_deploy. Collapse the workflow jobs list.
Status Running Running
Running
23m 41s
remain
Info Outline
build_accept_deploy
build_accept_deploy
JY-20773-fix-automated-reports-user-pilot-tracking
JY-20773-fix-automated-reports-user-pilot-tracking
Open commit on version control site
62861fa
Merge branch 'master' into JY-20773-fix-automated-reports-user-pilot-tracking
Rerun
from failed
Copy timestamp to clipboard
8s ago
Copy timestamp duration to clipboard
Cancel workflow
Fix workflow
More Actions
Jobs
SUCCESS job checkout-code
checkout-code
885213
1m 38s
1m 38s
SUCCESS job build-frontend
build-frontend
885216
1m 29s
1m 29s
SUCCESS job test-frontend
test-frontend
885218
1m 43s
1m 43s
SUCCESS job build-backend
build-backend
885214
1m 12s
1m 12s
SUCCESS job phpstan
phpstan
885219
2m 18s
2m 18s
SUCCESS job setup
setup
885217
59s
59s
RUNNING job test
test
885241
1m 27s
1m 27s
SUCCESS job test-backend-lint
test-backend-lint
885215
4m 20s
4m 20s
sonar_cloud
885242
FAILED workflow build_accept_deploy. Collapse the workflow jobs list.
Status Failed Failed
Failed
build_accept_deploy
build_accept_deploy
JY-20773-fix-automated-reports-user-pilot-tracking
JY-20773-fix-automated-reports-user-pilot-tracking
Open commit on version control site
62861fa
Merge branch 'master' into JY-20773-fix-automated-reports-user-pilot-tracking...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Ask Google Gemini","depth":4,"bounds":{"left":0.45329124,"top":0.49880287,"width":0.011303191,"height":0.027134877},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Unnamed Group","depth":4,"bounds":{"left":0.0028257978,"top":0.057063047,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXRadioButton","text":"TypeError: League\\Flysystem\\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app","depth":4,"bounds":{"left":0.0028257978,"top":0.08060654,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"TypeError: League\\Flysystem\\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app","depth":5,"bounds":{"left":0.015957447,"top":0.09217877,"width":0.40492022,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"CloudWatch | us-east-2","depth":4,"bounds":{"left":0.0028257978,"top":0.11332801,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"CloudWatch | us-east-2","depth":5,"bounds":{"left":0.015957447,"top":0.12490024,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Unnamed Group","depth":4,"bounds":{"left":0.0028257978,"top":0.15123703,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXRadioButton","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":4,"bounds":{"left":0.0028257978,"top":0.17478053,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":5,"bounds":{"left":0.015957447,"top":0.18635276,"width":0.16888298,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira","depth":4,"bounds":{"left":0.0,"top":0.207502,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.21907422,"width":0.16140293,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.24022347,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.25179568,"width":0.18816489,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.27294493,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.28451717,"width":0.039228722,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pull requests · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.3056664,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.31723863,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":4,"bounds":{"left":0.0,"top":0.33838788,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.3499601,"width":0.1200133,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20773 fix user pilot tracking for automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.37110934,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20773 fix user pilot tracking for automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.38268158,"width":0.1931516,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20776] Automated report - sentry - Jira","depth":4,"bounds":{"left":0.0,"top":0.4038308,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20776] Automated report - sentry - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.41540304,"width":0.07646277,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.0,"top":0.4365523,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.4481245,"width":0.10106383,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.46927375,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.48084596,"width":0.15159574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Data Explorer","depth":4,"bounds":{"left":0.0,"top":0.5019952,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Data Explorer","depth":5,"bounds":{"left":0.013297873,"top":0.51356745,"width":0.0234375,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20776] Automated report - sentry - Jira","depth":4,"bounds":{"left":0.0,"top":0.53471667,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20776] Automated report - sentry - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.5462889,"width":0.07646277,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.5674381,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.57901037,"width":0.013131649,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.60015965,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.6117318,"width":0.18816489,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":4,"bounds":{"left":0.0,"top":0.6328811,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.6444533,"width":0.09524601,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Platform Team - Backlog - Jira","depth":4,"bounds":{"left":0.0,"top":0.66560256,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platform Team - Backlog - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.6771748,"width":0.053025264,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":4,"bounds":{"left":0.0,"top":0.698324,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.70989627,"width":0.1200133,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20773 fix user pilot tracking for automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.7310455,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20773 fix user pilot tracking for automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.7426177,"width":0.1931516,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.76376694,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.7753392,"width":0.039228722,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.06732048,"top":0.7709497,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.7964884,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.80806065,"width":0.18816489,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.8308061,"width":0.07413564,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0028257978,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.013796543,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.024933511,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.036070477,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.04720745,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Go to home page","depth":9,"bounds":{"left":0.08726729,"top":0.061452515,"width":0.044215426,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"Auto theme","depth":9,"bounds":{"left":0.4375,"top":0.061452515,"width":0.013297873,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open notifications","depth":9,"bounds":{"left":0.45212767,"top":0.061452515,"width":0.013297873,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXMenuButton","text":"Open support menu","depth":9,"bounds":{"left":0.46675533,"top":0.061452515,"width":0.013297873,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXMenuButton","text":"Open user menu","depth":9,"bounds":{"left":0.48138297,"top":0.061452515,"width":0.013297873,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"org avatar Current organization: jiminny","depth":9,"bounds":{"left":0.08693484,"top":0.10295291,"width":0.01462766,"height":0.035115723},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Home","depth":10,"bounds":{"left":0.08494016,"top":0.15083799,"width":0.01861702,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Home","depth":12,"bounds":{"left":0.087765954,"top":0.1839585,"width":0.012965426,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Pipelines","depth":10,"bounds":{"left":0.08494016,"top":0.21308859,"width":0.01861702,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines","depth":12,"bounds":{"left":0.083942816,"top":0.2462091,"width":0.020611702,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Projects","depth":10,"bounds":{"left":0.08494016,"top":0.2753392,"width":0.01861702,"height":0.04668795},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Projects","depth":12,"bounds":{"left":0.0852726,"top":0.3084597,"width":0.017952127,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Deploys","depth":10,"bounds":{"left":0.08494016,"top":0.33798882,"width":0.01861702,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Deploys","depth":12,"bounds":{"left":0.08543883,"top":0.37071028,"width":0.01761968,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Insights","depth":10,"bounds":{"left":0.08494016,"top":0.40023944,"width":0.01861702,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Insights","depth":12,"bounds":{"left":0.085605055,"top":0.4329609,"width":0.017287234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Runners","depth":10,"bounds":{"left":0.08494016,"top":0.46249002,"width":0.01861702,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Runners","depth":12,"bounds":{"left":0.0852726,"top":0.49561054,"width":0.017952127,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Org","depth":10,"bounds":{"left":0.08494016,"top":0.52474064,"width":0.01861702,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Org","depth":12,"bounds":{"left":0.090259306,"top":0.55786115,"width":0.007978723,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Plan","depth":10,"bounds":{"left":0.08494016,"top":0.58699125,"width":0.01861702,"height":0.04668795},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Plan","depth":12,"bounds":{"left":0.08959442,"top":0.6201117,"width":0.00930851,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Chunk sidecars","depth":11,"bounds":{"left":0.07962101,"top":0.8591381,"width":0.02925532,"height":0.059457302},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Chunk sidecars","depth":13,"bounds":{"left":0.08494016,"top":0.8922586,"width":0.01861702,"height":0.026735835},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"PREVIEW","depth":12,"bounds":{"left":0.08743351,"top":0.8567438,"width":0.013630319,"height":0.009177973},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Chunk","depth":10,"bounds":{"left":0.07962101,"top":0.9345571,"width":0.02925532,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Chunk","depth":12,"bounds":{"left":0.08726729,"top":0.96727854,"width":0.013962766,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Dashboard All Pipelines","depth":15,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"All Pipelines","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Project Outline app","depth":15,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"app","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"app","depth":13,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Overview","depth":13,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Overview","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Settings","depth":13,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Settings","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Deploys","depth":13,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Deploys","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Lightning Manage triggers","depth":13,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Manage triggers","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Trigger Pipeline","depth":13,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Pipelines All pipelines my-pipelines-filter","depth":13,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"All pipelines","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"app Project Filter. Selected \"app\"","depth":13,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"app","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"All branches Branch Filter. Selected \"All branches\"","depth":13,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"All branches","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Start Time Cutoff date Arrow Drop Down","depth":13,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Cutoff date","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"All statuses Arrow Drop Down","depth":13,"on_screen":false,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"All","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"statuses","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Filter","depth":13,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Pipeline","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Status","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Workflow","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Checkout source","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Trigger event","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Start/Duration","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Actions","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"58250","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"58250","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"RUNNING workflow build_accept_deploy. Collapse the workflow jobs list.","depth":13,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Status Running Running","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Running","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"13m 35s","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"remain","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Info Outline","depth":12,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"build_accept_deploy","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build_accept_deploy","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20606-desktop-app-recall","depth":13,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20606-desktop-app-recall","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Open commit on version control site","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"13a63f7","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"JY-20606: add provider detection","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Push","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Commit pushed","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy timestamp to clipboard","depth":13,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"10m ago","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy timestamp duration to clipboard","depth":13,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Cancel workflow","depth":12,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Fix workflow","depth":12,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"More Actions","depth":12,"on_screen":false,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Jobs","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job checkout-code","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"checkout-code","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885223","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 16s","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 16s","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job build-frontend","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build-frontend","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885224","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 17s","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 17s","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job test-frontend","depth":14,"bounds":{"left":0.16805187,"top":0.0,"width":0.16439494,"height":0.01915403},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"test-frontend","depth":15,"bounds":{"left":0.18334441,"top":0.0,"width":0.029920213,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885225","depth":16,"bounds":{"left":0.2159242,"top":0.0,"width":0.016954787,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 53s","depth":14,"bounds":{"left":0.40226063,"top":0.0,"width":0.016289894,"height":0.01915403},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 53s","depth":15,"bounds":{"left":0.40226063,"top":0.0,"width":0.016289894,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job build-backend","depth":14,"bounds":{"left":0.16805187,"top":0.0,"width":0.16439494,"height":0.01915403},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build-backend","depth":15,"bounds":{"left":0.18334441,"top":0.0,"width":0.032247342,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885226","depth":16,"bounds":{"left":0.21825133,"top":0.0,"width":0.017121011,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"55s","depth":14,"bounds":{"left":0.41023937,"top":0.0,"width":0.00831117,"height":0.01915403},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"55s","depth":15,"bounds":{"left":0.41023937,"top":0.0,"width":0.00831117,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job phpstan","depth":14,"bounds":{"left":0.16805187,"top":0.0,"width":0.16439494,"height":0.01915403},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"phpstan","depth":15,"bounds":{"left":0.18334441,"top":0.0,"width":0.018118352,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885239","depth":16,"bounds":{"left":0.20412233,"top":0.0,"width":0.017287234,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 25s","depth":14,"bounds":{"left":0.40242687,"top":0.0,"width":0.016123671,"height":0.01915403},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 25s","depth":15,"bounds":{"left":0.40242687,"top":0.0,"width":0.016123671,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job prepare_deploy_revision_subenv","depth":14,"bounds":{"left":0.16805187,"top":0.0,"width":0.16439494,"height":0.01915403},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"prepare_deploy_revision_subenv","depth":15,"bounds":{"left":0.18334441,"top":0.0,"width":0.072140954,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885230","depth":16,"bounds":{"left":0.25814494,"top":0.0,"width":0.017287234,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 2s","depth":14,"bounds":{"left":0.40525267,"top":0.0,"width":0.013297873,"height":0.01915403},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 2s","depth":15,"bounds":{"left":0.40525267,"top":0.0,"width":0.013297873,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job build_docker_backend_code_subenv","depth":14,"bounds":{"left":0.16805187,"top":0.012769354,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build_docker_backend_code_subenv","depth":15,"bounds":{"left":0.18334441,"top":0.01556265,"width":0.081615694,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885231","depth":16,"bounds":{"left":0.26761967,"top":0.01556265,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 54s","depth":14,"bounds":{"left":0.40226063,"top":0.012769354,"width":0.016289894,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 54s","depth":15,"bounds":{"left":0.40226063,"top":0.01556265,"width":0.016289894,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job build_docker_worker_code_subenv","depth":14,"bounds":{"left":0.16805187,"top":0.03830806,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build_docker_worker_code_subenv","depth":15,"bounds":{"left":0.18334441,"top":0.041101355,"width":0.07762633,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885232","depth":16,"bounds":{"left":0.26363033,"top":0.041101355,"width":0.017287234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 56s","depth":14,"bounds":{"left":0.40226063,"top":0.03830806,"width":0.016289894,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 56s","depth":15,"bounds":{"left":0.40226063,"top":0.041101355,"width":0.016289894,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job build_docker_worker_video_code_subenv","depth":14,"bounds":{"left":0.16805187,"top":0.06384677,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build_docker_worker_video_code_subenv","depth":15,"bounds":{"left":0.18334441,"top":0.066640064,"width":0.091755316,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885233","depth":16,"bounds":{"left":0.2777593,"top":0.066640064,"width":0.017287234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 50s","depth":14,"bounds":{"left":0.40226063,"top":0.06384677,"width":0.016289894,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 50s","depth":15,"bounds":{"left":0.40226063,"top":0.066640064,"width":0.016289894,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job db_migrations_subenv","depth":14,"bounds":{"left":0.16805187,"top":0.08938547,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"db_migrations_subenv","depth":15,"bounds":{"left":0.18334441,"top":0.09217877,"width":0.050033245,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885235","depth":16,"bounds":{"left":0.23603724,"top":0.09217877,"width":0.017287234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"19s","depth":14,"bounds":{"left":0.41073802,"top":0.08938547,"width":0.0078125,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"19s","depth":15,"bounds":{"left":0.41073802,"top":0.09217877,"width":0.0078125,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"RUNNING job deploy_docker_backend_code_subenv","depth":14,"bounds":{"left":0.16805187,"top":0.114924185,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"deploy_docker_backend_code_subenv","depth":15,"bounds":{"left":0.18334441,"top":0.117717475,"width":0.08510638,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885237","depth":16,"bounds":{"left":0.2711104,"top":0.117717475,"width":0.017121011,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"5m 6s","depth":14,"bounds":{"left":0.40458778,"top":0.114924185,"width":0.013962766,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"5m 6s","depth":15,"bounds":{"left":0.40458778,"top":0.117717475,"width":0.013962766,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job deploy_docker_worker_code_subenv","depth":14,"bounds":{"left":0.16805187,"top":0.14046289,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"deploy_docker_worker_code_subenv","depth":15,"bounds":{"left":0.18334441,"top":0.14325619,"width":0.08128324,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885238","depth":16,"bounds":{"left":0.26728722,"top":0.14325619,"width":0.017121011,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"2m 5s","depth":14,"bounds":{"left":0.40458778,"top":0.14046289,"width":0.013962766,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"2m 5s","depth":15,"bounds":{"left":0.40458778,"top":0.14325619,"width":0.013962766,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job deploy_docker_worker_video_code_subenv","depth":14,"bounds":{"left":0.16805187,"top":0.1660016,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"deploy_docker_worker_video_code_subenv","depth":15,"bounds":{"left":0.18334441,"top":0.16879489,"width":0.09524601,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885236","depth":16,"bounds":{"left":0.28125,"top":0.16879489,"width":0.017287234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"30s","depth":14,"bounds":{"left":0.40990692,"top":0.1660016,"width":0.008643617,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"30s","depth":15,"bounds":{"left":0.40990692,"top":0.16879489,"width":0.008643617,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job deploy_frontend_assets_to_s3_subenv","depth":14,"bounds":{"left":0.16805187,"top":0.1915403,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"deploy_frontend_assets_to_s3_subenv","depth":15,"bounds":{"left":0.18334441,"top":0.1943336,"width":0.08543883,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885234","depth":16,"bounds":{"left":0.27144283,"top":0.1943336,"width":0.017287234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"57s","depth":14,"bounds":{"left":0.4105718,"top":0.1915403,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"57s","depth":15,"bounds":{"left":0.4105718,"top":0.1943336,"width":0.007978723,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job setup","depth":14,"bounds":{"left":0.16805187,"top":0.21707901,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"setup","depth":15,"bounds":{"left":0.18334441,"top":0.21987231,"width":0.012632979,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885228","depth":16,"bounds":{"left":0.19863696,"top":0.21987231,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 5s","depth":14,"bounds":{"left":0.40525267,"top":0.21707901,"width":0.013297873,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 5s","depth":15,"bounds":{"left":0.40525267,"top":0.21987231,"width":0.013297873,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"RUNNING job test","depth":14,"bounds":{"left":0.16805187,"top":0.24261771,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"test","depth":15,"bounds":{"left":0.18334441,"top":0.24541101,"width":0.008643617,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885229","depth":16,"bounds":{"left":0.19464761,"top":0.24541101,"width":0.017121011,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"7m 47s","depth":14,"bounds":{"left":0.40209442,"top":0.24261771,"width":0.016456118,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"7m 47s","depth":15,"bounds":{"left":0.40209442,"top":0.24541101,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job test-backend-lint","depth":14,"bounds":{"left":0.16805187,"top":0.26815644,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"test-backend-lint","depth":15,"bounds":{"left":0.18334441,"top":0.27094972,"width":0.038896278,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885227","depth":16,"bounds":{"left":0.22490026,"top":0.27094972,"width":0.016788565,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"4m 17s","depth":14,"bounds":{"left":0.40259308,"top":0.26815644,"width":0.015957447,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"4m 17s","depth":15,"bounds":{"left":0.40259308,"top":0.27094972,"width":0.015957447,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"sonar_cloud","depth":15,"bounds":{"left":0.18334441,"top":0.29648843,"width":0.02642952,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885240","depth":16,"bounds":{"left":0.21243352,"top":0.29648843,"width":0.017287234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"SUCCESS workflow setup-workflow. Collapse the workflow jobs list.","depth":13,"bounds":{"left":0.15807846,"top":0.3367917,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Status Passed Success","depth":12,"bounds":{"left":0.17004654,"top":0.33838788,"width":0.033410903,"height":0.023144454},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Success","depth":13,"bounds":{"left":0.18068483,"top":0.34317636,"width":0.018783245,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"setup-workflow","depth":12,"bounds":{"left":0.22490026,"top":0.33838788,"width":0.031914894,"height":0.03152434},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"setup-workflow","depth":13,"bounds":{"left":0.22490026,"top":0.339585,"width":0.02044548,"height":0.02952913},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SETUP","depth":12,"bounds":{"left":0.22755983,"top":0.377494,"width":0.011136968,"height":0.009976057},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20606-desktop-app-recall","depth":13,"bounds":{"left":0.2621343,"top":0.33519554,"width":0.06732048,"height":0.015961692},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20606-desktop-app-recall","depth":14,"bounds":{"left":0.2621343,"top":0.33639267,"width":0.06732048,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Open commit on version control site","depth":14,"bounds":{"left":0.2621343,"top":0.35434955,"width":0.07330452,"height":0.033519555},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"13a63f7","depth":16,"bounds":{"left":0.2621343,"top":0.35554668,"width":0.018284574,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"JY-20606: add provider detection","depth":16,"bounds":{"left":0.2621343,"top":0.35554668,"width":0.07247341,"height":0.030726258},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Push","depth":13,"bounds":{"left":0.35405585,"top":0.33798882,"width":0.011136968,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Commit pushed","depth":14,"bounds":{"left":0.35405585,"top":0.3507582,"width":0.034574468,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy timestamp to clipboard","depth":13,"bounds":{"left":0.40259308,"top":0.33519554,"width":0.026595745,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"11m ago","depth":15,"bounds":{"left":0.4117354,"top":0.33798882,"width":0.00831117,"height":0.026735835},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy timestamp duration to clipboard","depth":13,"bounds":{"left":0.40924203,"top":0.37031126,"width":0.019946808,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Rerun workflow from start","depth":12,"bounds":{"left":0.44514626,"top":0.33838788,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Fix workflow","depth":12,"bounds":{"left":0.4557846,"top":0.33838788,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"More Actions","depth":12,"bounds":{"left":0.4664229,"top":0.33838788,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Jobs","depth":14,"bounds":{"left":0.14128989,"top":0.4273743,"width":0.010804521,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job setup","depth":14,"bounds":{"left":0.16805187,"top":0.424581,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"setup","depth":15,"bounds":{"left":0.18334441,"top":0.4273743,"width":0.012632979,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885222","depth":16,"bounds":{"left":0.19863696,"top":0.4273743,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"47s","depth":14,"bounds":{"left":0.41040558,"top":0.424581,"width":0.008144947,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"47s","depth":15,"bounds":{"left":0.41040558,"top":0.4273743,"width":0.008144947,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app","depth":13,"bounds":{"left":0.12283909,"top":0.47685555,"width":0.00831117,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"58249","depth":12,"bounds":{"left":0.12283909,"top":0.49361533,"width":0.014295213,"height":0.01556265},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"58249","depth":13,"bounds":{"left":0.12283909,"top":0.4944134,"width":0.014295213,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"RUNNING workflow build_accept_deploy. Collapse the workflow jobs list.","depth":13,"bounds":{"left":0.15807846,"top":0.47885075,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Status Running Running","depth":12,"bounds":{"left":0.17004654,"top":0.48044693,"width":0.03274601,"height":0.023144454},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Running","depth":13,"bounds":{"left":0.18068483,"top":0.48523542,"width":0.018118352,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"23m 41s","depth":13,"bounds":{"left":0.17004654,"top":0.50957704,"width":0.01861702,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"remain","depth":13,"bounds":{"left":0.18866356,"top":0.50957704,"width":0.016289894,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Info Outline","depth":12,"bounds":{"left":0.20561835,"top":0.50359136,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"build_accept_deploy","depth":12,"bounds":{"left":0.22490026,"top":0.48044693,"width":0.031914894,"height":0.03152434},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build_accept_deploy","depth":13,"bounds":{"left":0.22490026,"top":0.48164406,"width":0.030585106,"height":0.02952913},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20773-fix-automated-reports-user-pilot-tracking","depth":13,"bounds":{"left":0.2621343,"top":0.4772546,"width":0.07330452,"height":0.03152434},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20773-fix-automated-reports-user-pilot-tracking","depth":14,"bounds":{"left":0.2621343,"top":0.47845173,"width":0.06017287,"height":0.02952913},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Open commit on version control site","depth":14,"bounds":{"left":0.2621343,"top":0.5119713,"width":0.07330452,"height":0.033519555},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"62861fa","depth":16,"bounds":{"left":0.2621343,"top":0.5131684,"width":0.018118352,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Merge branch 'master' into JY-20773-fix-automated-reports-user-pilot-tracking","depth":16,"bounds":{"left":0.2621343,"top":0.5131684,"width":0.059674203,"height":0.06424581},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Rerun","depth":13,"bounds":{"left":0.34075797,"top":0.47685555,"width":0.013131649,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"from failed","depth":14,"bounds":{"left":0.35521942,"top":0.47685555,"width":0.023603724,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy timestamp to clipboard","depth":13,"bounds":{"left":0.40309176,"top":0.4772546,"width":0.026097074,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"8s ago","depth":15,"bounds":{"left":0.40874335,"top":0.48643255,"width":0.014793883,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy timestamp duration to clipboard","depth":13,"bounds":{"left":0.40259308,"top":0.5123703,"width":0.026595745,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Cancel workflow","depth":12,"bounds":{"left":0.44514626,"top":0.48044693,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Fix workflow","depth":12,"bounds":{"left":0.4557846,"top":0.48044693,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"More Actions","depth":12,"bounds":{"left":0.4664229,"top":0.48044693,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Jobs","depth":14,"bounds":{"left":0.14128989,"top":0.57023144,"width":0.010804521,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job checkout-code","depth":14,"bounds":{"left":0.16805187,"top":0.5678372,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"checkout-code","depth":15,"bounds":{"left":0.18334441,"top":0.57023144,"width":0.03374335,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885213","depth":16,"bounds":{"left":0.21974733,"top":0.57023144,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 38s","depth":14,"bounds":{"left":0.40209442,"top":0.5678372,"width":0.016456118,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 38s","depth":15,"bounds":{"left":0.40209442,"top":0.57023144,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job build-frontend","depth":14,"bounds":{"left":0.16805187,"top":0.5933759,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build-frontend","depth":15,"bounds":{"left":0.18334441,"top":0.5957702,"width":0.032247342,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885216","depth":16,"bounds":{"left":0.21825133,"top":0.5957702,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 29s","depth":14,"bounds":{"left":0.40226063,"top":0.5933759,"width":0.016289894,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 29s","depth":15,"bounds":{"left":0.40226063,"top":0.5957702,"width":0.016289894,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job test-frontend","depth":14,"bounds":{"left":0.16805187,"top":0.6189146,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"test-frontend","depth":15,"bounds":{"left":0.18334441,"top":0.62130886,"width":0.029920213,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885218","depth":16,"bounds":{"left":0.2159242,"top":0.62130886,"width":0.016289894,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 43s","depth":14,"bounds":{"left":0.40209442,"top":0.6189146,"width":0.016456118,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 43s","depth":15,"bounds":{"left":0.40209442,"top":0.62130886,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job build-backend","depth":14,"bounds":{"left":0.16805187,"top":0.6444533,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build-backend","depth":15,"bounds":{"left":0.18334441,"top":0.64684755,"width":0.032247342,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885214","depth":16,"bounds":{"left":0.21825133,"top":0.64684755,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 12s","depth":14,"bounds":{"left":0.40309176,"top":0.6444533,"width":0.015458777,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 12s","depth":15,"bounds":{"left":0.40309176,"top":0.64684755,"width":0.015458777,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job phpstan","depth":14,"bounds":{"left":0.16805187,"top":0.669992,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"phpstan","depth":15,"bounds":{"left":0.18334441,"top":0.6723863,"width":0.018118352,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885219","depth":16,"bounds":{"left":0.20412233,"top":0.6723863,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"2m 18s","depth":14,"bounds":{"left":0.40226063,"top":0.669992,"width":0.016289894,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"2m 18s","depth":15,"bounds":{"left":0.40226063,"top":0.6723863,"width":0.016289894,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job setup","depth":14,"bounds":{"left":0.16805187,"top":0.6955307,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"setup","depth":15,"bounds":{"left":0.18334441,"top":0.697925,"width":0.012632979,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885217","depth":16,"bounds":{"left":0.19863696,"top":0.697925,"width":0.016123671,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"59s","depth":14,"bounds":{"left":0.41007313,"top":0.6955307,"width":0.008477394,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"59s","depth":15,"bounds":{"left":0.41007313,"top":0.697925,"width":0.008477394,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"RUNNING job test","depth":14,"bounds":{"left":0.16805187,"top":0.72106946,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"test","depth":15,"bounds":{"left":0.18334441,"top":0.7234637,"width":0.008643617,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885241","depth":16,"bounds":{"left":0.19464761,"top":0.7234637,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 27s","depth":14,"bounds":{"left":0.4027593,"top":0.72106946,"width":0.015791224,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 27s","depth":15,"bounds":{"left":0.4027593,"top":0.7234637,"width":0.015791224,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job test-backend-lint","depth":14,"bounds":{"left":0.16805187,"top":0.74660814,"width":0.16439494,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"test-backend-lint","depth":15,"bounds":{"left":0.18334441,"top":0.7490024,"width":0.038896278,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885215","depth":16,"bounds":{"left":0.22490026,"top":0.7490024,"width":0.016289894,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"4m 20s","depth":14,"bounds":{"left":0.40142953,"top":0.74660814,"width":0.017121011,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"4m 20s","depth":15,"bounds":{"left":0.40142953,"top":0.7490024,"width":0.017121011,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"sonar_cloud","depth":15,"bounds":{"left":0.18334441,"top":0.7745411,"width":0.02642952,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"885242","depth":16,"bounds":{"left":0.21243352,"top":0.7745411,"width":0.017121011,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"FAILED workflow build_accept_deploy. Collapse the workflow jobs list.","depth":13,"bounds":{"left":0.15807846,"top":0.8152434,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Status Failed Failed","depth":12,"bounds":{"left":0.17004654,"top":0.8168396,"width":0.027925532,"height":0.022745412},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Failed","depth":13,"bounds":{"left":0.18068483,"top":0.82122904,"width":0.013297873,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"build_accept_deploy","depth":12,"bounds":{"left":0.22490026,"top":0.8168396,"width":0.031914894,"height":0.0311253},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build_accept_deploy","depth":13,"bounds":{"left":0.22490026,"top":0.8176377,"width":0.030585106,"height":0.02952913},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20773-fix-automated-reports-user-pilot-tracking","depth":13,"bounds":{"left":0.2621343,"top":0.8136473,"width":0.07330452,"height":0.0311253},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20773-fix-automated-reports-user-pilot-tracking","depth":14,"bounds":{"left":0.2621343,"top":0.8144453,"width":0.06017287,"height":0.02952913},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Open commit on version control site","depth":14,"bounds":{"left":0.2621343,"top":0.8479649,"width":0.07330452,"height":0.033519555},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"62861fa","depth":16,"bounds":{"left":0.2621343,"top":0.84956104,"width":0.018118352,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Merge branch 'master' into JY-20773-fix-automated-reports-user-pilot-tracking","depth":16,"bounds":{"left":0.2621343,"top":0.84956104,"width":0.059674203,"height":0.06424581},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8054733272616800790
|
-4316908446462348160
|
idle
|
accessibility
|
NULL
|
Ask Google Gemini
Unnamed Group
TypeError: League\ Ask Google Gemini
Unnamed Group
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
CloudWatch | us-east-2
CloudWatch | us-east-2
Unnamed Group
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
Pipelines - jiminny/app
Pipelines - jiminny/app
Pull requests · jiminny/app
Pull requests · jiminny/app
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-20773 fix user pilot tracking for automated report generated by LakyLak · Pull Request #12024 · jiminny/app
JY-20773 fix user pilot tracking for automated report generated by LakyLak · Pull Request #12024 · jiminny/app
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
Data Explorer
Data Explorer
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
Jiminny
Jiminny
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Platform Team - Backlog - Jira
Platform Team - Backlog - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-20773 fix user pilot tracking for automated report generated by LakyLak · Pull Request #12024 · jiminny/app
JY-20773 fix user pilot tracking for automated report generated by LakyLak · Pull Request #12024 · jiminny/app
Pipelines - jiminny/app
Pipelines - jiminny/app
Close tab
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Go to home page
Auto theme
Open notifications
Open support menu
Open user menu
org avatar Current organization: jiminny
Home
Home
Pipelines
Pipelines
Projects
Projects
Deploys
Deploys
Insights
Insights
Runners
Runners
Org
Org
Plan
Plan
Chunk sidecars
Chunk sidecars
PREVIEW
Chunk
Chunk
Dashboard All Pipelines
All Pipelines
Project Outline app
app
app
app
Overview
Overview
Settings
Settings
Deploys
Deploys
Lightning Manage triggers
Manage triggers
Trigger Pipeline
Pipelines All pipelines my-pipelines-filter
All pipelines
app Project Filter. Selected "app"
app
All branches Branch Filter. Selected "All branches"
All branches
Start Time Cutoff date Arrow Drop Down
Cutoff date
All statuses Arrow Drop Down
All
statuses
Filter
Pipeline
Status
Workflow
Checkout source
Trigger event
Start/Duration
Actions
app
58250
58250
RUNNING workflow build_accept_deploy. Collapse the workflow jobs list.
Status Running Running
Running
13m 35s
remain
Info Outline
build_accept_deploy
build_accept_deploy
JY-20606-desktop-app-recall
JY-20606-desktop-app-recall
Open commit on version control site
13a63f7
JY-20606: add provider detection
Push
Commit pushed
Copy timestamp to clipboard
10m ago
Copy timestamp duration to clipboard
Cancel workflow
Fix workflow
More Actions
Jobs
SUCCESS job checkout-code
checkout-code
885223
1m 16s
1m 16s
SUCCESS job build-frontend
build-frontend
885224
1m 17s
1m 17s
SUCCESS job test-frontend
test-frontend
885225
1m 53s
1m 53s
SUCCESS job build-backend
build-backend
885226
55s
55s
SUCCESS job phpstan
phpstan
885239
1m 25s
1m 25s
SUCCESS job prepare_deploy_revision_subenv
prepare_deploy_revision_subenv
885230
1m 2s
1m 2s
SUCCESS job build_docker_backend_code_subenv
build_docker_backend_code_subenv
885231
1m 54s
1m 54s
SUCCESS job build_docker_worker_code_subenv
build_docker_worker_code_subenv
885232
1m 56s
1m 56s
SUCCESS job build_docker_worker_video_code_subenv
build_docker_worker_video_code_subenv
885233
1m 50s
1m 50s
SUCCESS job db_migrations_subenv
db_migrations_subenv
885235
19s
19s
RUNNING job deploy_docker_backend_code_subenv
deploy_docker_backend_code_subenv
885237
5m 6s
5m 6s
SUCCESS job deploy_docker_worker_code_subenv
deploy_docker_worker_code_subenv
885238
2m 5s
2m 5s
SUCCESS job deploy_docker_worker_video_code_subenv
deploy_docker_worker_video_code_subenv
885236
30s
30s
SUCCESS job deploy_frontend_assets_to_s3_subenv
deploy_frontend_assets_to_s3_subenv
885234
57s
57s
SUCCESS job setup
setup
885228
1m 5s
1m 5s
RUNNING job test
test
885229
7m 47s
7m 47s
SUCCESS job test-backend-lint
test-backend-lint
885227
4m 17s
4m 17s
sonar_cloud
885240
SUCCESS workflow setup-workflow. Collapse the workflow jobs list.
Status Passed Success
Success
setup-workflow
setup-workflow
SETUP
JY-20606-desktop-app-recall
JY-20606-desktop-app-recall
Open commit on version control site
13a63f7
JY-20606: add provider detection
Push
Commit pushed
Copy timestamp to clipboard
11m ago
Copy timestamp duration to clipboard
Rerun workflow from start
Fix workflow
More Actions
Jobs
SUCCESS job setup
setup
885222
47s
47s
app
58249
58249
RUNNING workflow build_accept_deploy. Collapse the workflow jobs list.
Status Running Running
Running
23m 41s
remain
Info Outline
build_accept_deploy
build_accept_deploy
JY-20773-fix-automated-reports-user-pilot-tracking
JY-20773-fix-automated-reports-user-pilot-tracking
Open commit on version control site
62861fa
Merge branch 'master' into JY-20773-fix-automated-reports-user-pilot-tracking
Rerun
from failed
Copy timestamp to clipboard
8s ago
Copy timestamp duration to clipboard
Cancel workflow
Fix workflow
More Actions
Jobs
SUCCESS job checkout-code
checkout-code
885213
1m 38s
1m 38s
SUCCESS job build-frontend
build-frontend
885216
1m 29s
1m 29s
SUCCESS job test-frontend
test-frontend
885218
1m 43s
1m 43s
SUCCESS job build-backend
build-backend
885214
1m 12s
1m 12s
SUCCESS job phpstan
phpstan
885219
2m 18s
2m 18s
SUCCESS job setup
setup
885217
59s
59s
RUNNING job test
test
885241
1m 27s
1m 27s
SUCCESS job test-backend-lint
test-backend-lint
885215
4m 20s
4m 20s
sonar_cloud
885242
FAILED workflow build_accept_deploy. Collapse the workflow jobs list.
Status Failed Failed
Failed
build_accept_deploy
build_accept_deploy
JY-20773-fix-automated-reports-user-pilot-tracking
JY-20773-fix-automated-reports-user-pilot-tracking
Open commit on version control site
62861fa
Merge branch 'master' into JY-20773-fix-automated-reports-user-pilot-tracking...
|
25294
|
NULL
|
NULL
|
NULL
|
|
25684
|
1078
|
0
|
2026-05-12T11:44:31.226007+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-12/1778 /Users/lukas/.screenpipe/data/data/2026-05-12/1778586271226_m1.jpg...
|
Claude
|
Claude
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Skip to content
Skip to content
Click to collapse
Skip to content
Skip to content
Click to collapse
⌘B
Drag to resize
Collapse sidebar
Search
Chat
Cowork
Code
New chat ⌘N
New chat
⌘N
Projects
Artifacts
Customize
Pinned
Bulgarian citizenship application process for EU residents
More options for Bulgarian citizenship application process for EU residents
Dawarich location tracking project
More options for Dawarich location tracking project
Recents
View all
Screenpipe data sync and retention management
More options for Screenpipe data sync and retention management
Screenpipe sync script failing after recent migrations
More options for Screenpipe sync script failing after recent migrations
Hubspot BadRequest headers debugging
More options for Hubspot BadRequest headers debugging
Monthly expense tracking
More options for Monthly expense tracking
Exporting transaction data from Notion to finance hub
More options for Exporting transaction data from Notion to finance hub
💬 How much have I spent for groc…
More options for 💬 How much have I spent for groc…
April 2026 spending by category
More options for April 2026 spending by category
Code diff review
More options for Code diff review
HubSpot rate limit implementation strategy...
|
[{"role":"AXLink","text":& [{"role":"AXLink","text":"Skip to content","depth":14,"on_screen":true,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Skip to content","depth":15,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Click to collapse","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"⌘B","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Drag to resize","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Collapse sidebar","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Chat","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cowork","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New chat ⌘N","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"New chat","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"⌘N","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Projects","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Artifacts","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Customize","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Pinned","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXButton","text":"Bulgarian citizenship application process for EU residents","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Bulgarian citizenship application process for EU residents","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Dawarich location tracking project","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Dawarich location tracking project","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Recents","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXButton","text":"View all","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Screenpipe data sync and retention management","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Screenpipe data sync and retention management","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Screenpipe sync script failing after recent migrations","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Screenpipe sync script failing after recent migrations","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hubspot BadRequest headers debugging","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Hubspot BadRequest headers debugging","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Monthly expense tracking","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Monthly expense tracking","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Exporting transaction data from Notion to finance hub","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Exporting transaction data from Notion to finance hub","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"💬 How much have I spent for groc…","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for 💬 How much have I spent for groc…","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"April 2026 spending by category","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for April 2026 spending by category","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code diff review","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Code diff review","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HubSpot rate limit implementation strategy","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8054425271343037129
|
1589682542644940565
|
click
|
hybrid
|
NULL
|
Skip to content
Skip to content
Click to collapse
Skip to content
Skip to content
Click to collapse
⌘B
Drag to resize
Collapse sidebar
Search
Chat
Cowork
Code
New chat ⌘N
New chat
⌘N
Projects
Artifacts
Customize
Pinned
Bulgarian citizenship application process for EU residents
More options for Bulgarian citizenship application process for EU residents
Dawarich location tracking project
More options for Dawarich location tracking project
Recents
View all
Screenpipe data sync and retention management
More options for Screenpipe data sync and retention management
Screenpipe sync script failing after recent migrations
More options for Screenpipe sync script failing after recent migrations
Hubspot BadRequest headers debugging
More options for Hubspot BadRequest headers debugging
Monthly expense tracking
More options for Monthly expense tracking
Exporting transaction data from Notion to finance hub
More options for Exporting transaction data from Notion to finance hub
💬 How much have I spent for groc…
More options for 💬 How much have I spent for groc…
April 2026 spending by category
More options for April 2026 spending by category
Code diff review
More options for Code diff review
HubSpot rate limit implementation strategy
iTerm2ShellEditViewSessionScriptsProfilesWindowHelpSupport Daily - in 16 mDOCKERO ₴1DEV (-zsh)O $2APP (-zsh)883ec2-user@ip-10-30-129-190:~ec2-user@ip-10-30-129-..84-zshX5screenpipe"O ₴6100% C78• Tue 12 May 14:44:31181-zsh*7+For documentation,visit [URL_WITH_CREDENTIALS] ~]$ docker exec -it $(docker ps --format "{{.ID}}" --filter "name=ecs-worker" | head -1) /bin/bash -c "cd /home/jiminny && bash"root@a3efaa2235c4:/home/jiminny# php artisan tinkerPsy Shell v0.12.21 (PHP 8.3.30 - cli) by Justin HilemanNew PHPmanual is available (latest: 3.0.5).Update with'doc --update-manual'> Sresult = AutomatedReportResult::find(1872);[!] Aliasing'AutomatedReportResult'to'Jiminny\Models\AutomatedReportResult' for this Tinker session.Jiminny\Models\AutomatedReportResult {#15863id: 1872,uuid: b"CO-O,/x\e¢Ht°ão11",report_id:54,name:"Coaching Profiles - 6 - 12 Apr 2026 - Client Success, UK Sales",media_type: "pdf",parent_id: null,status: 2,reason: 0,payload: "{"team_id":1, "request_id": "822fa41b-afd3-43a9-a248-86b0e36f3131", "report_type":"coaching_profiles", "media_types": ["pdf", "podcast"], "from_date": "2026-04-06T00:00:00+(0:д- ) te 2028-012723-59-59-0:80 Corluduratt n ,21 econsent St Sp (a -requenenenes sta,*" (, ckur' - Ketps :NU2,-me3n, TOlyvaVue*- app many-yoes ö okerracorts\/ready","report_period":"6 - 12 Apr 2026".respoys reoreuerte: °822 Ab- 703-4309-0100k otetriss 3, eust Compl edi", '*inestamp" : 2026-04-13781:11:48 648399-80-80*, 'SB_url" 'S3: VWStminny. el ient-data V/5F0F4810-7e77-4086-8f69-93429ae4d70bV/reportsV/822fa41b-afd3-43a9-a248-86b0e36f3131.MD","report_type":"coaching_profiles","podcast_url":"s3:Vjiminny.client-data\/5f0f4810-7e77-4086-8f69-93429ae4d70b\/reports\/822fa41b-afd3-43a9-a248-86b0e36f3131_podcast.txt","podcast_audio_url":"s3:\//jiminny.client-data\/5f0f4810-7e77-4086-8f69-93429ae4d70b\/reports\/822fa41b-afd3-43a9-a248-86b0e36f3131_podcast.mp3","podcast_ssml_url":"s3:\/jiminny.client-data\/5f0f4810-7e77-4086-8f69-93429ae4d70bVreports\/822fa41b-afd3-43a9-a248-86b0e36f3131_podcast.ssml"}"requested_at: "2026-04-13 01:00:57"generated_at: "2026-04-13 01:11:48",sent_at: null,created_at: "2026-04-13 01:00:27",updated_at: "2026-04-13 01:11:48"> Sresult->status = 4;= 4> Sresult->save();= true> exit...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
26672
|
1104
|
11
|
2026-05-12T12:55:14.060193+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-12/1778 /Users/lukas/.screenpipe/data/data/2026-05-12/1778590514060_m1.jpg...
|
Claude
|
Claude
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Skip to content
Skip to content
Click to collapse
Skip to content
Skip to content
Click to collapse
⌘B
Drag to resize
Collapse sidebar
Search
Chat
Cowork
Code
New chat ⌘N
New chat
⌘N
Projects
Artifacts
Customize
Pinned
Bulgarian citizenship application process for EU residents
More options for Bulgarian citizenship application process for EU residents
Dawarich location tracking project
More options for Dawarich location tracking project
Recents
View all
Screenpipe data sync and retention management
More options for Screenpipe data sync and retention management
Screenpipe sync script failing after recent migrations
More options for Screenpipe sync script failing after recent migrations
Hubspot BadRequest headers debugging
More options for Hubspot BadRequest headers debugging
Monthly expense tracking
More options for Monthly expense tracking
Exporting transaction data from Notion to finance hub
More options for Exporting transaction data from Notion to finance hub
💬 How much have I spent for groc…
More options for 💬 How much have I spent for groc…
April 2026 spending by category
More options for April 2026 spending by category
Code diff review
More options for Code diff review
HubSpot rate limit implementation strategy...
|
[{"role":"AXLink","text":& [{"role":"AXLink","text":"Skip to content","depth":14,"on_screen":true,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Skip to content","depth":15,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Click to collapse","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"⌘B","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Drag to resize","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Collapse sidebar","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Chat","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cowork","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New chat ⌘N","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"New chat","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"⌘N","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Projects","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Artifacts","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Customize","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Pinned","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXButton","text":"Bulgarian citizenship application process for EU residents","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Bulgarian citizenship application process for EU residents","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Dawarich location tracking project","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Dawarich location tracking project","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Recents","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXButton","text":"View all","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Screenpipe data sync and retention management","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Screenpipe data sync and retention management","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Screenpipe sync script failing after recent migrations","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Screenpipe sync script failing after recent migrations","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hubspot BadRequest headers debugging","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Hubspot BadRequest headers debugging","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Monthly expense tracking","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Monthly expense tracking","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Exporting transaction data from Notion to finance hub","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Exporting transaction data from Notion to finance hub","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"💬 How much have I spent for groc…","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for 💬 How much have I spent for groc…","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"April 2026 spending by category","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for April 2026 spending by category","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code diff review","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Code diff review","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HubSpot rate limit implementation strategy","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8054425271343037129
|
1589682542644940565
|
app_switch
|
hybrid
|
NULL
|
Skip to content
Skip to content
Click to collapse
Skip to content
Skip to content
Click to collapse
⌘B
Drag to resize
Collapse sidebar
Search
Chat
Cowork
Code
New chat ⌘N
New chat
⌘N
Projects
Artifacts
Customize
Pinned
Bulgarian citizenship application process for EU residents
More options for Bulgarian citizenship application process for EU residents
Dawarich location tracking project
More options for Dawarich location tracking project
Recents
View all
Screenpipe data sync and retention management
More options for Screenpipe data sync and retention management
Screenpipe sync script failing after recent migrations
More options for Screenpipe sync script failing after recent migrations
Hubspot BadRequest headers debugging
More options for Hubspot BadRequest headers debugging
Monthly expense tracking
More options for Monthly expense tracking
Exporting transaction data from Notion to finance hub
More options for Exporting transaction data from Notion to finance hub
💬 How much have I spent for groc…
More options for 💬 How much have I spent for groc…
April 2026 spending by category
More options for April 2026 spending by category
Code diff review
More options for Code diff review
HubSpot rate limit implementation strategy
SlackFileEditViewGoHistoryWindowHelpRetro - Platform - in 1h 5 mБГsshDOCKER• 81DEV (-zsh)О ₴2APP (-zsh)• *[EMAIL]@Lukas-Kovaliks-MacBook-Pro-Jiminny~/.screenpipe/data $ cd ..[EMAIL] $ nasAdm1n@DXP4800PLUS-B5F8: ~$cd/volumel/screenpipe/Adm1n@DXP4800PLUS-B5F8:/volume1/screenpipes 1ltotal26Gdrwxrwxrwx+1rootroot410 May1215:15drwxr-xr-xrootroot450 Apr2519:39drwxrwxrwx+1Adminadmin202 Apr2620:10drwxrwxrwx+1Adminadmin298 May1013:46drwxrwxrwx+Adminadmin144 May09:41drwxrwxrwx+1Admin admin70 May1013:47drwxrwxrwx+1Adminadmin164 Apr1116:51drwxrwxrwx+1rootroot5.1KMay1120:55-rwxrwxrwx+1rootroot31Apr1817:42app_settings.json1Adminadmin13G May1120:55archive.db-rwxrwxrwx+1Adminadmin11G May10-rwxrwxrwx+Adm1n admin 3.5G May1112:31archive.db-bak20:15db.sqlite-rwxrwxrwx+1Admin admin32K May1205:48db.sqlite-shm-rwxrwxrwx+ 1Admin admin0 Apr 26 17:17db.sqlite-wal1Admin admin11K May 12 09:09.DS_Store-rwxrwxrwx+ 1 Admin admin219 Apr24 19:33•gitignore-rwxrwxrWx+1 Admin admin0 Apr1317:21screenpipe.db-rwxrwxrwx+1 Admin admin 8.4K May12 15:15screenpipe_fts_migrate.sh-rwxrwxrwx+ 1 Admin admin32K May 11 20:48screenpipe_sync.sh-rwxrwxrwx+ 1 Admin admin20K May 10 13:06screenpipe_sync_updated.shAdm1n@DXP4800PLUS-B5F8:/volume1/screenpipe$ cp archive.dbarchive.db.bak-pre-installidAdm1n@DXP4800PLUS-B5F8:/volume1/screenpipes ./screenpipe_fts_migrate.sh archive.dbScreenpipe FTS migrationDB:archive.dbSize: 13G• ×4-zsh• 285screenpipe"O 886ssh100% <78•Tue 12 May 15:55:1318187-zsh• *8+• Creating install registry_installs table• Om01s• Adding install_id to base tablesvideo_chunksalready presentError: stepping, UNIQUEconstraintfailed: video_chunks.install_id, video_chunks.id (19)Adm1n@DXP4800PLUS-B5F8:/volume1/screenpipes sqlite3 archive.db "SELECT * FROM_installs;"Adm1neDXP4800PLUS-B5F8:/volume1/screenpipes sqlite3 archive.db "SELECT install_id, COUNT(*) FROM frames GROUP BY install_id;"Error: in prepare, no such column: install_idSELECT install_id,COUNT(*) FROM frames GROUP BY install_id;^_-- error hereAdm1n@DXP4800PLUS-B5F8:/volume1/screenpipes |...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
19909
|
856
|
1
|
2026-05-11T14:11:47.888062+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778508707888_m1.jpg...
|
Firefox
|
JY-20725 add HS rate limit handling on activities JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app — Work...
|
True
|
github.com/jiminny/app/pull/12066/changes
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
New Tab
New Tab
Jy 20820 es reindex stream model h New Tab
New Tab
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST [URL_WITH_CREDENTIALS]
Show options
LakyLak commented 1 hour ago
LakyLak
LakyLak
commented
1 hour ago
1 hour ago
JIRA: JY-20725
JIRA:
JY-20725
JY-20725
Changes:
Changes:
Adds
HandleHubspotRateLimit
middleware (release jobs with delay)
Adds
executeRequest
wrapper in Hubspot Client. It handles 429 errors and throws
RateLimitException
Add or remove reactions
LakyLak
LakyLak
added
2
commits
1 hour ago
1 hour ago
@LakyLak
JY-20725
JY-20725
add HS rate limit handling on activities rematching
add HS rate limit handling on activities rematching
8 / 10 checks OK
44d5678
44d5678
@LakyLak
JY-20725
JY-20725
add tests
add tests
11 / 12 checks OK
cbed2c9
cbed2c9
@sonarqubecloud
Show options
sonarqubecloud Bot commented 39 minutes ago
sonarqubecloud
sonarqubecloud
Bot
commented
39 minutes ago
39 minutes ago
Quality Gate Failed Quality Gate failed
Quality Gate Failed
Quality Gate failed
Failed conditions
34.4% Coverage on New Code
34.4% Coverage on New Code
(required ≥ 70%)
See analysis details on SonarQube Cloud
See analysis details on SonarQube Cloud
Add or remove reactions
@LakyLak
Show options
Author
LakyLak commented 33 minutes ago
LakyLak
LakyLak
commented
33 minutes ago
33 minutes ago
@claude
@claude
Add or remove reactions
react with eyes
👀
1
@claude
Show options
claude Bot commented 32 minutes ago •
claude
claude
Bot
commented
32 minutes ago
32 minutes ago
•
edited
edited
Claude finished
@LakyLak
@LakyLak
's task in 1m 42s
——
View job
View job
Code Review
Code Review
Completed task
Gathering context
Completed task
Reading changed files
Completed task
Analyzing code quality
Completed task
Posting review feedback
Overall this is a well-thought-out implementation. The circuit-breaker pattern using Redis NX, the jitter for thundering-herd prevention, and the log-sampling strategy are all solid. A few issues worth addressing before merge:
Issues
Issues
1. Batch API calls bypass rate-limit handling
batchReadObjects()
in
Client.php
(lines 296–319) calls the HubSpot batch APIs directly without going through
executeRequest()
. If the batch endpoints return 429s, those exceptions will not set the Redis circuit-breaker and will not be wrapped in
RateLimitException
, so the middleware won't catch them.
// batchReadObjects — no executeRequest() wrapping
$
response
=
$
batchConfig
[
'
api
'
]->
read
(
$
batchReadRequest
);
Copy
Given the search endpoints can also hit rate limits during pagination-heavy rematching, the batch calls could too. Consider wrapping the batch call similarly, or at least catching 429 from batch APIs and converting them to
RateLimitException
.
Fix this →
Fix this →
2. Circuit-breaker key is scoped to CRM config ID, not HubSpot portal
getRateLimitCacheKey()
(
Client.php:120
) returns
hubspot:ratelimit:portal:{configId}
, but
$this->config->getId()
is the CRM
configuration
record ID, not the HubSpot portal/account ID. If multiple CRM configuration records share the same HubSpot portal (e.g. re-connections), each will have its own independent circuit-breaker. A 429 received via config A will not suppress requests from config B even though they share the same quota.
If configs are always 1:1 with portals this is fine, but it's worth confirming or renaming the key to avoid misleading future readers:
// If config IDs == portal IDs, rename to make intent clear:
return
sprintf
(
'
hubspot:ratelimit:config:%d
'
,
$
this
->
config
->
getId
());
Copy
3.
isHubspotRateLimit()
and
parseRetryAfter()
are
public
but not in the interface
These two methods (
Client.php:123
,
137
) are an internal concern of the rate-limit handling, but they are
public
. Nothing outside
Client
needs to call them (the pagination service calls
isUnauthorizedException
, not these). Making them
private
or at least
protected
avoids callers depending on them in tests or subclasses. The only reason to keep them public would be if they're tested in isolation — but they currently have no direct tests at all.
4. Missing test coverage for
executeRequest()...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Skip to content","depth":6,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Skip to content","depth":7,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Open menu","depth":10,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Homepage (g then d)","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"jiminny","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"jiminny","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"app","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"app","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Search or jump to…","depth":9,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Type","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to search","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Chat with Copilot","depth":10,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"Open Copilot…","depth":9,"on_screen":false,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXMenuButton","text":"Create new...","depth":9,"on_screen":false,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"All issues(g then i)","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"All pull requests","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"All repositories","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"You have unread notifications(g then n)","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open user navigation menu","depth":9,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Repository navigation","depth":9,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Repository navigation","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Code","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Code","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Pull requests (34)","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"34","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Agents","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Agents","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Actions","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Actions","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Wiki","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Wiki","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Security and quality (4)","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Security and quality","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Insights","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Insights","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Settings","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Settings","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Important update","depth":10,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Important update","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"On April 24 we'll start using GitHub Copilot interaction data for AI model training unless you opt out.","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Review this update","depth":10,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Review this update","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"and manage your preferences in your","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"GitHub account settings","depth":10,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"GitHub account settings","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Dismiss banner","depth":9,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"JY-20725 add HS rate limit handling on activities rematching #12066 Edit title","depth":13,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"JY-20725 add HS rate limit handling on activities rematching","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"#","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12066","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Edit title","depth":14,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"View statusView status","depth":13,"on_screen":false,"role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Loading","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Loading merge status","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Code","depth":13,"on_screen":false,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Code","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"LakyLak","depth":15,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LakyLak","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"wants to merge 2 commits into","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"master","depth":15,"on_screen":false,"role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"master","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"from","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20725-handle-HS-search-rate-limit","depth":16,"on_screen":false,"role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725-handle-HS-search-rate-limit","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy head branch name to clipboard","depth":16,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Commits (2)","depth":15,"on_screen":false,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Commits","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Checks","depth":15,"on_screen":false,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Checks","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Files changed","depth":15,"on_screen":false,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Files changed","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Conversation","depth":12,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Conversation","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@LakyLak","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show options","depth":15,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"LakyLak commented 1 hour ago","depth":14,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"LakyLak","depth":16,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LakyLak","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commented","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1 hour ago","depth":15,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1 hour ago","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"JIRA: JY-20725","depth":16,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"JIRA:","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20725","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Changes:","depth":16,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Changes:","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Adds","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"HandleHubspotRateLimit","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"middleware (release jobs with delay)","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Adds","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"executeRequest","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"wrapper in Hubspot Client. It handles 429 errors and throws","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RateLimitException","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add or remove reactions","depth":16,"on_screen":false,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"LakyLak","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LakyLak","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"added","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commits","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1 hour ago","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1 hour ago","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@LakyLak","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"JY-20725","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"add HS rate limit handling on activities rematching","depth":14,"on_screen":false,"help_text":"JY-20725 add HS rate limit handling on activities rematching","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"add HS rate limit handling on activities rematching","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"8 / 10 checks OK","depth":14,"on_screen":false,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"44d5678","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"44d5678","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@LakyLak","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"JY-20725","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"add tests","depth":14,"on_screen":false,"help_text":"JY-20725 add tests","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"add tests","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"11 / 12 checks OK","depth":14,"on_screen":false,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"cbed2c9","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"cbed2c9","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@sonarqubecloud","depth":13,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show options","depth":14,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"sonarqubecloud Bot commented 39 minutes ago","depth":13,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"sonarqubecloud","depth":15,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"sonarqubecloud","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Bot","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commented","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"39 minutes ago","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"39 minutes ago","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Quality Gate Failed Quality Gate failed","depth":16,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"Quality Gate Failed","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Quality Gate failed","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Failed conditions","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"34.4% Coverage on New Code","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"34.4% Coverage on New Code","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(required ≥ 70%)","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"See analysis details on SonarQube Cloud","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"See analysis details on SonarQube Cloud","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add or remove reactions","depth":15,"on_screen":false,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"@LakyLak","depth":13,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show options","depth":14,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Author","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"LakyLak commented 33 minutes ago","depth":13,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"LakyLak","depth":15,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LakyLak","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commented","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"33 minutes ago","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"33 minutes ago","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@claude","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"@claude","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add or remove reactions","depth":15,"on_screen":false,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"react with eyes","depth":14,"on_screen":false,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"👀","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@claude","depth":13,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show options","depth":14,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"claude Bot commented 32 minutes ago •","depth":13,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"claude","depth":15,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"claude","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Bot","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commented","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"32 minutes ago","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"32 minutes ago","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"•","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"edited","depth":16,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"edited","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Claude finished","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@LakyLak","depth":18,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"@LakyLak","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'s task in 1m 42s","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"——","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"View job","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"View job","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Code Review","depth":16,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Code Review","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Completed task","depth":18,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Gathering context","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Completed task","depth":18,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reading changed files","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Completed task","depth":18,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Analyzing code quality","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Completed task","depth":18,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Posting review feedback","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Overall this is a well-thought-out implementation. The circuit-breaker pattern using Redis NX, the jitter for thundering-herd prevention, and the log-sampling strategy are all solid. A few issues worth addressing before merge:","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Issues","depth":16,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Issues","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Batch API calls bypass rate-limit handling","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"batchReadObjects()","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"in","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Client.php","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(lines 296–319) calls the HubSpot batch APIs directly without going through","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"executeRequest()","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":". If the batch endpoints return 429s, those exceptions will not set the Redis circuit-breaker and will not be wrapped in","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RateLimitException","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", so the middleware won't catch them.","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"// batchReadObjects — no executeRequest() wrapping","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"batchConfig","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"[","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"api","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"]->","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"read","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"batchReadRequest","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":");","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy","depth":17,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Given the search endpoints can also hit rate limits during pagination-heavy rematching, the batch calls could too. Consider wrapping the batch call similarly, or at least catching 429 from batch APIs and converting them to","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RateLimitException","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Fix this →","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Fix this →","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. Circuit-breaker key is scoped to CRM config ID, not HubSpot portal","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"getRateLimitCacheKey()","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Client.php:120","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") returns","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"hubspot:ratelimit:portal:{configId}","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", but","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$this->config->getId()","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the CRM","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"configuration","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"record ID, not the HubSpot portal/account ID. If multiple CRM configuration records share the same HubSpot portal (e.g. re-connections), each will have its own independent circuit-breaker. A 429 received via config A will not suppress requests from config B even though they share the same quota.","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"If configs are always 1:1 with portals this is fine, but it's worth confirming or renaming the key to avoid misleading future readers:","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"// If config IDs == portal IDs, rename to make intent clear:","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"return","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"sprintf","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"hubspot:ratelimit:config:%d","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"this","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"->","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"config","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"->","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"getId","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"());","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy","depth":17,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"3.","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"isHubspotRateLimit()","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"and","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"parseRetryAfter()","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"are","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"public","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"but not in the interface","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"These two methods (","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Client.php:123","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"137","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") are an internal concern of the rate-limit handling, but they are","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"public","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":". Nothing outside","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Client","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"needs to call them (the pagination service calls","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"isUnauthorizedException","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", not these). Making them","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"private","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or at least","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"protected","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"avoids callers depending on them in tests or subclasses. The only reason to keep them public would be if they're tested in isolation — but they currently have no direct tests at all.","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. Missing test coverage for","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"executeRequest()","depth":19,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8054156044956193247
|
-2006899675097156730
|
idle
|
accessibility
|
NULL
|
New Tab
New Tab
Jy 20820 es reindex stream model h New Tab
New Tab
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST [URL_WITH_CREDENTIALS]
Show options
LakyLak commented 1 hour ago
LakyLak
LakyLak
commented
1 hour ago
1 hour ago
JIRA: JY-20725
JIRA:
JY-20725
JY-20725
Changes:
Changes:
Adds
HandleHubspotRateLimit
middleware (release jobs with delay)
Adds
executeRequest
wrapper in Hubspot Client. It handles 429 errors and throws
RateLimitException
Add or remove reactions
LakyLak
LakyLak
added
2
commits
1 hour ago
1 hour ago
@LakyLak
JY-20725
JY-20725
add HS rate limit handling on activities rematching
add HS rate limit handling on activities rematching
8 / 10 checks OK
44d5678
44d5678
@LakyLak
JY-20725
JY-20725
add tests
add tests
11 / 12 checks OK
cbed2c9
cbed2c9
@sonarqubecloud
Show options
sonarqubecloud Bot commented 39 minutes ago
sonarqubecloud
sonarqubecloud
Bot
commented
39 minutes ago
39 minutes ago
Quality Gate Failed Quality Gate failed
Quality Gate Failed
Quality Gate failed
Failed conditions
34.4% Coverage on New Code
34.4% Coverage on New Code
(required ≥ 70%)
See analysis details on SonarQube Cloud
See analysis details on SonarQube Cloud
Add or remove reactions
@LakyLak
Show options
Author
LakyLak commented 33 minutes ago
LakyLak
LakyLak
commented
33 minutes ago
33 minutes ago
@claude
@claude
Add or remove reactions
react with eyes
👀
1
@claude
Show options
claude Bot commented 32 minutes ago •
claude
claude
Bot
commented
32 minutes ago
32 minutes ago
•
edited
edited
Claude finished
@LakyLak
@LakyLak
's task in 1m 42s
——
View job
View job
Code Review
Code Review
Completed task
Gathering context
Completed task
Reading changed files
Completed task
Analyzing code quality
Completed task
Posting review feedback
Overall this is a well-thought-out implementation. The circuit-breaker pattern using Redis NX, the jitter for thundering-herd prevention, and the log-sampling strategy are all solid. A few issues worth addressing before merge:
Issues
Issues
1. Batch API calls bypass rate-limit handling
batchReadObjects()
in
Client.php
(lines 296–319) calls the HubSpot batch APIs directly without going through
executeRequest()
. If the batch endpoints return 429s, those exceptions will not set the Redis circuit-breaker and will not be wrapped in
RateLimitException
, so the middleware won't catch them.
// batchReadObjects — no executeRequest() wrapping
$
response
=
$
batchConfig
[
'
api
'
]->
read
(
$
batchReadRequest
);
Copy
Given the search endpoints can also hit rate limits during pagination-heavy rematching, the batch calls could too. Consider wrapping the batch call similarly, or at least catching 429 from batch APIs and converting them to
RateLimitException
.
Fix this →
Fix this →
2. Circuit-breaker key is scoped to CRM config ID, not HubSpot portal
getRateLimitCacheKey()
(
Client.php:120
) returns
hubspot:ratelimit:portal:{configId}
, but
$this->config->getId()
is the CRM
configuration
record ID, not the HubSpot portal/account ID. If multiple CRM configuration records share the same HubSpot portal (e.g. re-connections), each will have its own independent circuit-breaker. A 429 received via config A will not suppress requests from config B even though they share the same quota.
If configs are always 1:1 with portals this is fine, but it's worth confirming or renaming the key to avoid misleading future readers:
// If config IDs == portal IDs, rename to make intent clear:
return
sprintf
(
'
hubspot:ratelimit:config:%d
'
,
$
this
->
config
->
getId
());
Copy
3.
isHubspotRateLimit()
and
parseRetryAfter()
are
public
but not in the interface
These two methods (
Client.php:123
,
137
) are an internal concern of the rate-limit handling, but they are
public
. Nothing outside
Client
needs to call them (the pagination service calls
isUnauthorizedException
, not these). Making them
private
or at least
protected
avoids callers depending on them in tests or subclasses. The only reason to keep them public would be if they're tested in isolation — but they currently have no direct tests at all.
4. Missing test coverage for
executeRequest()...
|
19907
|
NULL
|
NULL
|
NULL
|
|
26598
|
1103
|
1
|
2026-05-12T12:46:11.320751+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-12/1778 /Users/lukas/.screenpipe/data/data/2026-05-12/1778589971320_m2.jpg...
|
Claude
|
Claude
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
rireroxcalVIewhistorybookmarksProtllesToolsWindowm rireroxcalVIewhistorybookmarksProtllesToolsWindowmelp" Ketro - Platorm • In 1h 14 m100% 28• Tue 12 May 15:46:11us-east-crioesv c.loes-instenisssroueryvetallssu~ end-u~stan~-45zuu~tlmelyper KCLAlVE-z- Ule-unitr seconas-essace <e zu 4ulocstream <e 20 40100 va/c zutllel zu 4umessage zullke 20 zzirlegerine zucvent zuror zuuseaws,[Option+5] @United States (Ohio) •Account ID: 4103-4619-5943PRODTypeError: League|Flysystem|FileO) EC2B S3# CodeDeployCô CloudvCOs Aurora and RDSổ Amazon OpenSearch Ser..CloudFrontaia MediaLiveCa CloudWatch | us-east-2CloudWatch> Logs InsightsO Pipelines - jiminny/ap• Query definition infoLog Analytics a unified observability platform for a smoother experience, now in preview mode. Click here to try it out!5m(UY-20725) (HubSpot) Optimise CI30m12hCustom #compare (Otr)UTC timezone * L Start tailingJy-20725 add HS rate limit handlinOuery scopeLog groupsProperty selectonWJY-207731 User Pilot not receiviniAll log groupsQ All log groups.@Jy-20773 fix user pilot tracking for(JY-207761 Automated report - seJY-20725 add HS rate limit handlirfields @timestamp,(message, @logStream, @log"Tilter anessage likerlagering cventfor UserPilot tracking"@message not like /Analytic/ | filter @message not like /Transcript/tilter dmessage not like/wedhook,•Tilter dmessage not like /Meetinabot/•limit 10000$ (SRD-6793] Les Mills activity typePlattorm Team - Backloo - Jiralu Userpilot | Events— New TabLogs Insights QL½ Query gePS$IRun queryCancel• Completed. Query executed for 78 log grouClaudeLogs (5)Patterns (1)VisualizationLogs (5)" Summarize resultsShowing 5 of 5 records matched O23,884,418 records (7.0 GB) scanned in 17.6s @ 1,353,684 records/s (404.0 MB/s)01:00101:3002:0002:30103:0003:3004:00|05:0005:3006:0006:3007:0007:3008:0008:3009:00Q Filter table results (case insensitive)...©timestamp• 1 2026-05-12T10:47:09.311Z2026-05-12T10:04:46.728Z2026-05-12709:20:38.392Z2026-05-12T01•00•21 6697|6с 2026.05.12701•00-29 9947emessage®logStreamNOTICE: PHP message: [2026-05-12 10:47:09] production.INFO: [Report Ready] Triggering Event for UserPilot tracking ("report_uuid":"23a4622e-3d94-. php-app/php-app/f9708a4ce3c04f409457613e51ff01d8 |2ªNOTICE: PHP message: [2026-05-12 10:04:46] production. INFO: [Report Ready] Triggering Event for UserPilot tracking ("report_uuid": "2304622e-3d94- php-app/php-app/26f1c69abf0741C785f4eb93ad730784 L2NOTICE: PHP message: [2026-05-12 09:20:38] production.INFO: [Report Ready] Triggering Event for UserPilot tracking {"report_uuid":"52866e30-9ab9-.. php-app/php-app/7c976ed843c0428faab97fad2f3421c2 L?NOTICE: PHP message: [2026-05-12 01:00:31] production.INFO: [Report Ready] Triggering Event for UserPilot tracking {"report_uuid": "d08c3a32-01fc- php-app/php-app/290cca34cb0842d18ef788c7b4ec6b52 [ªNOTICE: PHP message: [2026-05-12 01:00:28] production.INFO: [Report Ready] Triggering Event for UserPilot tracking {"report_uuid":"8b74812a-9116- php-app/php-app/81547f694a0345619f77bf95aaad3d08 L2elog410346195943: php-app410346195943:рhp-app410346195943:php-app410346195943:php-app410346195943:php-app2 CloudShellFeedhackLog classAccountis)STANDARDVChange Accoun….All accounts XN* Investigate YShare resultsExport results Add to dashboardHide histogram09:3011:30@ 2026. Amazon Weh Services Inc. or its affiliatesPrivacy TermsGookie nreferencec...
|
NULL
|
-8053551930990219732
|
NULL
|
visual_change
|
ocr
|
NULL
|
rireroxcalVIewhistorybookmarksProtllesToolsWindowm rireroxcalVIewhistorybookmarksProtllesToolsWindowmelp" Ketro - Platorm • In 1h 14 m100% 28• Tue 12 May 15:46:11us-east-crioesv c.loes-instenisssroueryvetallssu~ end-u~stan~-45zuu~tlmelyper KCLAlVE-z- Ule-unitr seconas-essace <e zu 4ulocstream <e 20 40100 va/c zutllel zu 4umessage zullke 20 zzirlegerine zucvent zuror zuuseaws,[Option+5] @United States (Ohio) •Account ID: 4103-4619-5943PRODTypeError: League|Flysystem|FileO) EC2B S3# CodeDeployCô CloudvCOs Aurora and RDSổ Amazon OpenSearch Ser..CloudFrontaia MediaLiveCa CloudWatch | us-east-2CloudWatch> Logs InsightsO Pipelines - jiminny/ap• Query definition infoLog Analytics a unified observability platform for a smoother experience, now in preview mode. Click here to try it out!5m(UY-20725) (HubSpot) Optimise CI30m12hCustom #compare (Otr)UTC timezone * L Start tailingJy-20725 add HS rate limit handlinOuery scopeLog groupsProperty selectonWJY-207731 User Pilot not receiviniAll log groupsQ All log groups.@Jy-20773 fix user pilot tracking for(JY-207761 Automated report - seJY-20725 add HS rate limit handlirfields @timestamp,(message, @logStream, @log"Tilter anessage likerlagering cventfor UserPilot tracking"@message not like /Analytic/ | filter @message not like /Transcript/tilter dmessage not like/wedhook,•Tilter dmessage not like /Meetinabot/•limit 10000$ (SRD-6793] Les Mills activity typePlattorm Team - Backloo - Jiralu Userpilot | Events— New TabLogs Insights QL½ Query gePS$IRun queryCancel• Completed. Query executed for 78 log grouClaudeLogs (5)Patterns (1)VisualizationLogs (5)" Summarize resultsShowing 5 of 5 records matched O23,884,418 records (7.0 GB) scanned in 17.6s @ 1,353,684 records/s (404.0 MB/s)01:00101:3002:0002:30103:0003:3004:00|05:0005:3006:0006:3007:0007:3008:0008:3009:00Q Filter table results (case insensitive)...©timestamp• 1 2026-05-12T10:47:09.311Z2026-05-12T10:04:46.728Z2026-05-12709:20:38.392Z2026-05-12T01•00•21 6697|6с 2026.05.12701•00-29 9947emessage®logStreamNOTICE: PHP message: [2026-05-12 10:47:09] production.INFO: [Report Ready] Triggering Event for UserPilot tracking ("report_uuid":"23a4622e-3d94-. php-app/php-app/f9708a4ce3c04f409457613e51ff01d8 |2ªNOTICE: PHP message: [2026-05-12 10:04:46] production. INFO: [Report Ready] Triggering Event for UserPilot tracking ("report_uuid": "2304622e-3d94- php-app/php-app/26f1c69abf0741C785f4eb93ad730784 L2NOTICE: PHP message: [2026-05-12 09:20:38] production.INFO: [Report Ready] Triggering Event for UserPilot tracking {"report_uuid":"52866e30-9ab9-.. php-app/php-app/7c976ed843c0428faab97fad2f3421c2 L?NOTICE: PHP message: [2026-05-12 01:00:31] production.INFO: [Report Ready] Triggering Event for UserPilot tracking {"report_uuid": "d08c3a32-01fc- php-app/php-app/290cca34cb0842d18ef788c7b4ec6b52 [ªNOTICE: PHP message: [2026-05-12 01:00:28] production.INFO: [Report Ready] Triggering Event for UserPilot tracking {"report_uuid":"8b74812a-9116- php-app/php-app/81547f694a0345619f77bf95aaad3d08 L2elog410346195943: php-app410346195943:рhp-app410346195943:php-app410346195943:php-app410346195943:php-app2 CloudShellFeedhackLog classAccountis)STANDARDVChange Accoun….All accounts XN* Investigate YShare resultsExport results Add to dashboardHide histogram09:3011:30@ 2026. Amazon Weh Services Inc. or its affiliatesPrivacy TermsGookie nreferencec...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
21773
|
952
|
0
|
2026-05-12T06:21:17.052235+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-12/1778 /Users/lukas/.screenpipe/data/data/2026-05-12/1778566877052_m1.jpg...
|
iTerm2
|
screenpipe"
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
ggml_metal_init: allocating
ggml_metal_init: found ggml_metal_init: allocating
ggml_metal_init: found device: Apple M1
ggml_metal_init: picking default device: Apple M1
ggml_metal_init: use fusion = true
ggml_metal_init: use concurrency = true
ggml_metal_init: use graph optimize = true
whisper_backend_init: using BLAS backend
whisper_init_state: kv self size = 3.15 MB
whisper_init_state: kv cross size = 9.44 MB
whisper_init_state: kv pad size = 2.36 MB
whisper_init_state: compute buffer (conv) = 14.17 MB
whisper_init_state: compute buffer (encode) = 65.96 MB
whisper_init_state: compute buffer (cross) = 8.50 MB
whisper_init_state: compute buffer (decode) = 96.83 MB
ggml_metal_free: deallocating
whisper_backend_init_gpu: device 0: Metal (type: 1)
whisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)
whisper_backend_init_gpu: using Metal backend
ggml_metal_init: allocating
ggml_metal_init: found device: Apple M1
ggml_metal_init: picking default device: Apple M1
ggml_metal_init: use fusion = true
ggml_metal_init: use concurrency = true
ggml_metal_init: use graph optimize = true
whisper_backend_init: using BLAS backend
whisper_init_state: kv self size = 3.15 MB
whisper_init_state: kv cross size = 9.44 MB
whisper_init_state: kv pad size = 2.36 MB
whisper_init_state: compute buffer (conv) = 14.17 MB
whisper_init_state: compute buffer (encode) = 65.96 MB
whisper_init_state: compute buffer (cross) = 8.50 MB
whisper_init_state: compute buffer (decode) = 96.83 MB
ggml_metal_free: deallocating
whisper_backend_init_gpu: device 0: Metal (type: 1)
whisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)
whisper_backend_init_gpu: using Metal backend
ggml_metal_init: allocating
ggml_metal_init: found device: Apple M1
ggml_metal_init: picking default device: Apple M1
ggml_metal_init: use fusion = true
ggml_metal_init: use concurrency = true
ggml_metal_init: use graph optimize = true
whisper_backend_init: using BLAS backend
whisper_init_state: kv self size = 3.15 MB
whisper_init_state: kv cross size = 9.44 MB
whisper_init_state: kv pad size = 2.36 MB
whisper_init_state: compute buffer (conv) = 14.17 MB
whisper_init_state: compute buffer (encode) = 65.96 MB
whisper_init_state: compute buffer (cross) = 8.50 MB
whisper_init_state: compute buffer (decode) = 96.83 MB
ggml_metal_free: deallocating
2026-05-11T22:27:49.369341Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks
whisper_backend_init_gpu: device 0: Metal (type: 1)
whisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)
whisper_backend_init_gpu: using Metal backend
ggml_metal_init: allocating
ggml_metal_init: found device: Apple M1
ggml_metal_init: picking default device: Apple M1
ggml_metal_init: use fusion = true
ggml_metal_init: use concurrency = true
ggml_metal_init: use graph optimize = true
whisper_backend_init: using BLAS backend
whisper_init_state: kv self size = 3.15 MB
whisper_init_state: kv cross size = 9.44 MB
whisper_init_state: kv pad size = 2.36 MB
whisper_init_state: compute buffer (conv) = 14.17 MB
whisper_init_state: compute buffer (encode) = 65.96 MB
whisper_init_state: compute buffer (cross) = 8.50 MB
whisper_init_state: compute buffer (decode) = 96.83 MB
ggml_metal_free: deallocating
whisper_backend_init_gpu: device 0: Metal (type: 1)
whisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)
whisper_backend_init_gpu: using Metal backend
ggml_metal_init: allocating
ggml_metal_init: found device: Apple M1
ggml_metal_init: picking default device: Apple M1
ggml_metal_init: use fusion = true
ggml_metal_init: use concurrency = true
ggml_metal_init: use graph optimize = true
whisper_backend_init: using BLAS backend
whisper_init_state: kv self size = 3.15 MB
whisper_init_state: kv cross size = 9.44 MB
whisper_init_state: kv pad size = 2.36 MB
whisper_init_state: compute buffer (conv) = 14.17 MB
whisper_init_state: compute buffer (encode) = 65.96 MB
whisper_init_state: compute buffer (cross) = 8.50 MB
whisper_init_state: compute buffer (decode) = 96.83 MB
ggml_metal_free: deallocating
whisper_backend_init_gpu: device 0: Metal (type: 1)
whisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)
whisper_backend_init_gpu: using Metal backend
ggml_metal_init: allocating
ggml_metal_init: found device: Apple M1
ggml_metal_init: picking default device: Apple M1
ggml_metal_init: use fusion = true
ggml_metal_init: use concurrency = true
ggml_metal_init: use graph optimize = true
whisper_backend_init: using BLAS backend
whisper_init_state: kv self size = 3.15 MB
whisper_init_state: kv cross size = 9.44 MB
whisper_init_state: kv pad size = 2.36 MB
whisper_init_state: compute buffer (conv) = 14.17 MB
whisper_init_state: compute buffer (encode) = 65.96 MB
whisper_init_state: compute buffer (cross) = 8.50 MB
whisper_init_state: compute buffer (decode) = 96.83 MB
ggml_metal_free: deallocating
2026-05-11T22:29:51.512607Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks
tip: get the screenpipe desktop app for the full experience
[URL_WITH_CREDENTIALS] record
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/.screenpipe $ npx screenpipe@latest record
detected hardware tier: Mid
warning: parakeet is not supported on this platform, using whisper-tiny instead
2026-05-12T09:21:07.201625Z INFO screenpipe_engine::auth_key: api auth: key resolved via secret store
checking permissions...
screen recording: ok
microphone: ok
accessibility: ok
2026-05-12T09:21:07.328817Z INFO screenpipe_screen::monitor::macos_version: Detected macOS version: 14.6
2026-05-12T09:21:10.020463Z INFO screenpipe_engine::sleep_monitor: Starting macOS sleep/wake monitor
2026-05-12T09:21:10.024711Z INFO screenpipe_engine::sleep_monitor: Screen lock/unlock observers registered (CFNotificationCenter)
2026-05-12T09:21:10.025571Z INFO screenpipe_engine::sleep_monitor: Display reconfiguration watcher registered (CGDisplayRegisterReconfigurationCallback)
2026-05-12T09:21:10.055207Z INFO screenpipe_engine::permission_monitor: permission monitor started screen=true mic=true accessibility=true keychain=true
2026-05-12T09:21:10.055275Z INFO screenpipe: meeting detector enabled — independent of transcription mode
2026-05-12T09:21:10.666779Z INFO screenpipe: API server listening on [IP_ADDRESS]:3030 (localhost only)
2026-05-12T09:21:10.666832Z INFO screenpipe: API auth enabled — run `screenpipe auth token` to view your key
2026-05-12T09:21:10.666681Z INFO screenpipe_engine::power::manager: power manager started (poll interval: 10s)
2026-05-12T09:21:10.666983Z INFO screenpipe_engine::vision_manager::manager: Starting VisionManager
2026-05-12T09:21:10.666647Z INFO screenpipe_engine::snapshot_compaction: snapshot compaction worker started (min_age=600s, poll=300s)
2026-05-12T09:21:10.673969Z INFO screenpipe_core::pipes: loaded pipe: day-recap
2026-05-12T09:21:10.675449Z INFO screenpipe_core::pipes: loaded pipe: standup-update
2026-05-12T09:21:10.676236Z INFO screenpipe_core::pipes: loaded pipe: ai-habits
2026-05-12T09:21:10.676638Z INFO screenpipe_core::pipes: loaded pipe: time-breakdown
2026-05-12T09:21:10.677056Z INFO screenpipe_core::pipes: loaded pipe: video-export
2026-05-12T09:21:10.677293Z INFO screenpipe_core::pipes: loaded pipe: meeting-summary
2026-05-12T09:21:10.677398Z INFO screenpipe_core::pipes: loaded 6 pipes from "/Users/lukas/.screenpipe/pipes"
_
__________________ ___ ____ ____ (_____ ___
/ ___/ ___/ ___/ _ \/ _ \/ __ \ / __ \/ / __ \/ _ \
(__ / /__/ / / __/ __/ / / / / /_/ / / /_/ / __/
/____/\___/_/ \___/\___/_/ /_/ / .___/_/ .___/\___/
/_/ /_/
power AI by everything you've seen, said or heard
open source | runs locally | developer friendly
┌────────────────────────┬────────────────────────────────────┐
│ setting │ value │
├────────────────────────┼────────────────────────────────────┤
│ audio chunk duration │ 30 seconds │
│ port │ 3030 │
│ audio disabled │ false │
│ vision disabled │ false │
│ pause on DRM content │ false │
│ audio engine │ Parakeet │
│ vad engine │ Silero │
│ data directory │ /Users/lukas/.screenpipe │
│ debug mode │ false │
│ telemetry │ true │
│ use pii removal │ true │
│ use all monitors │ true │
│ ignored windows │ [] │
│ included windows │ [] │
│ cloud sync │ disabled │
│ auto-destruct pid │ 0 │
│ deepgram key │ not set │
│ api auth │ enabled │
│ encrypt secrets │ disabled │
│ retention days │ 14 │
│ retention mode │ media-only (keep transcripts) │
├────────────────────────┼────────────────────────────────────┤
│ languages │ │
│ │ all languages │
├────────────────────────┼────────────────────────────────────┤
│ monitors │ │
│ │ id: 1 │
│ │ id: 2 │
├────────────────────────┼────────────────────────────────────┤
│ audio devices │ │
│ │ MacBook Pro Microphone (input) │
│ │ System Audio (output) │
└────────────────────────┴────────────────────────────────────┘
you are using local processing. all your data stays on your computer.
warning: telemetry is enabled. only error-level data will be sent.
to disable, use the --disable-telemetry flag.
check latest changes here: https://github.com/screenpipe/screenpipe/releases
2026-05-12T09:21:10.684547Z INFO screenpipe_core::pipes: pipe scheduler started (generation 2)
2026-05-12T09:21:10.686111Z INFO screenpipe: starting UI event capture
2026-05-12T09:21:10.696691Z WARN screenpipe: pi agent install failed: bun not found — install from https://bun.sh
2026-05-12T09:21:10.705742Z INFO screenpipe_engine::power::manager: initial power profile: Performance (on_ac=true, battery=Some(100))
2026-05-12T09:21:10.712331Z INFO screenpipe_engine::ui_recorder: Starting UI event capture
2026-05-12T09:21:10.753596Z INFO screenpipe_engine::ui_recorder: UI recording session started: eee53fe6-52d6-4c4e-a7e5-11ede410f444
2026-05-12T09:21:10.753638Z INFO screenpipe_engine::calendar_speaker_id: speaker identification: started (user_name=<not set>)
2026-05-12T09:21:10.753679Z INFO screenpipe_engine::hot_frame_cache: hot_frame_cache: warming from DB (2026-05-11 06:21:10.753677 UTC to 2026-05-12 06:21:10.753677 UTC)
2026-05-12T09:21:10.754945Z INFO screenpipe_engine::meeting_detector: meeting v2: detection loop started (base_interval=5s, profiles=12)
2026-05-12T09:21:10.764596Z INFO screenpipe_engine::server: Server listening on [IP_ADDRESS]:3030
2026-05-12T09:21:10.771437Z INFO screenpipe_connect::mdns: mdns: advertising screenpipe on port 3030
2026-05-12T09:21:15.451981Z WARN sqlx::query: summary="SELECT f.id, f.timestamp, f.offset_index, …" db.statement="\n\nSELECT\n f.id,\n f.timestamp,\n f.offset_index,\n COALESCE(\n SUBSTR(f.full_text, 1, 200),\n SUBSTR(f.accessibility_text, 1, 200),\n (\n SELECT\n SUBSTR(ot.text, 1, 200)\n FROM\n ocr_text ot\n WHERE\n ot.frame_id = f.id\n LIMIT\n 1\n )\n ) as text,\n COALESCE(\n f.app_name,\n (\n SELECT\n ot.app_name\n FROM\n ocr_text ot\n WHERE\n ot.frame_id = f.id\n LIMIT\n 1\n )\n ) as app_name,\n COALESCE(\n f.window_name,\n (\n SELECT\n ot.window_name\n FROM\n ocr_text ot\n WHERE\n ot.frame_id = f.id\n LIMIT\n 1\n )\n ) as window_name,\n COALESCE(vc.device_name, f.device_name) as screen_device,\n COALESCE(vc.file_path, f.snapshot_path) as video_path,\n COALESCE(vc.fps, 0.033) as chunk_fps,\n f.browser_url,\n f.machine_id\nFROM\n ...
|
[{"role":"AXTextArea","text [{"role":"AXTextArea","text":"ggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:27:49.369341Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:29:51.512607Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n\n tip: get the screenpipe desktop app for the full experience\n https://screenpi.pe\n\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:31:53.426255Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:33:55.437876Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:35:57.413206Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n\n tip: wire screenpipe into claude with one command:\n claude mcp add screenpipe -- npx -y screenpipe-mcp\n then ask claude to build a pipe that tracks who you are, your todos, and how you spend your time from your screen activity\n\n2026-05-11T22:37:14.870936Z WARN sqlx::query: summary=\"SELECT id, snapshot_path, device_name, …\" db.statement=\"\\n\\nSELECT\\n id,\\n snapshot_path,\\n device_name,\\n timestamp\\nFROM\\n frames\\nWHERE\\n snapshot_path IS NOT NULL\\n AND timestamp < ?1\\nORDER BY\\n device_name,\\n timestamp ASC\\nLIMIT\\n 5000\\n\" rows_affected=0 rows_returned=0 elapsed=1.714129166s\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:37:59.603705Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:40:02.174925Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n\n tip: install a starter bundle of pipes:\n screenpipe install https://screenpi.pe/start.json\n\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:42:04.809914Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n2026-05-11T22:42:16.957748Z WARN sqlx::query: summary=\"SELECT id, snapshot_path, device_name, …\" db.statement=\"\\n\\nSELECT\\n id,\\n snapshot_path,\\n device_name,\\n timestamp\\nFROM\\n frames\\nWHERE\\n snapshot_path IS NOT NULL\\n AND timestamp < ?1\\nORDER BY\\n device_name,\\n timestamp ASC\\nLIMIT\\n 5000\\n\" rows_affected=0 rows_returned=0 elapsed=1.95758825s\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:44:07.738461Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:46:10.863483Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n\n tip: sign in for higher AI quotas + cloud sync:\n screenpipe login\n\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:48:13.767660Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:50:16.132089Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n\n tip: get the screenpipe desktop app for the full experience\n https://screenpi.pe\n\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:52:18.678586Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n2026-05-11T22:52:18.727748Z WARN sqlx::query: summary=\"SELECT id, snapshot_path, device_name, …\" db.statement=\"\\n\\nSELECT\\n id,\\n snapshot_path,\\n device_name,\\n timestamp\\nFROM\\n frames\\nWHERE\\n snapshot_path IS NOT NULL\\n AND timestamp < ?1\\nORDER BY\\n device_name,\\n timestamp ASC\\nLIMIT\\n 5000\\n\" rows_affected=0 rows_returned=0 elapsed=1.378493375s\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:54:20.840336Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n2026-05-11T22:54:38.134704Z INFO screenpipe_engine::sleep_monitor: Screen unlocked (CGSession safety-net poll)\n2026-05-11T22:54:38.619890Z INFO screenpipe_audio::core::run_record_and_transcribe: screen unlocked — rebuilding stream for soundcore AeroClip (input) (avoids zombie-callback state observed after sleep/wake on macOS, Windows, and Linux)\n2026-05-11T22:54:38.630348Z WARN screenpipe_audio::audio_manager::manager: recording for device soundcore AeroClip (input) exited with error: stream rebuild required after screen unlock for soundcore AeroClip (input) (recovery is automatic via device_monitor)\n2026-05-11T22:54:38.810449Z INFO screenpipe_engine::sleep_monitor: Screen unlocked (CGSession safety-net poll)\n2026-05-11T22:54:40.719100Z WARN screenpipe_audio::audio_manager::device_monitor: [DEVICE_RECOVERY] detected stale recording handle for soundcore AeroClip (input), cleaning up for restart\n2026-05-11T22:54:40.719269Z INFO screenpipe_audio::device::device_manager: Stopping device: soundcore AeroClip (input)\n2026-05-11T22:54:41.038928Z INFO screenpipe_audio::device::device_manager: starting recording for device: soundcore AeroClip (input)\n2026-05-11T22:54:41.039052Z INFO screenpipe_audio::audio_manager::device_monitor: restarted with system default device: soundcore AeroClip (input)\n2026-05-11T22:54:41.039131Z INFO screenpipe_audio::core::run_record_and_transcribe: starting continuous recording for soundcore AeroClip (input) (bluetooth / 30s segments)\n2026-05-11T22:54:42.005620Z INFO screenpipe_engine::event_driven_capture: invalidating persistent streams after unlock/wake for monitor 1\n2026-05-11T22:54:44.076894Z INFO sck_rs::stream_manager: stopped 2 persistent stream(s)\n2026-05-11T22:54:48.213325Z WARN sqlx::query: summary=\"SELECT DISTINCT app_name, window_name, …\" db.statement=\"\\n\\nSELECT\\n DISTINCT app_name,\\n window_name,\\n browser_url\\nFROM\\n frames\\nWHERE\\n timestamp > datetime('now', '-30 seconds')\\n AND app_name IS NOT NULL\\n AND window_name IS NOT NULL\\n\" rows_affected=0 rows_returned=234 elapsed=1.275494791s\n2026-05-11T22:54:48.379801Z INFO sck_rs::stream_manager: persistent SCK stream started for display 2 (3008x1253, 2fps, 0 excluded)\nzsh: terminated npx screenpipe@latest record\nlukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/.screenpipe $ npx screenpipe@latest record\ndetected hardware tier: Mid\nwarning: parakeet is not supported on this platform, using whisper-tiny instead\n2026-05-12T09:21:07.201625Z INFO screenpipe_engine::auth_key: api auth: key resolved via secret store\nchecking permissions...\n screen recording: ok\n microphone: ok\n accessibility: ok\n2026-05-12T09:21:07.328817Z INFO screenpipe_screen::monitor::macos_version: Detected macOS version: 14.6\n2026-05-12T09:21:10.020463Z INFO screenpipe_engine::sleep_monitor: Starting macOS sleep/wake monitor\n2026-05-12T09:21:10.024711Z INFO screenpipe_engine::sleep_monitor: Screen lock/unlock observers registered (CFNotificationCenter)\n2026-05-12T09:21:10.025571Z INFO screenpipe_engine::sleep_monitor: Display reconfiguration watcher registered (CGDisplayRegisterReconfigurationCallback)\n2026-05-12T09:21:10.055207Z INFO screenpipe_engine::permission_monitor: permission monitor started screen=true mic=true accessibility=true keychain=true\n2026-05-12T09:21:10.055275Z INFO screenpipe: meeting detector enabled — independent of transcription mode\n2026-05-12T09:21:10.666779Z INFO screenpipe: API server listening on 127.0.0.1:3030 (localhost only)\n2026-05-12T09:21:10.666832Z INFO screenpipe: API auth enabled — run `screenpipe auth token` to view your key\n2026-05-12T09:21:10.666681Z INFO screenpipe_engine::power::manager: power manager started (poll interval: 10s)\n2026-05-12T09:21:10.666983Z INFO screenpipe_engine::vision_manager::manager: Starting VisionManager\n2026-05-12T09:21:10.666647Z INFO screenpipe_engine::snapshot_compaction: snapshot compaction worker started (min_age=600s, poll=300s)\n2026-05-12T09:21:10.673969Z INFO screenpipe_core::pipes: loaded pipe: day-recap\n2026-05-12T09:21:10.675449Z INFO screenpipe_core::pipes: loaded pipe: standup-update\n2026-05-12T09:21:10.676236Z INFO screenpipe_core::pipes: loaded pipe: ai-habits\n2026-05-12T09:21:10.676638Z INFO screenpipe_core::pipes: loaded pipe: time-breakdown\n2026-05-12T09:21:10.677056Z INFO screenpipe_core::pipes: loaded pipe: video-export\n2026-05-12T09:21:10.677293Z INFO screenpipe_core::pipes: loaded pipe: meeting-summary\n2026-05-12T09:21:10.677398Z INFO screenpipe_core::pipes: loaded 6 pipes from \"/Users/lukas/.screenpipe/pipes\"\n\n\n\n _ \n __________________ ___ ____ ____ (_____ ___ \n / ___/ ___/ ___/ _ \\/ _ \\/ __ \\ / __ \\/ / __ \\/ _ \\\n (__ / /__/ / / __/ __/ / / / / /_/ / / /_/ / __/\n/____/\\___/_/ \\___/\\___/_/ /_/ / .___/_/ .___/\\___/ \n /_/ /_/ \n\n\n\npower AI by everything you've seen, said or heard\nopen source | runs locally | developer friendly\n\n\n┌────────────────────────┬────────────────────────────────────┐\n│ setting │ value │\n├────────────────────────┼────────────────────────────────────┤\n│ audio chunk duration │ 30 seconds │\n│ port │ 3030 │\n│ audio disabled │ false │\n│ vision disabled │ false │\n│ pause on DRM content │ false │\n│ audio engine │ Parakeet │\n│ vad engine │ Silero │\n│ data directory │ /Users/lukas/.screenpipe │\n│ debug mode │ false │\n│ telemetry │ true │\n│ use pii removal │ true │\n│ use all monitors │ true │\n│ ignored windows │ [] │\n│ included windows │ [] │\n│ cloud sync │ disabled │\n│ auto-destruct pid │ 0 │\n│ deepgram key │ not set │\n│ api auth │ enabled │\n│ encrypt secrets │ disabled │\n│ retention days │ 14 │\n│ retention mode │ media-only (keep transcripts) │\n├────────────────────────┼────────────────────────────────────┤\n│ languages │ │\n│ │ all languages │\n├────────────────────────┼────────────────────────────────────┤\n│ monitors │ │\n│ │ id: 1 │\n│ │ id: 2 │\n├────────────────────────┼────────────────────────────────────┤\n│ audio devices │ │\n│ │ MacBook Pro Microphone (input) │\n│ │ System Audio (output) │\n└────────────────────────┴────────────────────────────────────┘\nyou are using local processing. all your data stays on your computer.\n\nwarning: telemetry is enabled. only error-level data will be sent.\nto disable, use the --disable-telemetry flag.\n\ncheck latest changes here: https://github.com/screenpipe/screenpipe/releases\n2026-05-12T09:21:10.684547Z INFO screenpipe_core::pipes: pipe scheduler started (generation 2)\n2026-05-12T09:21:10.686111Z INFO screenpipe: starting UI event capture\n2026-05-12T09:21:10.696691Z WARN screenpipe: pi agent install failed: bun not found — install from https://bun.sh\n2026-05-12T09:21:10.705742Z INFO screenpipe_engine::power::manager: initial power profile: Performance (on_ac=true, battery=Some(100))\n2026-05-12T09:21:10.712331Z INFO screenpipe_engine::ui_recorder: Starting UI event capture\n2026-05-12T09:21:10.753596Z INFO screenpipe_engine::ui_recorder: UI recording session started: eee53fe6-52d6-4c4e-a7e5-11ede410f444\n2026-05-12T09:21:10.753638Z INFO screenpipe_engine::calendar_speaker_id: speaker identification: started (user_name=<not set>)\n2026-05-12T09:21:10.753679Z INFO screenpipe_engine::hot_frame_cache: hot_frame_cache: warming from DB (2026-05-11 06:21:10.753677 UTC to 2026-05-12 06:21:10.753677 UTC)\n2026-05-12T09:21:10.754945Z INFO screenpipe_engine::meeting_detector: meeting v2: detection loop started (base_interval=5s, profiles=12)\n2026-05-12T09:21:10.764596Z INFO screenpipe_engine::server: Server listening on 127.0.0.1:3030\n2026-05-12T09:21:10.771437Z INFO screenpipe_connect::mdns: mdns: advertising screenpipe on port 3030\n2026-05-12T09:21:15.451981Z WARN sqlx::query: summary=\"SELECT f.id, f.timestamp, f.offset_index, …\" db.statement=\"\\n\\nSELECT\\n f.id,\\n f.timestamp,\\n f.offset_index,\\n COALESCE(\\n SUBSTR(f.full_text, 1, 200),\\n SUBSTR(f.accessibility_text, 1, 200),\\n (\\n SELECT\\n SUBSTR(ot.text, 1, 200)\\n FROM\\n ocr_text ot\\n WHERE\\n ot.frame_id = f.id\\n LIMIT\\n 1\\n )\\n ) as text,\\n COALESCE(\\n f.app_name,\\n (\\n SELECT\\n ot.app_name\\n FROM\\n ocr_text ot\\n WHERE\\n ot.frame_id = f.id\\n LIMIT\\n 1\\n )\\n ) as app_name,\\n COALESCE(\\n f.window_name,\\n (\\n SELECT\\n ot.window_name\\n FROM\\n ocr_text ot\\n WHERE\\n ot.frame_id = f.id\\n LIMIT\\n 1\\n )\\n ) as window_name,\\n COALESCE(vc.device_name, f.device_name) as screen_device,\\n COALESCE(vc.file_path, f.snapshot_path) as video_path,\\n COALESCE(vc.fps, 0.033) as chunk_fps,\\n f.browser_url,\\n f.machine_id\\nFROM\\n frames f\\n LEFT JOIN video_chunks vc ON f.video_chunk_id = vc.id\\nWHERE\\n f.timestamp >= ?1\\n AND f.timestamp <= ?2\\n AND COALESCE(vc.file_path, f.snapshot_path, '') NOT LIKE 'cloud://%'\\nORDER BY\\n f.timestamp DESC,\\n f.offset_index DESC\\nLIMIT\\n 10000\\n\" rows_affected=0 rows_returned=6633 elapsed=4.697616625s\n2026-05-12T09:21:15.476188Z INFO screenpipe_engine::hot_frame_cache: hot_frame_cache: warmed with 6633 frame entries, coverage from 2026-05-11 06:21:10.753677 UTC\n2026-05-12T09:21:16.549935Z INFO screenpipe_engine::vision_manager::manager: Starting vision recording for monitor 1 (1440x900)\n2026-05-12T09:21:16.550139Z INFO screenpipe_engine::vision_manager::manager: Starting event-driven capture for monitor 1 (device: monitor_1)\n2026-05-12T09:21:16.550184Z INFO screenpipe_engine::event_driven_capture: event-driven capture started for monitor 1 (device: monitor_1)\n2026-05-12T09:21:19.459497Z INFO screenpipe_engine::vision_manager::manager: Starting vision recording for monitor 2 (3008x1253)\n2026-05-12T09:21:19.463986Z INFO screenpipe_engine::vision_manager::manager: Starting event-driven capture for monitor 2 (device: monitor_2)\n2026-05-12T09:21:19.465573Z INFO screenpipe_engine::vision_manager::manager: VisionManager started with 2/2 monitor(s)\n2026-05-12T09:21:19.467110Z INFO screenpipe_engine::vision_manager::monitor_watcher: Starting monitor watcher (event-driven via CGDisplayRegisterReconfigurationCallback, 60s backstop poll)\n2026-05-12T09:21:19.468420Z INFO screenpipe_engine::event_driven_capture: event-driven capture started for monitor 2 (device: monitor_2)\n2026-05-12T09:21:20.691544Z INFO screenpipe_audio::transcription::engine: whisper model available: \"/Users/lukas/.cache/huggingface/hub/models--ggerganov--whisper.cpp/snapshots/5359861c739e955e79d9a303bcbc70fb988958b1/ggml-tiny.bin\"\n2026-05-12T09:21:20.692520Z INFO screenpipe_audio::transcription::whisper::model: whisper context: gpu acceleration enabled (Metal on macOS, Vulkan on Windows)\n2026-05-12T09:21:20.692565Z INFO screenpipe_audio::transcription::engine: loading whisper model with GPU acceleration...\nwhisper_init_from_file_with_params_no_state: loading model from '/Users/lukas/.cache/huggingface/hub/models--ggerganov--whisper.cpp/snapshots/5359861c739e955e79d9a303bcbc70fb988958b1/ggml-tiny.bin'\nwhisper_init_with_params_no_state: use gpu = 1\nwhisper_init_with_params_no_state: flash attn = 0\nwhisper_init_with_params_no_state: gpu_device = 0\nwhisper_init_with_params_no_state: dtw = 0\nggml_metal_device_init: tensor API disabled for pre-M5 and pre-A19 devices\nggml_metal_library_init: using embedded metal library\nggml_metal_library_init: loaded in 0.036 sec\nggml_metal_rsets_init: creating a residency set collection (keep_alive = 180 s)\nggml_metal_device_init: GPU name: Apple M1\nggml_metal_device_init: GPU family: MTLGPUFamilyApple7 (1007)\nggml_metal_device_init: GPU family: MTLGPUFamilyCommon3 (3003)\nggml_metal_device_init: GPU family: MTLGPUFamilyMetal3 (5001)\nggml_metal_device_init: simdgroup reduction = true\nggml_metal_device_init: simdgroup matrix mul. = true\nggml_metal_device_init: has unified memory = true\nggml_metal_device_init: has bfloat = true\nggml_metal_device_init: has tensor = false\nggml_metal_device_init: use residency sets = true\nggml_metal_device_init: use shared buffers = true\nggml_metal_device_init: recommendedMaxWorkingSetSize = 11453.25 MB\nwhisper_init_with_params_no_state: devices = 3\nwhisper_init_with_params_no_state: backends = 3\nwhisper_model_load: loading model\nwhisper_model_load: n_vocab = 51865\nwhisper_model_load: n_audio_ctx = 1500\nwhisper_model_load: n_audio_state = 384\nwhisper_model_load: n_audio_head = 6\nwhisper_model_load: n_audio_layer = 4\nwhisper_model_load: n_text_ctx = 448\nwhisper_model_load: n_text_state = 384\nwhisper_model_load: n_text_head = 6\nwhisper_model_load: n_text_layer = 4\nwhisper_model_load: n_mels = 80\nwhisper_model_load: ftype = 1\nwhisper_model_load: qntvr = 0\nwhisper_model_load: type = 1 (tiny)\nwhisper_model_load: adding 1608 extra tokens\nwhisper_model_load: n_langs = 99\nwhisper_model_load: Metal total size = 77.11 MB\nwhisper_model_load: model size = 77.11 MB\n2026-05-12T09:21:20.866406Z INFO screenpipe_audio::transcription::engine: whisper model loaded successfully\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\n2026-05-12T09:21:20.896976Z INFO screenpipe_audio::audio_manager::manager: transcription session created (will be reused across segments)\n2026-05-12T09:21:20.928794Z INFO screenpipe_audio::audio_manager::manager: seeded 14 speakers (named + unnamed) from DB into embedding manager\n2026-05-12T09:21:20.929372Z INFO screenpipe_audio::audio_manager::manager: audio manager started\n2026-05-12T09:21:20.930136Z INFO screenpipe_audio::audio_manager::manager: calendar-assisted speaker diarization: listening for meeting events\n2026-05-12T09:21:21.212480Z INFO screenpipe_audio::device::device_manager: starting recording for device: MacBook Pro Microphone (input)\n2026-05-12T09:21:22.112224Z INFO sck_rs::stream_manager: persistent SCK stream started for display 1 (1440x900, 2fps, 0 excluded)","depth":4,"on_screen":true,"value":"ggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:27:49.369341Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:29:51.512607Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n\n tip: get the screenpipe desktop app for the full experience\n https://screenpi.pe\n\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:31:53.426255Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:33:55.437876Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:35:57.413206Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n\n tip: wire screenpipe into claude with one command:\n claude mcp add screenpipe -- npx -y screenpipe-mcp\n then ask claude to build a pipe that tracks who you are, your todos, and how you spend your time from your screen activity\n\n2026-05-11T22:37:14.870936Z WARN sqlx::query: summary=\"SELECT id, snapshot_path, device_name, …\" db.statement=\"\\n\\nSELECT\\n id,\\n snapshot_path,\\n device_name,\\n timestamp\\nFROM\\n frames\\nWHERE\\n snapshot_path IS NOT NULL\\n AND timestamp < ?1\\nORDER BY\\n device_name,\\n timestamp ASC\\nLIMIT\\n 5000\\n\" rows_affected=0 rows_returned=0 elapsed=1.714129166s\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:37:59.603705Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:40:02.174925Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n\n tip: install a starter bundle of pipes:\n screenpipe install https://screenpi.pe/start.json\n\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:42:04.809914Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n2026-05-11T22:42:16.957748Z WARN sqlx::query: summary=\"SELECT id, snapshot_path, device_name, …\" db.statement=\"\\n\\nSELECT\\n id,\\n snapshot_path,\\n device_name,\\n timestamp\\nFROM\\n frames\\nWHERE\\n snapshot_path IS NOT NULL\\n AND timestamp < ?1\\nORDER BY\\n device_name,\\n timestamp ASC\\nLIMIT\\n 5000\\n\" rows_affected=0 rows_returned=0 elapsed=1.95758825s\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:44:07.738461Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:46:10.863483Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n\n tip: sign in for higher AI quotas + cloud sync:\n screenpipe login\n\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:48:13.767660Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:50:16.132089Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n\n tip: get the screenpipe desktop app for the full experience\n https://screenpi.pe\n\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:52:18.678586Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n2026-05-11T22:52:18.727748Z WARN sqlx::query: summary=\"SELECT id, snapshot_path, device_name, …\" db.statement=\"\\n\\nSELECT\\n id,\\n snapshot_path,\\n device_name,\\n timestamp\\nFROM\\n frames\\nWHERE\\n snapshot_path IS NOT NULL\\n AND timestamp < ?1\\nORDER BY\\n device_name,\\n timestamp ASC\\nLIMIT\\n 5000\\n\" rows_affected=0 rows_returned=0 elapsed=1.378493375s\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\nggml_metal_free: deallocating\n2026-05-11T22:54:20.840336Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks\n2026-05-11T22:54:38.134704Z INFO screenpipe_engine::sleep_monitor: Screen unlocked (CGSession safety-net poll)\n2026-05-11T22:54:38.619890Z INFO screenpipe_audio::core::run_record_and_transcribe: screen unlocked — rebuilding stream for soundcore AeroClip (input) (avoids zombie-callback state observed after sleep/wake on macOS, Windows, and Linux)\n2026-05-11T22:54:38.630348Z WARN screenpipe_audio::audio_manager::manager: recording for device soundcore AeroClip (input) exited with error: stream rebuild required after screen unlock for soundcore AeroClip (input) (recovery is automatic via device_monitor)\n2026-05-11T22:54:38.810449Z INFO screenpipe_engine::sleep_monitor: Screen unlocked (CGSession safety-net poll)\n2026-05-11T22:54:40.719100Z WARN screenpipe_audio::audio_manager::device_monitor: [DEVICE_RECOVERY] detected stale recording handle for soundcore AeroClip (input), cleaning up for restart\n2026-05-11T22:54:40.719269Z INFO screenpipe_audio::device::device_manager: Stopping device: soundcore AeroClip (input)\n2026-05-11T22:54:41.038928Z INFO screenpipe_audio::device::device_manager: starting recording for device: soundcore AeroClip (input)\n2026-05-11T22:54:41.039052Z INFO screenpipe_audio::audio_manager::device_monitor: restarted with system default device: soundcore AeroClip (input)\n2026-05-11T22:54:41.039131Z INFO screenpipe_audio::core::run_record_and_transcribe: starting continuous recording for soundcore AeroClip (input) (bluetooth / 30s segments)\n2026-05-11T22:54:42.005620Z INFO screenpipe_engine::event_driven_capture: invalidating persistent streams after unlock/wake for monitor 1\n2026-05-11T22:54:44.076894Z INFO sck_rs::stream_manager: stopped 2 persistent stream(s)\n2026-05-11T22:54:48.213325Z WARN sqlx::query: summary=\"SELECT DISTINCT app_name, window_name, …\" db.statement=\"\\n\\nSELECT\\n DISTINCT app_name,\\n window_name,\\n browser_url\\nFROM\\n frames\\nWHERE\\n timestamp > datetime('now', '-30 seconds')\\n AND app_name IS NOT NULL\\n AND window_name IS NOT NULL\\n\" rows_affected=0 rows_returned=234 elapsed=1.275494791s\n2026-05-11T22:54:48.379801Z INFO sck_rs::stream_manager: persistent SCK stream started for display 2 (3008x1253, 2fps, 0 excluded)\nzsh: terminated npx screenpipe@latest record\nlukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/.screenpipe $ npx screenpipe@latest record\ndetected hardware tier: Mid\nwarning: parakeet is not supported on this platform, using whisper-tiny instead\n2026-05-12T09:21:07.201625Z INFO screenpipe_engine::auth_key: api auth: key resolved via secret store\nchecking permissions...\n screen recording: ok\n microphone: ok\n accessibility: ok\n2026-05-12T09:21:07.328817Z INFO screenpipe_screen::monitor::macos_version: Detected macOS version: 14.6\n2026-05-12T09:21:10.020463Z INFO screenpipe_engine::sleep_monitor: Starting macOS sleep/wake monitor\n2026-05-12T09:21:10.024711Z INFO screenpipe_engine::sleep_monitor: Screen lock/unlock observers registered (CFNotificationCenter)\n2026-05-12T09:21:10.025571Z INFO screenpipe_engine::sleep_monitor: Display reconfiguration watcher registered (CGDisplayRegisterReconfigurationCallback)\n2026-05-12T09:21:10.055207Z INFO screenpipe_engine::permission_monitor: permission monitor started screen=true mic=true accessibility=true keychain=true\n2026-05-12T09:21:10.055275Z INFO screenpipe: meeting detector enabled — independent of transcription mode\n2026-05-12T09:21:10.666779Z INFO screenpipe: API server listening on 127.0.0.1:3030 (localhost only)\n2026-05-12T09:21:10.666832Z INFO screenpipe: API auth enabled — run `screenpipe auth token` to view your key\n2026-05-12T09:21:10.666681Z INFO screenpipe_engine::power::manager: power manager started (poll interval: 10s)\n2026-05-12T09:21:10.666983Z INFO screenpipe_engine::vision_manager::manager: Starting VisionManager\n2026-05-12T09:21:10.666647Z INFO screenpipe_engine::snapshot_compaction: snapshot compaction worker started (min_age=600s, poll=300s)\n2026-05-12T09:21:10.673969Z INFO screenpipe_core::pipes: loaded pipe: day-recap\n2026-05-12T09:21:10.675449Z INFO screenpipe_core::pipes: loaded pipe: standup-update\n2026-05-12T09:21:10.676236Z INFO screenpipe_core::pipes: loaded pipe: ai-habits\n2026-05-12T09:21:10.676638Z INFO screenpipe_core::pipes: loaded pipe: time-breakdown\n2026-05-12T09:21:10.677056Z INFO screenpipe_core::pipes: loaded pipe: video-export\n2026-05-12T09:21:10.677293Z INFO screenpipe_core::pipes: loaded pipe: meeting-summary\n2026-05-12T09:21:10.677398Z INFO screenpipe_core::pipes: loaded 6 pipes from \"/Users/lukas/.screenpipe/pipes\"\n\n\n\n _ \n __________________ ___ ____ ____ (_____ ___ \n / ___/ ___/ ___/ _ \\/ _ \\/ __ \\ / __ \\/ / __ \\/ _ \\\n (__ / /__/ / / __/ __/ / / / / /_/ / / /_/ / __/\n/____/\\___/_/ \\___/\\___/_/ /_/ / .___/_/ .___/\\___/ \n /_/ /_/ \n\n\n\npower AI by everything you've seen, said or heard\nopen source | runs locally | developer friendly\n\n\n┌────────────────────────┬────────────────────────────────────┐\n│ setting │ value │\n├────────────────────────┼────────────────────────────────────┤\n│ audio chunk duration │ 30 seconds │\n│ port │ 3030 │\n│ audio disabled │ false │\n│ vision disabled │ false │\n│ pause on DRM content │ false │\n│ audio engine │ Parakeet │\n│ vad engine │ Silero │\n│ data directory │ /Users/lukas/.screenpipe │\n│ debug mode │ false │\n│ telemetry │ true │\n│ use pii removal │ true │\n│ use all monitors │ true │\n│ ignored windows │ [] │\n│ included windows │ [] │\n│ cloud sync │ disabled │\n│ auto-destruct pid │ 0 │\n│ deepgram key │ not set │\n│ api auth │ enabled │\n│ encrypt secrets │ disabled │\n│ retention days │ 14 │\n│ retention mode │ media-only (keep transcripts) │\n├────────────────────────┼────────────────────────────────────┤\n│ languages │ │\n│ │ all languages │\n├────────────────────────┼────────────────────────────────────┤\n│ monitors │ │\n│ │ id: 1 │\n│ │ id: 2 │\n├────────────────────────┼────────────────────────────────────┤\n│ audio devices │ │\n│ │ MacBook Pro Microphone (input) │\n│ │ System Audio (output) │\n└────────────────────────┴────────────────────────────────────┘\nyou are using local processing. all your data stays on your computer.\n\nwarning: telemetry is enabled. only error-level data will be sent.\nto disable, use the --disable-telemetry flag.\n\ncheck latest changes here: https://github.com/screenpipe/screenpipe/releases\n2026-05-12T09:21:10.684547Z INFO screenpipe_core::pipes: pipe scheduler started (generation 2)\n2026-05-12T09:21:10.686111Z INFO screenpipe: starting UI event capture\n2026-05-12T09:21:10.696691Z WARN screenpipe: pi agent install failed: bun not found — install from https://bun.sh\n2026-05-12T09:21:10.705742Z INFO screenpipe_engine::power::manager: initial power profile: Performance (on_ac=true, battery=Some(100))\n2026-05-12T09:21:10.712331Z INFO screenpipe_engine::ui_recorder: Starting UI event capture\n2026-05-12T09:21:10.753596Z INFO screenpipe_engine::ui_recorder: UI recording session started: eee53fe6-52d6-4c4e-a7e5-11ede410f444\n2026-05-12T09:21:10.753638Z INFO screenpipe_engine::calendar_speaker_id: speaker identification: started (user_name=<not set>)\n2026-05-12T09:21:10.753679Z INFO screenpipe_engine::hot_frame_cache: hot_frame_cache: warming from DB (2026-05-11 06:21:10.753677 UTC to 2026-05-12 06:21:10.753677 UTC)\n2026-05-12T09:21:10.754945Z INFO screenpipe_engine::meeting_detector: meeting v2: detection loop started (base_interval=5s, profiles=12)\n2026-05-12T09:21:10.764596Z INFO screenpipe_engine::server: Server listening on 127.0.0.1:3030\n2026-05-12T09:21:10.771437Z INFO screenpipe_connect::mdns: mdns: advertising screenpipe on port 3030\n2026-05-12T09:21:15.451981Z WARN sqlx::query: summary=\"SELECT f.id, f.timestamp, f.offset_index, …\" db.statement=\"\\n\\nSELECT\\n f.id,\\n f.timestamp,\\n f.offset_index,\\n COALESCE(\\n SUBSTR(f.full_text, 1, 200),\\n SUBSTR(f.accessibility_text, 1, 200),\\n (\\n SELECT\\n SUBSTR(ot.text, 1, 200)\\n FROM\\n ocr_text ot\\n WHERE\\n ot.frame_id = f.id\\n LIMIT\\n 1\\n )\\n ) as text,\\n COALESCE(\\n f.app_name,\\n (\\n SELECT\\n ot.app_name\\n FROM\\n ocr_text ot\\n WHERE\\n ot.frame_id = f.id\\n LIMIT\\n 1\\n )\\n ) as app_name,\\n COALESCE(\\n f.window_name,\\n (\\n SELECT\\n ot.window_name\\n FROM\\n ocr_text ot\\n WHERE\\n ot.frame_id = f.id\\n LIMIT\\n 1\\n )\\n ) as window_name,\\n COALESCE(vc.device_name, f.device_name) as screen_device,\\n COALESCE(vc.file_path, f.snapshot_path) as video_path,\\n COALESCE(vc.fps, 0.033) as chunk_fps,\\n f.browser_url,\\n f.machine_id\\nFROM\\n frames f\\n LEFT JOIN video_chunks vc ON f.video_chunk_id = vc.id\\nWHERE\\n f.timestamp >= ?1\\n AND f.timestamp <= ?2\\n AND COALESCE(vc.file_path, f.snapshot_path, '') NOT LIKE 'cloud://%'\\nORDER BY\\n f.timestamp DESC,\\n f.offset_index DESC\\nLIMIT\\n 10000\\n\" rows_affected=0 rows_returned=6633 elapsed=4.697616625s\n2026-05-12T09:21:15.476188Z INFO screenpipe_engine::hot_frame_cache: hot_frame_cache: warmed with 6633 frame entries, coverage from 2026-05-11 06:21:10.753677 UTC\n2026-05-12T09:21:16.549935Z INFO screenpipe_engine::vision_manager::manager: Starting vision recording for monitor 1 (1440x900)\n2026-05-12T09:21:16.550139Z INFO screenpipe_engine::vision_manager::manager: Starting event-driven capture for monitor 1 (device: monitor_1)\n2026-05-12T09:21:16.550184Z INFO screenpipe_engine::event_driven_capture: event-driven capture started for monitor 1 (device: monitor_1)\n2026-05-12T09:21:19.459497Z INFO screenpipe_engine::vision_manager::manager: Starting vision recording for monitor 2 (3008x1253)\n2026-05-12T09:21:19.463986Z INFO screenpipe_engine::vision_manager::manager: Starting event-driven capture for monitor 2 (device: monitor_2)\n2026-05-12T09:21:19.465573Z INFO screenpipe_engine::vision_manager::manager: VisionManager started with 2/2 monitor(s)\n2026-05-12T09:21:19.467110Z INFO screenpipe_engine::vision_manager::monitor_watcher: Starting monitor watcher (event-driven via CGDisplayRegisterReconfigurationCallback, 60s backstop poll)\n2026-05-12T09:21:19.468420Z INFO screenpipe_engine::event_driven_capture: event-driven capture started for monitor 2 (device: monitor_2)\n2026-05-12T09:21:20.691544Z INFO screenpipe_audio::transcription::engine: whisper model available: \"/Users/lukas/.cache/huggingface/hub/models--ggerganov--whisper.cpp/snapshots/5359861c739e955e79d9a303bcbc70fb988958b1/ggml-tiny.bin\"\n2026-05-12T09:21:20.692520Z INFO screenpipe_audio::transcription::whisper::model: whisper context: gpu acceleration enabled (Metal on macOS, Vulkan on Windows)\n2026-05-12T09:21:20.692565Z INFO screenpipe_audio::transcription::engine: loading whisper model with GPU acceleration...\nwhisper_init_from_file_with_params_no_state: loading model from '/Users/lukas/.cache/huggingface/hub/models--ggerganov--whisper.cpp/snapshots/5359861c739e955e79d9a303bcbc70fb988958b1/ggml-tiny.bin'\nwhisper_init_with_params_no_state: use gpu = 1\nwhisper_init_with_params_no_state: flash attn = 0\nwhisper_init_with_params_no_state: gpu_device = 0\nwhisper_init_with_params_no_state: dtw = 0\nggml_metal_device_init: tensor API disabled for pre-M5 and pre-A19 devices\nggml_metal_library_init: using embedded metal library\nggml_metal_library_init: loaded in 0.036 sec\nggml_metal_rsets_init: creating a residency set collection (keep_alive = 180 s)\nggml_metal_device_init: GPU name: Apple M1\nggml_metal_device_init: GPU family: MTLGPUFamilyApple7 (1007)\nggml_metal_device_init: GPU family: MTLGPUFamilyCommon3 (3003)\nggml_metal_device_init: GPU family: MTLGPUFamilyMetal3 (5001)\nggml_metal_device_init: simdgroup reduction = true\nggml_metal_device_init: simdgroup matrix mul. = true\nggml_metal_device_init: has unified memory = true\nggml_metal_device_init: has bfloat = true\nggml_metal_device_init: has tensor = false\nggml_metal_device_init: use residency sets = true\nggml_metal_device_init: use shared buffers = true\nggml_metal_device_init: recommendedMaxWorkingSetSize = 11453.25 MB\nwhisper_init_with_params_no_state: devices = 3\nwhisper_init_with_params_no_state: backends = 3\nwhisper_model_load: loading model\nwhisper_model_load: n_vocab = 51865\nwhisper_model_load: n_audio_ctx = 1500\nwhisper_model_load: n_audio_state = 384\nwhisper_model_load: n_audio_head = 6\nwhisper_model_load: n_audio_layer = 4\nwhisper_model_load: n_text_ctx = 448\nwhisper_model_load: n_text_state = 384\nwhisper_model_load: n_text_head = 6\nwhisper_model_load: n_text_layer = 4\nwhisper_model_load: n_mels = 80\nwhisper_model_load: ftype = 1\nwhisper_model_load: qntvr = 0\nwhisper_model_load: type = 1 (tiny)\nwhisper_model_load: adding 1608 extra tokens\nwhisper_model_load: n_langs = 99\nwhisper_model_load: Metal total size = 77.11 MB\nwhisper_model_load: model size = 77.11 MB\n2026-05-12T09:21:20.866406Z INFO screenpipe_audio::transcription::engine: whisper model loaded successfully\nwhisper_backend_init_gpu: device 0: Metal (type: 1)\nwhisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)\nwhisper_backend_init_gpu: using Metal backend\nggml_metal_init: allocating\nggml_metal_init: found device: Apple M1\nggml_metal_init: picking default device: Apple M1\nggml_metal_init: use fusion = true\nggml_metal_init: use concurrency = true\nggml_metal_init: use graph optimize = true\nwhisper_backend_init: using BLAS backend\nwhisper_init_state: kv self size = 3.15 MB\nwhisper_init_state: kv cross size = 9.44 MB\nwhisper_init_state: kv pad size = 2.36 MB\nwhisper_init_state: compute buffer (conv) = 14.17 MB\nwhisper_init_state: compute buffer (encode) = 65.96 MB\nwhisper_init_state: compute buffer (cross) = 8.50 MB\nwhisper_init_state: compute buffer (decode) = 96.83 MB\n2026-05-12T09:21:20.896976Z INFO screenpipe_audio::audio_manager::manager: transcription session created (will be reused across segments)\n2026-05-12T09:21:20.928794Z INFO screenpipe_audio::audio_manager::manager: seeded 14 speakers (named + unnamed) from DB into embedding manager\n2026-05-12T09:21:20.929372Z INFO screenpipe_audio::audio_manager::manager: audio manager started\n2026-05-12T09:21:20.930136Z INFO screenpipe_audio::audio_manager::manager: calendar-assisted speaker diarization: listening for meeting events\n2026-05-12T09:21:21.212480Z INFO screenpipe_audio::device::device_manager: starting recording for device: MacBook Pro Microphone (input)\n2026-05-12T09:21:22.112224Z INFO sck_rs::stream_manager: persistent SCK stream started for display 1 (1440x900, 2fps, 0 excluded)","is_focused":true},{"role":"AXRadioButton","text":"DOCKER","depth":2,"bounds":{"left":0.0,"top":0.05888889,"width":0.140625,"height":0.026666667},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.004166667,"top":0.06333333,"width":0.011111111,"height":0.017777778},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"DEV (-zsh)","depth":2,"bounds":{"left":0.140625,"top":0.05888889,"width":0.140625,"height":0.026666667},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.14479166,"top":0.06333333,"width":0.011111111,"height":0.017777778},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"APP (-zsh)","depth":2,"bounds":{"left":0.28125,"top":0.05888889,"width":0.140625,"height":0.026666667},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.28541666,"top":0.06333333,"width":0.011111111,"height":0.017777778},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"-zsh","depth":2,"bounds":{"left":0.421875,"top":0.05888889,"width":0.140625,"height":0.026666667},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.42604166,"top":0.06333333,"width":0.011111111,"height":0.017777778},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"-zsh","depth":2,"bounds":{"left":0.5625,"top":0.05888889,"width":0.14027777,"height":0.026666667},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.56666666,"top":0.06333333,"width":0.011111111,"height":0.017777778},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"screenpipe\"","depth":2,"bounds":{"left":0.7027778,"top":0.05888889,"width":0.14027777,"height":0.026666667},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.70694447,"top":0.06333333,"width":0.011111111,"height":0.017777778},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"-zsh","depth":2,"bounds":{"left":0.84305555,"top":0.05888889,"width":0.14027777,"height":0.026666667},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.8472222,"top":0.06333333,"width":0.011111111,"height":0.017777778},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"⌥⌘1","depth":1,"bounds":{"left":0.9548611,"top":0.032222223,"width":0.03888889,"height":0.018888889},"on_screen":true,"automation_id":"_NS:8","role_description":"text"},{"role":"AXStaticText","text":"screenpipe\"","depth":1,"bounds":{"left":0.47083333,"top":0.033333335,"width":0.058333334,"height":0.017777778},"on_screen":true,"role_description":"text"}]...
|
-8051471798226442119
|
-852231715036531232
|
manual
|
accessibility
|
NULL
|
ggml_metal_init: allocating
ggml_metal_init: found ggml_metal_init: allocating
ggml_metal_init: found device: Apple M1
ggml_metal_init: picking default device: Apple M1
ggml_metal_init: use fusion = true
ggml_metal_init: use concurrency = true
ggml_metal_init: use graph optimize = true
whisper_backend_init: using BLAS backend
whisper_init_state: kv self size = 3.15 MB
whisper_init_state: kv cross size = 9.44 MB
whisper_init_state: kv pad size = 2.36 MB
whisper_init_state: compute buffer (conv) = 14.17 MB
whisper_init_state: compute buffer (encode) = 65.96 MB
whisper_init_state: compute buffer (cross) = 8.50 MB
whisper_init_state: compute buffer (decode) = 96.83 MB
ggml_metal_free: deallocating
whisper_backend_init_gpu: device 0: Metal (type: 1)
whisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)
whisper_backend_init_gpu: using Metal backend
ggml_metal_init: allocating
ggml_metal_init: found device: Apple M1
ggml_metal_init: picking default device: Apple M1
ggml_metal_init: use fusion = true
ggml_metal_init: use concurrency = true
ggml_metal_init: use graph optimize = true
whisper_backend_init: using BLAS backend
whisper_init_state: kv self size = 3.15 MB
whisper_init_state: kv cross size = 9.44 MB
whisper_init_state: kv pad size = 2.36 MB
whisper_init_state: compute buffer (conv) = 14.17 MB
whisper_init_state: compute buffer (encode) = 65.96 MB
whisper_init_state: compute buffer (cross) = 8.50 MB
whisper_init_state: compute buffer (decode) = 96.83 MB
ggml_metal_free: deallocating
whisper_backend_init_gpu: device 0: Metal (type: 1)
whisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)
whisper_backend_init_gpu: using Metal backend
ggml_metal_init: allocating
ggml_metal_init: found device: Apple M1
ggml_metal_init: picking default device: Apple M1
ggml_metal_init: use fusion = true
ggml_metal_init: use concurrency = true
ggml_metal_init: use graph optimize = true
whisper_backend_init: using BLAS backend
whisper_init_state: kv self size = 3.15 MB
whisper_init_state: kv cross size = 9.44 MB
whisper_init_state: kv pad size = 2.36 MB
whisper_init_state: compute buffer (conv) = 14.17 MB
whisper_init_state: compute buffer (encode) = 65.96 MB
whisper_init_state: compute buffer (cross) = 8.50 MB
whisper_init_state: compute buffer (decode) = 96.83 MB
ggml_metal_free: deallocating
2026-05-11T22:27:49.369341Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks
whisper_backend_init_gpu: device 0: Metal (type: 1)
whisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)
whisper_backend_init_gpu: using Metal backend
ggml_metal_init: allocating
ggml_metal_init: found device: Apple M1
ggml_metal_init: picking default device: Apple M1
ggml_metal_init: use fusion = true
ggml_metal_init: use concurrency = true
ggml_metal_init: use graph optimize = true
whisper_backend_init: using BLAS backend
whisper_init_state: kv self size = 3.15 MB
whisper_init_state: kv cross size = 9.44 MB
whisper_init_state: kv pad size = 2.36 MB
whisper_init_state: compute buffer (conv) = 14.17 MB
whisper_init_state: compute buffer (encode) = 65.96 MB
whisper_init_state: compute buffer (cross) = 8.50 MB
whisper_init_state: compute buffer (decode) = 96.83 MB
ggml_metal_free: deallocating
whisper_backend_init_gpu: device 0: Metal (type: 1)
whisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)
whisper_backend_init_gpu: using Metal backend
ggml_metal_init: allocating
ggml_metal_init: found device: Apple M1
ggml_metal_init: picking default device: Apple M1
ggml_metal_init: use fusion = true
ggml_metal_init: use concurrency = true
ggml_metal_init: use graph optimize = true
whisper_backend_init: using BLAS backend
whisper_init_state: kv self size = 3.15 MB
whisper_init_state: kv cross size = 9.44 MB
whisper_init_state: kv pad size = 2.36 MB
whisper_init_state: compute buffer (conv) = 14.17 MB
whisper_init_state: compute buffer (encode) = 65.96 MB
whisper_init_state: compute buffer (cross) = 8.50 MB
whisper_init_state: compute buffer (decode) = 96.83 MB
ggml_metal_free: deallocating
whisper_backend_init_gpu: device 0: Metal (type: 1)
whisper_backend_init_gpu: found GPU device 0: Metal (type: 1, cnt: 0)
whisper_backend_init_gpu: using Metal backend
ggml_metal_init: allocating
ggml_metal_init: found device: Apple M1
ggml_metal_init: picking default device: Apple M1
ggml_metal_init: use fusion = true
ggml_metal_init: use concurrency = true
ggml_metal_init: use graph optimize = true
whisper_backend_init: using BLAS backend
whisper_init_state: kv self size = 3.15 MB
whisper_init_state: kv cross size = 9.44 MB
whisper_init_state: kv pad size = 2.36 MB
whisper_init_state: compute buffer (conv) = 14.17 MB
whisper_init_state: compute buffer (encode) = 65.96 MB
whisper_init_state: compute buffer (cross) = 8.50 MB
whisper_init_state: compute buffer (decode) = 96.83 MB
ggml_metal_free: deallocating
2026-05-11T22:29:51.512607Z INFO screenpipe_audio::audio_manager::manager: reconciliation: transcribed 50 orphaned chunks
tip: get the screenpipe desktop app for the full experience
[URL_WITH_CREDENTIALS] record
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/.screenpipe $ npx screenpipe@latest record
detected hardware tier: Mid
warning: parakeet is not supported on this platform, using whisper-tiny instead
2026-05-12T09:21:07.201625Z INFO screenpipe_engine::auth_key: api auth: key resolved via secret store
checking permissions...
screen recording: ok
microphone: ok
accessibility: ok
2026-05-12T09:21:07.328817Z INFO screenpipe_screen::monitor::macos_version: Detected macOS version: 14.6
2026-05-12T09:21:10.020463Z INFO screenpipe_engine::sleep_monitor: Starting macOS sleep/wake monitor
2026-05-12T09:21:10.024711Z INFO screenpipe_engine::sleep_monitor: Screen lock/unlock observers registered (CFNotificationCenter)
2026-05-12T09:21:10.025571Z INFO screenpipe_engine::sleep_monitor: Display reconfiguration watcher registered (CGDisplayRegisterReconfigurationCallback)
2026-05-12T09:21:10.055207Z INFO screenpipe_engine::permission_monitor: permission monitor started screen=true mic=true accessibility=true keychain=true
2026-05-12T09:21:10.055275Z INFO screenpipe: meeting detector enabled — independent of transcription mode
2026-05-12T09:21:10.666779Z INFO screenpipe: API server listening on [IP_ADDRESS]:3030 (localhost only)
2026-05-12T09:21:10.666832Z INFO screenpipe: API auth enabled — run `screenpipe auth token` to view your key
2026-05-12T09:21:10.666681Z INFO screenpipe_engine::power::manager: power manager started (poll interval: 10s)
2026-05-12T09:21:10.666983Z INFO screenpipe_engine::vision_manager::manager: Starting VisionManager
2026-05-12T09:21:10.666647Z INFO screenpipe_engine::snapshot_compaction: snapshot compaction worker started (min_age=600s, poll=300s)
2026-05-12T09:21:10.673969Z INFO screenpipe_core::pipes: loaded pipe: day-recap
2026-05-12T09:21:10.675449Z INFO screenpipe_core::pipes: loaded pipe: standup-update
2026-05-12T09:21:10.676236Z INFO screenpipe_core::pipes: loaded pipe: ai-habits
2026-05-12T09:21:10.676638Z INFO screenpipe_core::pipes: loaded pipe: time-breakdown
2026-05-12T09:21:10.677056Z INFO screenpipe_core::pipes: loaded pipe: video-export
2026-05-12T09:21:10.677293Z INFO screenpipe_core::pipes: loaded pipe: meeting-summary
2026-05-12T09:21:10.677398Z INFO screenpipe_core::pipes: loaded 6 pipes from "/Users/lukas/.screenpipe/pipes"
_
__________________ ___ ____ ____ (_____ ___
/ ___/ ___/ ___/ _ \/ _ \/ __ \ / __ \/ / __ \/ _ \
(__ / /__/ / / __/ __/ / / / / /_/ / / /_/ / __/
/____/\___/_/ \___/\___/_/ /_/ / .___/_/ .___/\___/
/_/ /_/
power AI by everything you've seen, said or heard
open source | runs locally | developer friendly
┌────────────────────────┬────────────────────────────────────┐
│ setting │ value │
├────────────────────────┼────────────────────────────────────┤
│ audio chunk duration │ 30 seconds │
│ port │ 3030 │
│ audio disabled │ false │
│ vision disabled │ false │
│ pause on DRM content │ false │
│ audio engine │ Parakeet │
│ vad engine │ Silero │
│ data directory │ /Users/lukas/.screenpipe │
│ debug mode │ false │
│ telemetry │ true │
│ use pii removal │ true │
│ use all monitors │ true │
│ ignored windows │ [] │
│ included windows │ [] │
│ cloud sync │ disabled │
│ auto-destruct pid │ 0 │
│ deepgram key │ not set │
│ api auth │ enabled │
│ encrypt secrets │ disabled │
│ retention days │ 14 │
│ retention mode │ media-only (keep transcripts) │
├────────────────────────┼────────────────────────────────────┤
│ languages │ │
│ │ all languages │
├────────────────────────┼────────────────────────────────────┤
│ monitors │ │
│ │ id: 1 │
│ │ id: 2 │
├────────────────────────┼────────────────────────────────────┤
│ audio devices │ │
│ │ MacBook Pro Microphone (input) │
│ │ System Audio (output) │
└────────────────────────┴────────────────────────────────────┘
you are using local processing. all your data stays on your computer.
warning: telemetry is enabled. only error-level data will be sent.
to disable, use the --disable-telemetry flag.
check latest changes here: https://github.com/screenpipe/screenpipe/releases
2026-05-12T09:21:10.684547Z INFO screenpipe_core::pipes: pipe scheduler started (generation 2)
2026-05-12T09:21:10.686111Z INFO screenpipe: starting UI event capture
2026-05-12T09:21:10.696691Z WARN screenpipe: pi agent install failed: bun not found — install from https://bun.sh
2026-05-12T09:21:10.705742Z INFO screenpipe_engine::power::manager: initial power profile: Performance (on_ac=true, battery=Some(100))
2026-05-12T09:21:10.712331Z INFO screenpipe_engine::ui_recorder: Starting UI event capture
2026-05-12T09:21:10.753596Z INFO screenpipe_engine::ui_recorder: UI recording session started: eee53fe6-52d6-4c4e-a7e5-11ede410f444
2026-05-12T09:21:10.753638Z INFO screenpipe_engine::calendar_speaker_id: speaker identification: started (user_name=<not set>)
2026-05-12T09:21:10.753679Z INFO screenpipe_engine::hot_frame_cache: hot_frame_cache: warming from DB (2026-05-11 06:21:10.753677 UTC to 2026-05-12 06:21:10.753677 UTC)
2026-05-12T09:21:10.754945Z INFO screenpipe_engine::meeting_detector: meeting v2: detection loop started (base_interval=5s, profiles=12)
2026-05-12T09:21:10.764596Z INFO screenpipe_engine::server: Server listening on [IP_ADDRESS]:3030
2026-05-12T09:21:10.771437Z INFO screenpipe_connect::mdns: mdns: advertising screenpipe on port 3030
2026-05-12T09:21:15.451981Z WARN sqlx::query: summary="SELECT f.id, f.timestamp, f.offset_index, …" db.statement="\n\nSELECT\n f.id,\n f.timestamp,\n f.offset_index,\n COALESCE(\n SUBSTR(f.full_text, 1, 200),\n SUBSTR(f.accessibility_text, 1, 200),\n (\n SELECT\n SUBSTR(ot.text, 1, 200)\n FROM\n ocr_text ot\n WHERE\n ot.frame_id = f.id\n LIMIT\n 1\n )\n ) as text,\n COALESCE(\n f.app_name,\n (\n SELECT\n ot.app_name\n FROM\n ocr_text ot\n WHERE\n ot.frame_id = f.id\n LIMIT\n 1\n )\n ) as app_name,\n COALESCE(\n f.window_name,\n (\n SELECT\n ot.window_name\n FROM\n ocr_text ot\n WHERE\n ot.frame_id = f.id\n LIMIT\n 1\n )\n ) as window_name,\n COALESCE(vc.device_name, f.device_name) as screen_device,\n COALESCE(vc.file_path, f.snapshot_path) as video_path,\n COALESCE(vc.fps, 0.033) as chunk_fps,\n f.browser_url,\n f.machine_id\nFROM\n ...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
13590
|
601
|
19
|
2026-05-09T15:52:05.188315+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-09/1778 /Users/lukas/.screenpipe/data/data/2026-05-09/1778341925188_m1.jpg...
|
Firefox
|
lakylak/finance-hub - finance-hub - Gitea: Git wit lakylak/finance-hub - finance-hub - Gitea: Git with a cup of tea — Personal...
|
True
|
gitea.com/lakylak/finance-hub
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Pull requests · screenpipe/screenpipe · GitHub
Pul Pull requests · screenpipe/screenpipe · GitHub
Pull requests · screenpipe/screenpipe · GitHub
DNS / Nameservers | Hostinger
DNS / Nameservers | Hostinger
Nginx Proxy Manager
Nginx Proxy Manager
Screenpipe — Archive
Screenpipe — Archive
SQLite Web: archive.db
SQLite Web: archive.db
SQLite Web: db.sqlite
SQLite Web: db.sqlite
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
AFFiNE - All In One KnowledgeOS
AFFiNE - All In One KnowledgeOS
All docs · AFFiNE
All docs · AFFiNE
Payments Logger
Payments Logger
Your old PC can run Windows 11 in a VM, but not on bare metal - [EMAIL] - Gmail
Your old PC can run Windows 11 in a VM, but not on bare metal - [EMAIL] - Gmail
(25) Quora
(25) Quora
Location Logger
Location Logger
Finance Hub
Finance Hub
Finance Hub
Finance Hub
Select: transactions - db - Adminer
Select: transactions - db - Adminer
Електронно банкиране ДСК Директ от Банка ДСК
Електронно банкиране ДСК Директ от Банка ДСК
Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE
Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE
VIVACOM
VIVACOM
Смартфони с Unlimited план до 120 € отстъпка | Vivacom
Смартфони с Unlimited план до 120 € отстъпка | Vivacom
VIVACOM
VIVACOM
Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom
Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom
Claude Code | Claude Platform
Claude Code | Claude Platform
Claude
Claude
Gitea Official Website
Gitea Official Website
lakylak/finance-hub - finance-hub - Gitea: Git with a cup of tea
lakylak/finance-hub - finance-hub - Gitea: Git with a cup of tea
Close tab
EU alternatives to github : r/github
EU alternatives to github : r/github
Comparison with Gitea | Forgejo – Beyond coding. We forge.
Comparison with Gitea | Forgejo – Beyond coding. We forge.
New Tab
Customize sidebar
Close Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
AI Chat settings
Close
Google Account: Lukáš Koválik ([EMAIL])
Main menu
New chat
Share conversation
Open menu for conversation actions.
Conversation with Gemini
Conversation with Gemini
Copy prompt
Edit
You said how many repositories can I have on free gitea
You said
how many repositories can I have on free gitea
Listen
Show more options
Show thinking
Gemini said
Gemini said
The number of repositories you can have on free Gitea depends on whether you are using their public hosted instance or running your own server.
Here is the breakdown:
1. On Gitea.com (Public Hosted Instance)
1. On Gitea.com (Public Hosted Instance)
If you are creating an account directly on
Gitea.com
, you are limited to
5 repositories
.
Gitea restricts the number of free repositories on its official public instance because the site's primary purpose is to host Gitea's own development and community projects, rather than serving as a general-purpose public code host like GitHub or GitLab.
2. Self-Hosted Gitea (Open-Source Software)
2. Self-Hosted Gitea (Open-Source Software)
If you are self-hosting Gitea on your own server or a Raspberry Pi, the open-source software is completely free and allows for
unlimited repositories
.
View source details. Opens side panel.
In a self-hosted environment, you are only limited by:
Your hardware's storage capacity.
Administrator limits:
If you are using an instance hosted by someone else, the administrator of that specific server can set custom creation limits per user (via the
setting). But if you are the admin, you have full control.
Sources
Sources
Good response
Bad response
Redo
Share and export
Copy
Show more options
Ask Gemini
Ask Gemini
Open upload file menu
Tools
Open mode picker
Pro
Microphone
Send message
Gemini is AI and can make mistakes, including about people.
Your privacy and Gemini Opens in a new window
Your privacy and Gemini
Opens in a new window
Summarize page
Summarize page
Dashboard
Issues
Issues
Pull Requests
Pull Requests
Milestones
Milestones
Explore
Explore
Notifications
lakylak
lakylak
/
finance-hub
finance-hub
Private
RSS Feed
Unwatch
1
1
Star
0
0
Fork
Fork
0
0
Code
Code
Issues
Issues
Pull Requests
Pull Requests
Actions
Actions
Projects
Projects
Releases
Releases
Wiki
Wiki
Activity
Activity
Settings
Settings
1 Commit
1
Commit
1 Branch
1
Branch
0 Tags
0
Tags
main
New Pull Request
Go to file
Code
Code
Lukas Kovalik
05626cd0ef
05626cd0ef
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
...
now
backend
backend
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
now
frontend
frontend
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
now
scripts
scripts
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
now
.env.example
.env.example
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
now
.gitignore
.gitignore
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
now
docker-compose.yml
docker-compose.yml
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
now
Search code…
Search…
Description
No description provided
Manage Topics
69
KiB
Languages
JavaScript
96.2%
Shell
2.9%
HTML
0.5%
Dockerfile
0.4%
Powered by Gitea
Powered by Gitea
Licenses
Licenses
API
API...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Pull requests · screenpipe/screenpipe · GitHub","depth":4,"on_screen":false,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests · screenpipe/screenpipe · GitHub","depth":5,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DNS / Nameservers | Hostinger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DNS / Nameservers | Hostinger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SQLite Web: archive.db","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SQLite Web: archive.db","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SQLite Web: db.sqlite","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SQLite Web: db.sqlite","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"AFFiNE - All In One KnowledgeOS","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"AFFiNE - All In One KnowledgeOS","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"All docs · AFFiNE","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"All docs · AFFiNE","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Payments Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Payments Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Your old PC can run Windows 11 in a VM, but not on bare metal - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Your old PC can run Windows 11 in a VM, but not on bare metal - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"(25) Quora","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"(25) Quora","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Finance Hub","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Finance Hub","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Finance Hub","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Finance Hub","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Select: transactions - db - Adminer","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Select: transactions - db - Adminer","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Електронно банкиране ДСК Директ от Банка ДСК","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Електронно банкиране ДСК Директ от Банка ДСК","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"VIVACOM","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"VIVACOM","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Смартфони с Unlimited план до 120 € отстъпка | Vivacom","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Смартфони с Unlimited план до 120 € отстъпка | Vivacom","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"VIVACOM","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"VIVACOM","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Claude Code | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Claude Code | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Claude","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Claude","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Gitea Official Website","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Gitea Official Website","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"lakylak/finance-hub - finance-hub - Gitea: Git with a cup of tea","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"lakylak/finance-hub - finance-hub - Gitea: Git with a cup of tea","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"EU alternatives to github : r/github","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"EU alternatives to github : r/github","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Comparison with Gitea | Forgejo – Beyond coding. We forge.","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Comparison with Gitea | Forgejo – Beyond coding. We forge.","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Close Google Gemini (⌃X)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"AI Chat settings","depth":7,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":7,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Google Account: Lukáš Koválik (kovaliklukas@gmail.com)","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Main menu","depth":12,"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New chat","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Share conversation","depth":11,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open menu for conversation actions.","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"Conversation with Gemini","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Conversation with Gemini","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy prompt","depth":21,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Edit","depth":21,"on_screen":false,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"You said how many repositories can I have on free gitea","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You said","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"how many repositories can I have on free gitea","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Listen","depth":24,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show more options","depth":23,"on_screen":false,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Show thinking","depth":28,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Gemini said","depth":23,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Gemini said","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"The number of repositories you can have on free Gitea depends on whether you are using their public hosted instance or running your own server.","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is the breakdown:","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. On Gitea.com (Public Hosted Instance)","depth":26,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. On Gitea.com (Public Hosted Instance)","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"If you are creating an account directly on","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Gitea.com","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", you are limited to","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"5 repositories","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Gitea restricts the number of free repositories on its official public instance because the site's primary purpose is to host Gitea's own development and community projects, rather than serving as a general-purpose public code host like GitHub or GitLab.","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. Self-Hosted Gitea (Open-Source Software)","depth":26,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. Self-Hosted Gitea (Open-Source Software)","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"If you are self-hosting Gitea on your own server or a Raspberry Pi, the open-source software is completely free and allows for","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"unlimited repositories","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"View source details. Opens side panel.","depth":27,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"In a self-hosted environment, you are only limited by:","depth":27,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Your hardware's storage capacity.","depth":29,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Administrator limits:","depth":29,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"If you are using an instance hosted by someone else, the administrator of that specific server can set custom creation limits per user (via the","depth":29,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"setting). But if you are the admin, you have full control.","depth":29,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Sources","depth":26,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sources","depth":28,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Good response","depth":23,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bad response","depth":23,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Redo","depth":23,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Share and export","depth":22,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":23,"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show more options","depth":22,"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"Ask Gemini","depth":20,"on_screen":true,"value":"Ask Gemini","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Gemini","depth":21,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Open upload file menu","depth":20,"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tools","depth":18,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open mode picker","depth":20,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pro","depth":23,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Microphone","depth":19,"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Send message","depth":19,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Gemini is AI and can make mistakes, including about people.","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Your privacy and Gemini Opens in a new window","depth":17,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Your privacy and Gemini","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Opens in a new window","depth":19,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Summarize page","depth":7,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Summarize page","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Dashboard","depth":7,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Issues","depth":7,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Issues","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Pull Requests","depth":7,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull Requests","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Milestones","depth":7,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Milestones","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Explore","depth":7,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Explore","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Notifications","depth":7,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"lakylak","depth":7,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"lakylak","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/","depth":7,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"finance-hub","depth":7,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"finance-hub","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Private","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"RSS Feed","depth":7,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Unwatch","depth":7,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"1","depth":7,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Star","depth":7,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"0","depth":7,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"0","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Fork","depth":8,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Fork","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"0","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"0","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Code","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Code","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Issues","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Issues","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Pull Requests","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull Requests","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Actions","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Actions","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Projects","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Projects","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Releases","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Releases","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Wiki","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Wiki","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Activity","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Activity","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Settings","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Settings","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1 Commit","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Commit","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1 Branch","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Branch","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"0 Tags","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"0","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Tags","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"main","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Pull Request","depth":7,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXComboBox","text":"Go to file","depth":9,"on_screen":true,"help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code","depth":7,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Code","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Lukas Kovalik","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"05626cd0ef","depth":9,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"05626cd0ef","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Initial commit: finance-hub unified finance app","depth":11,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initial commit: finance-hub unified finance app","depth":12,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"...","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"now","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"backend","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"backend","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Initial commit: finance-hub unified finance app","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initial commit: finance-hub unified finance app","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"now","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"frontend","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"frontend","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Initial commit: finance-hub unified finance app","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initial commit: finance-hub unified finance app","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"now","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"scripts","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"scripts","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Initial commit: finance-hub unified finance app","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initial commit: finance-hub unified finance app","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"now","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":".env.example","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":".env.example","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Initial commit: finance-hub unified finance app","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initial commit: finance-hub unified finance app","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"now","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":".gitignore","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":".gitignore","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Initial commit: finance-hub unified finance app","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initial commit: finance-hub unified finance app","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"now","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"docker-compose.yml","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"docker-compose.yml","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Initial commit: finance-hub unified finance app","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initial commit: finance-hub unified finance app","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"now","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Search code…","depth":8,"on_screen":true,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search…","depth":8,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Description","depth":7,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"No description provided","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Manage Topics","depth":7,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"69","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"KiB","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Languages","depth":7,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"JavaScript","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"96.2%","depth":7,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Shell","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.9%","depth":7,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"HTML","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0.5%","depth":7,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Dockerfile","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0.4%","depth":7,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Powered by Gitea","depth":8,"bounds":{"left":0.0,"top":0.0,"width":0.078819446,"height":0.022222223},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Powered by Gitea","depth":9,"bounds":{"left":0.0,"top":0.0,"width":0.078819446,"height":0.018888889},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Licenses","depth":8,"bounds":{"left":0.9152778,"top":0.0,"width":0.05,"height":0.022222223},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Licenses","depth":9,"bounds":{"left":0.92569447,"top":0.0,"width":0.039583333,"height":0.018888889},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"API","depth":8,"bounds":{"left":0.975,"top":0.0,"width":0.024999976,"height":0.022222223},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API","depth":9,"bounds":{"left":0.98541665,"top":0.0,"width":0.014583349,"height":0.018888889},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8051359131674472006
|
5973072736735987740
|
click
|
accessibility
|
NULL
|
Pull requests · screenpipe/screenpipe · GitHub
Pul Pull requests · screenpipe/screenpipe · GitHub
Pull requests · screenpipe/screenpipe · GitHub
DNS / Nameservers | Hostinger
DNS / Nameservers | Hostinger
Nginx Proxy Manager
Nginx Proxy Manager
Screenpipe — Archive
Screenpipe — Archive
SQLite Web: archive.db
SQLite Web: archive.db
SQLite Web: db.sqlite
SQLite Web: db.sqlite
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
AFFiNE - All In One KnowledgeOS
AFFiNE - All In One KnowledgeOS
All docs · AFFiNE
All docs · AFFiNE
Payments Logger
Payments Logger
Your old PC can run Windows 11 in a VM, but not on bare metal - [EMAIL] - Gmail
Your old PC can run Windows 11 in a VM, but not on bare metal - [EMAIL] - Gmail
(25) Quora
(25) Quora
Location Logger
Location Logger
Finance Hub
Finance Hub
Finance Hub
Finance Hub
Select: transactions - db - Adminer
Select: transactions - db - Adminer
Електронно банкиране ДСК Директ от Банка ДСК
Електронно банкиране ДСК Директ от Банка ДСК
Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE
Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE
VIVACOM
VIVACOM
Смартфони с Unlimited план до 120 € отстъпка | Vivacom
Смартфони с Unlimited план до 120 € отстъпка | Vivacom
VIVACOM
VIVACOM
Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom
Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom
Claude Code | Claude Platform
Claude Code | Claude Platform
Claude
Claude
Gitea Official Website
Gitea Official Website
lakylak/finance-hub - finance-hub - Gitea: Git with a cup of tea
lakylak/finance-hub - finance-hub - Gitea: Git with a cup of tea
Close tab
EU alternatives to github : r/github
EU alternatives to github : r/github
Comparison with Gitea | Forgejo – Beyond coding. We forge.
Comparison with Gitea | Forgejo – Beyond coding. We forge.
New Tab
Customize sidebar
Close Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
AI Chat settings
Close
Google Account: Lukáš Koválik ([EMAIL])
Main menu
New chat
Share conversation
Open menu for conversation actions.
Conversation with Gemini
Conversation with Gemini
Copy prompt
Edit
You said how many repositories can I have on free gitea
You said
how many repositories can I have on free gitea
Listen
Show more options
Show thinking
Gemini said
Gemini said
The number of repositories you can have on free Gitea depends on whether you are using their public hosted instance or running your own server.
Here is the breakdown:
1. On Gitea.com (Public Hosted Instance)
1. On Gitea.com (Public Hosted Instance)
If you are creating an account directly on
Gitea.com
, you are limited to
5 repositories
.
Gitea restricts the number of free repositories on its official public instance because the site's primary purpose is to host Gitea's own development and community projects, rather than serving as a general-purpose public code host like GitHub or GitLab.
2. Self-Hosted Gitea (Open-Source Software)
2. Self-Hosted Gitea (Open-Source Software)
If you are self-hosting Gitea on your own server or a Raspberry Pi, the open-source software is completely free and allows for
unlimited repositories
.
View source details. Opens side panel.
In a self-hosted environment, you are only limited by:
Your hardware's storage capacity.
Administrator limits:
If you are using an instance hosted by someone else, the administrator of that specific server can set custom creation limits per user (via the
setting). But if you are the admin, you have full control.
Sources
Sources
Good response
Bad response
Redo
Share and export
Copy
Show more options
Ask Gemini
Ask Gemini
Open upload file menu
Tools
Open mode picker
Pro
Microphone
Send message
Gemini is AI and can make mistakes, including about people.
Your privacy and Gemini Opens in a new window
Your privacy and Gemini
Opens in a new window
Summarize page
Summarize page
Dashboard
Issues
Issues
Pull Requests
Pull Requests
Milestones
Milestones
Explore
Explore
Notifications
lakylak
lakylak
/
finance-hub
finance-hub
Private
RSS Feed
Unwatch
1
1
Star
0
0
Fork
Fork
0
0
Code
Code
Issues
Issues
Pull Requests
Pull Requests
Actions
Actions
Projects
Projects
Releases
Releases
Wiki
Wiki
Activity
Activity
Settings
Settings
1 Commit
1
Commit
1 Branch
1
Branch
0 Tags
0
Tags
main
New Pull Request
Go to file
Code
Code
Lukas Kovalik
05626cd0ef
05626cd0ef
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
...
now
backend
backend
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
now
frontend
frontend
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
now
scripts
scripts
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
now
.env.example
.env.example
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
now
.gitignore
.gitignore
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
now
docker-compose.yml
docker-compose.yml
Initial commit: finance-hub unified finance app
Initial commit: finance-hub unified finance app
now
Search code…
Search…
Description
No description provided
Manage Topics
69
KiB
Languages
JavaScript
96.2%
Shell
2.9%
HTML
0.5%
Dockerfile
0.4%
Powered by Gitea
Powered by Gitea
Licenses
Licenses
API
API...
|
13588
|
NULL
|
NULL
|
NULL
|
|
23853
|
1003
|
46
|
2026-05-12T08:28:28.467881+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-12/1778 /Users/lukas/.screenpipe/data/data/2026-05-12/1778574508467_m2.jpg...
|
Firefox
|
Jiminny — Work
|
True
|
app.jiminny.com/ai-reports
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
New Tab
New Tab
Jy 20820 es reindex stream model h New Tab
New Tab
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
Pipelines - jiminny/app
Pipelines - jiminny/app
Pull requests · jiminny/app
Pull requests · jiminny/app
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
Data Explorer
Data Explorer
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
Jiminny
Jiminny
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
6
6
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Ask Jiminny
Coaching Profiles
×
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Coaching Profiles - 4 - 10 May 2026 - Client Success, UK Sales
Weekly
+1
11/05/2026
Coaching Profiles Podcast - 4 - 10 May 2026 - Client Success, UK Sales
Weekly
+1
11/05/2026
Product Feedback - 4 - 10 May 2026 - Client Success, UK Sales, Support, Product
Weekly
+2
11/05/2026
Exec Summary - 4 - 10 May 2026 - All
Weekly
+4
11/05/2026
Coaching Profiles - 27 Apr - 3 May 2026 - Client Success, UK Sales
Weekly
+1
04/05/2026
Coaching Profiles Podcast - 27 Apr - 3 May 2026 - Client Success, UK Sales
Weekly
+1
04/05/2026
Product Feedback - 27 Apr - 3 May 2026 - Client Success, UK Sales, Support, Product
Weekly
+2
04/05/2026
Exec Summary - 27 Apr - 3 May 2026 - All
Weekly
+4
04/05/2026
Coaching Profiles - 20 - 26 Apr 2026 - Client Success, UK Sales
Weekly
+1
27/04/2026
Coaching Profiles Podcast - 20 - 26 Apr 2026 - Client Success, UK Sales
Weekly
+1
27/04/2026
Exec Summary - 20 - 26 Apr 2026 - All
Weekly
+4
27/04/2026
Product Feedback - 20 - 26 Apr 2026 - Client Success, UK Sales, Support, Product
Weekly
+2
27/04/2026
Exec Summary - 1 Dec 2025 - 23 Apr 2026 - Product
One-Off
23/04/2026
Exec Summary Podcast - 1 Dec 2025 - 23 Apr 2026 - Product
One-Off
23/04/2026
Product Feedback - 1 Jan - 23 Apr 2026 - Product
One-Off
23/04/2026
Product Feedback Podcast - 1 Jan - 23 Apr 2026 - Product
One-Off
23/04/2026
Product Feedback - 1 Jan - 23 Apr 2026 - Product
One-Off
23/04/2026
Product Feedback Podcast - 1 Jan - 23 Apr 2026 - Product
One-Off
23/04/2026
Coaching Profiles - 13 - 19 Apr 2026 - Client Success, UK Sales
Weekly
+1
20/04/2026
Coaching Profiles Podcast - 13 - 19 Apr 2026 - Client Success, UK Sales
Weekly
+1
20/04/2026
Product Feedback - 13 - 19 Apr 2026 - Client Success, UK Sales, Support, Product
Weekly
+2
20/04/2026
Exec Summary - 13 - 19 Apr 2026 - All
Weekly
+4
20/04/2026
Coaching Profiles - 6 - 12 Apr 2026 - Client Success, UK Sales
Weekly
+1
13/04/2026
Coaching Profiles Podcast - 6 - 12 Apr 2026 - Client Success, UK Sales
Weekly
+1
13/04/2026
Exec Summary - 6 - 12 Apr 2026 - All
Weekly
+4
13/04/2026
You are currently impersonating Adelina Petrova...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.3643617,"top":0.0518755,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.3776596,"top":0.06304868,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":4,"bounds":{"left":0.3643617,"top":0.08459697,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":5,"bounds":{"left":0.3776596,"top":0.09577015,"width":0.16888298,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira","depth":4,"bounds":{"left":0.3643617,"top":0.11731844,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira","depth":5,"bounds":{"left":0.3776596,"top":0.12849163,"width":0.16140293,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":4,"bounds":{"left":0.3643617,"top":0.15003991,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":5,"bounds":{"left":0.3776596,"top":0.16121309,"width":0.18816489,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"bounds":{"left":0.3643617,"top":0.18276137,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"bounds":{"left":0.3776596,"top":0.19393456,"width":0.039228722,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pull requests · jiminny/app","depth":4,"bounds":{"left":0.3643617,"top":0.21548285,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests · jiminny/app","depth":5,"bounds":{"left":0.3776596,"top":0.22665602,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":4,"bounds":{"left":0.3643617,"top":0.2482043,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":5,"bounds":{"left":0.3776596,"top":0.25937748,"width":0.1200133,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":4,"bounds":{"left":0.3643617,"top":0.28092578,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":5,"bounds":{"left":0.3776596,"top":0.29209897,"width":0.19331782,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20776] Automated report - sentry - Jira","depth":4,"bounds":{"left":0.3643617,"top":0.31364724,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20776] Automated report - sentry - Jira","depth":5,"bounds":{"left":0.3776596,"top":0.32482043,"width":0.07646277,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"TypeError: League\\Flysystem\\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app","depth":4,"bounds":{"left":0.3643617,"top":0.3463687,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"TypeError: League\\Flysystem\\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app","depth":5,"bounds":{"left":0.3776596,"top":0.3575419,"width":0.40475398,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.3643617,"top":0.3790902,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":5,"bounds":{"left":0.3776596,"top":0.39026338,"width":0.10106383,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app","depth":4,"bounds":{"left":0.3643617,"top":0.41181165,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app","depth":5,"bounds":{"left":0.3776596,"top":0.42298484,"width":0.15159574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Data Explorer","depth":4,"bounds":{"left":0.3643617,"top":0.4445331,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Data Explorer","depth":5,"bounds":{"left":0.3776596,"top":0.4557063,"width":0.0234375,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20776] Automated report - sentry - Jira","depth":4,"bounds":{"left":0.3643617,"top":0.4772546,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20776] Automated report - sentry - Jira","depth":5,"bounds":{"left":0.3776596,"top":0.4884278,"width":0.07646277,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.3643617,"top":0.509976,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.3776596,"top":0.5211492,"width":0.013131649,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.43168217,"top":0.5171588,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.3671875,"top":0.5442937,"width":0.07413564,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.3671875,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.37815824,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.38929522,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.40043217,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.41156915,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"6","depth":12,"bounds":{"left":0.44664228,"top":0.91380686,"width":0.015957447,"height":0.035115723},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"6","depth":14,"bounds":{"left":0.45611703,"top":0.9173983,"width":0.0023271276,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"AI Reports","depth":13,"bounds":{"left":0.47323802,"top":0.06943336,"width":0.031416222,"height":0.019553073},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"AI Reports","depth":14,"bounds":{"left":0.47323802,"top":0.06943336,"width":0.031416222,"height":0.019553073},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Ask Jiminny reports","depth":13,"bounds":{"left":0.93267953,"top":0.06464485,"width":0.059341755,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Jiminny reports","depth":14,"bounds":{"left":0.94630986,"top":0.07222666,"width":0.04105718,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report name","depth":17,"bounds":{"left":0.48603722,"top":0.10933759,"width":0.058011968,"height":0.019952115},"on_screen":true,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Period","depth":20,"bounds":{"left":0.563996,"top":0.114924185,"width":0.012799202,"height":0.012769354},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Ask Jiminny","depth":16,"bounds":{"left":0.63380986,"top":0.10933759,"width":0.06615692,"height":0.044692736},"on_screen":true,"value":"Ask Jiminny","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"Coaching Profiles","depth":20,"bounds":{"left":0.63613695,"top":0.11691939,"width":0.036402926,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"×","depth":21,"bounds":{"left":0.67486703,"top":0.11652035,"width":0.0028257978,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report Type","depth":18,"bounds":{"left":0.63380986,"top":0.13806863,"width":0.05618351,"height":0.015961692},"on_screen":true,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Clear all","depth":13,"bounds":{"left":0.7062833,"top":0.112529926,"width":0.028424202,"height":0.015961692},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NAME","depth":16,"bounds":{"left":0.47290558,"top":0.18994413,"width":0.012965426,"height":0.012769354},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"FREQUENCY","depth":16,"bounds":{"left":0.6978058,"top":0.18994413,"width":0.026263298,"height":0.012769354},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SHARED","depth":16,"bounds":{"left":0.7727726,"top":0.18994413,"width":0.017453458,"height":0.012769354},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"DATE","depth":16,"bounds":{"left":0.84773934,"top":0.18994413,"width":0.011136968,"height":0.012769354},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ACTIONS","depth":16,"bounds":{"left":0.9227061,"top":0.18994413,"width":0.019115692,"height":0.012769354},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Coaching Profiles - 4 - 10 May 2026 - Client Success, UK Sales","depth":17,"bounds":{"left":0.48620346,"top":0.23663208,"width":0.12932181,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.6978058,"top":0.23663208,"width":0.014960106,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+1","depth":17,"bounds":{"left":0.8005319,"top":0.23743017,"width":0.004488032,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"11/05/2026","depth":17,"bounds":{"left":0.84773934,"top":0.23663208,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Coaching Profiles Podcast - 4 - 10 May 2026 - Client Success, UK Sales","depth":17,"bounds":{"left":0.48620346,"top":0.28371906,"width":0.1471077,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.6978058,"top":0.28371906,"width":0.014960106,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+1","depth":17,"bounds":{"left":0.8005319,"top":0.28451717,"width":0.004488032,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"11/05/2026","depth":17,"bounds":{"left":0.84773934,"top":0.2677574,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Product Feedback - 4 - 10 May 2026 - Client Success, UK Sales, Support, Product","depth":17,"bounds":{"left":0.48620346,"top":0.31484437,"width":0.16871676,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.6978058,"top":0.31484437,"width":0.014960106,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+2","depth":17,"bounds":{"left":0.8005319,"top":0.31564245,"width":0.004488032,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"11/05/2026","depth":17,"bounds":{"left":0.84773934,"top":0.31484437,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 4 - 10 May 2026 - All","depth":17,"bounds":{"left":0.48620346,"top":0.36193135,"width":0.078125,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.6978058,"top":0.36193135,"width":0.014960106,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+4","depth":17,"bounds":{"left":0.8005319,"top":0.36272946,"width":0.004488032,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"11/05/2026","depth":17,"bounds":{"left":0.84773934,"top":0.36193135,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Coaching Profiles - 27 Apr - 3 May 2026 - Client Success, UK Sales","depth":17,"bounds":{"left":0.48620346,"top":0.40901837,"width":0.13813165,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.6978058,"top":0.40901837,"width":0.014960106,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+1","depth":17,"bounds":{"left":0.8005319,"top":0.40981644,"width":0.004488032,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"04/05/2026","depth":17,"bounds":{"left":0.84773934,"top":0.40901837,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Coaching Profiles Podcast - 27 Apr - 3 May 2026 - Client Success, UK Sales","depth":17,"bounds":{"left":0.48620346,"top":0.45610535,"width":0.15608378,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.6978058,"top":0.45610535,"width":0.014960106,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+1","depth":17,"bounds":{"left":0.8005319,"top":0.45690343,"width":0.004488032,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"04/05/2026","depth":17,"bounds":{"left":0.84773934,"top":0.45610535,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Product Feedback - 27 Apr - 3 May 2026 - Client Success, UK Sales, Support, Product","depth":17,"bounds":{"left":0.48620346,"top":0.50319237,"width":0.1775266,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.6978058,"top":0.50319237,"width":0.014960106,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+2","depth":17,"bounds":{"left":0.8005319,"top":0.5039904,"width":0.004488032,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"04/05/2026","depth":17,"bounds":{"left":0.84773934,"top":0.50319237,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 27 Apr - 3 May 2026 - All","depth":17,"bounds":{"left":0.48620346,"top":0.5502793,"width":0.087101065,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.6978058,"top":0.5502793,"width":0.014960106,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+4","depth":17,"bounds":{"left":0.8005319,"top":0.5510774,"width":0.004488032,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"04/05/2026","depth":17,"bounds":{"left":0.84773934,"top":0.5502793,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Coaching Profiles - 20 - 26 Apr 2026 - Client Success, UK Sales","depth":17,"bounds":{"left":0.48620346,"top":0.59736633,"width":0.1306516,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.6978058,"top":0.59736633,"width":0.014960106,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+1","depth":17,"bounds":{"left":0.8005319,"top":0.5981644,"width":0.004488032,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"27/04/2026","depth":17,"bounds":{"left":0.84773934,"top":0.59736633,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Coaching Profiles Podcast - 20 - 26 Apr 2026 - Client Success, UK Sales","depth":17,"bounds":{"left":0.48620346,"top":0.6444533,"width":0.14860372,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.6978058,"top":0.6444533,"width":0.014960106,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+1","depth":17,"bounds":{"left":0.8005319,"top":0.6452514,"width":0.004488032,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"27/04/2026","depth":17,"bounds":{"left":0.84773934,"top":0.6444533,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 20 - 26 Apr 2026 - All","depth":17,"bounds":{"left":0.48620346,"top":0.6915403,"width":0.07962101,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.6978058,"top":0.6915403,"width":0.014960106,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+4","depth":17,"bounds":{"left":0.8005319,"top":0.6923384,"width":0.004488032,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"27/04/2026","depth":17,"bounds":{"left":0.84773934,"top":0.6915403,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Product Feedback - 20 - 26 Apr 2026 - Client Success, UK Sales, Support, Product","depth":17,"bounds":{"left":0.48620346,"top":0.7386273,"width":0.17004654,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.6978058,"top":0.7386273,"width":0.014960106,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+2","depth":17,"bounds":{"left":0.8005319,"top":0.73942536,"width":0.004488032,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"27/04/2026","depth":17,"bounds":{"left":0.84773934,"top":0.7386273,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 1 Dec 2025 - 23 Apr 2026 - Product","depth":17,"bounds":{"left":0.48620346,"top":0.78571427,"width":0.109042555,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.6978058,"top":0.78571427,"width":0.01662234,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"23/04/2026","depth":17,"bounds":{"left":0.84773934,"top":0.78571427,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary Podcast - 1 Dec 2025 - 23 Apr 2026 - Product","depth":17,"bounds":{"left":0.48620346,"top":0.8328013,"width":0.12699468,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.6978058,"top":0.8328013,"width":0.01662234,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"23/04/2026","depth":17,"bounds":{"left":0.84773934,"top":0.8328013,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Product Feedback - 1 Jan - 23 Apr 2026 - Product","depth":17,"bounds":{"left":0.48620346,"top":0.8798883,"width":0.103557184,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.6978058,"top":0.8798883,"width":0.01662234,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"23/04/2026","depth":17,"bounds":{"left":0.84773934,"top":0.8798883,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Product Feedback Podcast - 1 Jan - 23 Apr 2026 - Product","depth":17,"bounds":{"left":0.48620346,"top":0.92697525,"width":0.12134308,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.6978058,"top":0.92697525,"width":0.01662234,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"23/04/2026","depth":17,"bounds":{"left":0.84773934,"top":0.92697525,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Product Feedback - 1 Jan - 23 Apr 2026 - Product","depth":17,"bounds":{"left":0.48620346,"top":0.97406226,"width":0.103557184,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.6978058,"top":0.97406226,"width":0.01662234,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"23/04/2026","depth":17,"bounds":{"left":0.84773934,"top":0.97406226,"width":0.024102394,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Product Feedback Podcast - 1 Jan - 23 Apr 2026 - Product","depth":17,"bounds":{"left":0.48620346,"top":1.0,"width":0.12134308,"height":-0.021149278},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.6978058,"top":1.0,"width":0.01662234,"height":-0.021149278},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"23/04/2026","depth":17,"bounds":{"left":0.84773934,"top":1.0,"width":0.024102394,"height":-0.021149278},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Coaching Profiles - 13 - 19 Apr 2026 - Client Success, UK Sales","depth":17,"bounds":{"left":0.48620346,"top":1.0,"width":0.1306516,"height":-0.06823623},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.6978058,"top":1.0,"width":0.014960106,"height":-0.06823623},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+1","depth":17,"bounds":{"left":0.8005319,"top":1.0,"width":0.004488032,"height":-0.06903434},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20/04/2026","depth":17,"bounds":{"left":0.84773934,"top":1.0,"width":0.024102394,"height":-0.06823623},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Coaching Profiles Podcast - 13 - 19 Apr 2026 - Client Success, UK Sales","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+1","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20/04/2026","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Product Feedback - 13 - 19 Apr 2026 - Client Success, UK Sales, Support, Product","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+2","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20/04/2026","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 13 - 19 Apr 2026 - All","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+4","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20/04/2026","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Coaching Profiles - 6 - 12 Apr 2026 - Client Success, UK Sales","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+1","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"13/04/2026","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Coaching Profiles Podcast - 6 - 12 Apr 2026 - Client Success, UK Sales","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+1","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"13/04/2026","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 6 - 12 Apr 2026 - All","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+4","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"13/04/2026","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You are currently impersonating Adelina Petrova","depth":11,"bounds":{"left":0.66638964,"top":0.053072624,"width":0.10073138,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8050144396867723423
|
-5400495786029701045
|
click
|
accessibility
|
NULL
|
New Tab
New Tab
Jy 20820 es reindex stream model h New Tab
New Tab
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
Pipelines - jiminny/app
Pipelines - jiminny/app
Pull requests · jiminny/app
Pull requests · jiminny/app
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
Data Explorer
Data Explorer
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
Jiminny
Jiminny
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
6
6
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Ask Jiminny
Coaching Profiles
×
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Coaching Profiles - 4 - 10 May 2026 - Client Success, UK Sales
Weekly
+1
11/05/2026
Coaching Profiles Podcast - 4 - 10 May 2026 - Client Success, UK Sales
Weekly
+1
11/05/2026
Product Feedback - 4 - 10 May 2026 - Client Success, UK Sales, Support, Product
Weekly
+2
11/05/2026
Exec Summary - 4 - 10 May 2026 - All
Weekly
+4
11/05/2026
Coaching Profiles - 27 Apr - 3 May 2026 - Client Success, UK Sales
Weekly
+1
04/05/2026
Coaching Profiles Podcast - 27 Apr - 3 May 2026 - Client Success, UK Sales
Weekly
+1
04/05/2026
Product Feedback - 27 Apr - 3 May 2026 - Client Success, UK Sales, Support, Product
Weekly
+2
04/05/2026
Exec Summary - 27 Apr - 3 May 2026 - All
Weekly
+4
04/05/2026
Coaching Profiles - 20 - 26 Apr 2026 - Client Success, UK Sales
Weekly
+1
27/04/2026
Coaching Profiles Podcast - 20 - 26 Apr 2026 - Client Success, UK Sales
Weekly
+1
27/04/2026
Exec Summary - 20 - 26 Apr 2026 - All
Weekly
+4
27/04/2026
Product Feedback - 20 - 26 Apr 2026 - Client Success, UK Sales, Support, Product
Weekly
+2
27/04/2026
Exec Summary - 1 Dec 2025 - 23 Apr 2026 - Product
One-Off
23/04/2026
Exec Summary Podcast - 1 Dec 2025 - 23 Apr 2026 - Product
One-Off
23/04/2026
Product Feedback - 1 Jan - 23 Apr 2026 - Product
One-Off
23/04/2026
Product Feedback Podcast - 1 Jan - 23 Apr 2026 - Product
One-Off
23/04/2026
Product Feedback - 1 Jan - 23 Apr 2026 - Product
One-Off
23/04/2026
Product Feedback Podcast - 1 Jan - 23 Apr 2026 - Product
One-Off
23/04/2026
Coaching Profiles - 13 - 19 Apr 2026 - Client Success, UK Sales
Weekly
+1
20/04/2026
Coaching Profiles Podcast - 13 - 19 Apr 2026 - Client Success, UK Sales
Weekly
+1
20/04/2026
Product Feedback - 13 - 19 Apr 2026 - Client Success, UK Sales, Support, Product
Weekly
+2
20/04/2026
Exec Summary - 13 - 19 Apr 2026 - All
Weekly
+4
20/04/2026
Coaching Profiles - 6 - 12 Apr 2026 - Client Success, UK Sales
Weekly
+1
13/04/2026
Coaching Profiles Podcast - 6 - 12 Apr 2026 - Client Success, UK Sales
Weekly
+1
13/04/2026
Exec Summary - 6 - 12 Apr 2026 - All
Weekly
+4
13/04/2026
You are currently impersonating Adelina Petrova...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
11340
|
514
|
12
|
2026-05-08T19:08:24.667155+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-08/1778 /Users/lukas/.screenpipe/data/data/2026-05-08/1778267304667_m2.jpg...
|
iTerm2
|
NULL
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
дeNotioncaltVIeWMistonWinaowY FINANCE [SSH: NAS]/a дeNotioncaltVIeWMistonWinaowY FINANCE [SSH: NAS]/autn› dsk-uploader> finance-hubpayments-loggeheltfinance-hub > docker-compose.yml~NAAANNNANNMMMMMimage: postgres:16-alpinerestare untess-scoppedPOSTGRES_USER: financePOSTGRES PASSWORD: [PASSWORD] PASSWORDYPOSTGRES DB: Tinance hub- oodata:/varLio/ postaresaldatatect: "CMD_SHFlI" "na icreadv =ll finance =d finance hub"build. /hackendrestart: unless-stoppedURL: [URL_WITH_CREDENTIALS] A0 (20Desian new pavment-loage... XDesign new payment-logger and dsk-upl.‹ docker-compose.ymllopened [IP_ADDRESS]:01/5 and it workto test it. Where to send sms to digest,3. CSV format the uploaExport from DSK B4. Viewing the database* Esc to focus or unfocu+00dockenL Lukas Kovalik's No..A HomeTestDaily+ New agentWorkspace& Quick Note• Work• KnowledgeIdeasPrivateFinance hubE Home viewsIntegration-appWork Knowledgetesting keyboard4 TodoYEAR 2026New pagePersonal Homeã LOGS* BudgetG Apartmán@ RouterPopulation decline explained@ Seniority LevelsAl Marti( Interview PreparationPain TrackerDaily Fitness Habit Tracker5 Plans 2024PAWDaily@ Settings and configsA Medical documents— ЖеланияDreamG HealthZ New chat 80100% 2Fri 8 May 22:08:25Finance hubThree separate answers below:1. Why there's no Authentik loginAuthentik is working correctly on the backend — but only when reduests flow through NPM.Here's what's happening:Browser - [IP_ADDRESS]:5175 - Vite - backend(no NPM, no Authentik outpost, noProtected nath: Browser → NPM - Authentik outoost → NPM iniects headers → backendWhen you hit port 5175 directly, there's no X-authentik-usernaheader injected, so allprotected API calls return 401. The page renders because it's static React, but the paymentstable is probably empty. To confirm:# Should get 401 (no header):curl http://[IP_ADDRESS]:3001/api/payments# Should get 200 (header simulated):curl -Hi"x-authentik-username: testuser" http://[IP_ADDRESS]:3001/api/paymentsTo wire up Authentik via NPM:1. In Authentik admin (https://auth.lakylak.xyz/if/admin/) → Applications → Providers →Create → Tvoe: Proxy. Mode: Forward auth (sinqle application). Externahost: https://f2. Applications → Create → link to the provider above3. Outnosts → Edit nom-outpost → add the new anplication to it4. In NPM → new Proxy Host → finance-hub.lakylak.xyz [IP_ADDRESS]:5175 → SSL on- Advanced tah nacte thic.location / ‹auth_request/outpost.goauthentik.io/auth/nginx;error nade 401 = Gaoauthentik nroxv sianin:auth_request set Sauth_cookie Supstream_http_set_cookie;add headerSet-Cookie Sauth cookie:auth reauest set Sauthentik username Suostream htto x authentik usernamenroxv set header Xcauthentik-username sauthentik ucername,proxy_pass http://[IP_ADDRESS]:5175;Suggested actionsPaste* Improve writingv ProofreadEdit with Al...
|
NULL
|
-8050005242126957543
|
NULL
|
visual_change
|
ocr
|
NULL
|
дeNotioncaltVIeWMistonWinaowY FINANCE [SSH: NAS]/a дeNotioncaltVIeWMistonWinaowY FINANCE [SSH: NAS]/autn› dsk-uploader> finance-hubpayments-loggeheltfinance-hub > docker-compose.yml~NAAANNNANNMMMMMimage: postgres:16-alpinerestare untess-scoppedPOSTGRES_USER: financePOSTGRES PASSWORD: [PASSWORD] PASSWORDYPOSTGRES DB: Tinance hub- oodata:/varLio/ postaresaldatatect: "CMD_SHFlI" "na icreadv =ll finance =d finance hub"build. /hackendrestart: unless-stoppedURL: [URL_WITH_CREDENTIALS] A0 (20Desian new pavment-loage... XDesign new payment-logger and dsk-upl.‹ docker-compose.ymllopened [IP_ADDRESS]:01/5 and it workto test it. Where to send sms to digest,3. CSV format the uploaExport from DSK B4. Viewing the database* Esc to focus or unfocu+00dockenL Lukas Kovalik's No..A HomeTestDaily+ New agentWorkspace& Quick Note• Work• KnowledgeIdeasPrivateFinance hubE Home viewsIntegration-appWork Knowledgetesting keyboard4 TodoYEAR 2026New pagePersonal Homeã LOGS* BudgetG Apartmán@ RouterPopulation decline explained@ Seniority LevelsAl Marti( Interview PreparationPain TrackerDaily Fitness Habit Tracker5 Plans 2024PAWDaily@ Settings and configsA Medical documents— ЖеланияDreamG HealthZ New chat 80100% 2Fri 8 May 22:08:25Finance hubThree separate answers below:1. Why there's no Authentik loginAuthentik is working correctly on the backend — but only when reduests flow through NPM.Here's what's happening:Browser - [IP_ADDRESS]:5175 - Vite - backend(no NPM, no Authentik outpost, noProtected nath: Browser → NPM - Authentik outoost → NPM iniects headers → backendWhen you hit port 5175 directly, there's no X-authentik-usernaheader injected, so allprotected API calls return 401. The page renders because it's static React, but the paymentstable is probably empty. To confirm:# Should get 401 (no header):curl http://[IP_ADDRESS]:3001/api/payments# Should get 200 (header simulated):curl -Hi"x-authentik-username: testuser" http://[IP_ADDRESS]:3001/api/paymentsTo wire up Authentik via NPM:1. In Authentik admin (https://auth.lakylak.xyz/if/admin/) → Applications → Providers →Create → Tvoe: Proxy. Mode: Forward auth (sinqle application). Externahost: https://f2. Applications → Create → link to the provider above3. Outnosts → Edit nom-outpost → add the new anplication to it4. In NPM → new Proxy Host → finance-hub.lakylak.xyz [IP_ADDRESS]:5175 → SSL on- Advanced tah nacte thic.location / ‹auth_request/outpost.goauthentik.io/auth/nginx;error nade 401 = Gaoauthentik nroxv sianin:auth_request set Sauth_cookie Supstream_http_set_cookie;add headerSet-Cookie Sauth cookie:auth reauest set Sauthentik username Suostream htto x authentik usernamenroxv set header Xcauthentik-username sauthentik ucername,proxy_pass http://[IP_ADDRESS]:5175;Suggested actionsPaste* Improve writingv ProofreadEdit with Al...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
19077
|
819
|
10
|
2026-05-11T12:18:32.576688+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778501912576_m2.jpg...
|
Code
|
Review rate limit handli… — app
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧ Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧G) - 22 pending changes
22
Run and Debug (⇧⌘D)
Remote Explorer
Extensions (⇧⌘X) - 2 require update
2
Testing
Claude Code
EXPLORER
EXPLORER
Explorer Section: app
Explorer Section: app
APP
CheckAndRetryRemoteMatch.php
CreateFollowupActivity.php
CreateNotes.php
MatchActivitiesToNewOpportunity.php
MatchActivityCrmData.php
M
NoteObject.php
SaveActivity.php
SaveTranscription.php
SetupLayout.php
SyncActivity.php
SyncFieldMetadata.php
SyncHubspotObjects.php
SyncLeads.php
SyncObjects.php
SyncOpportunitiesJob.php
SyncOpportunity.php
SyncProfileMetadata.php
SyncTeamFieldsJob.php
SyncTeamMetadata.php
UpdateOpportunitySpecifications.php
UpdateStage.php
DealRisks
Mailbox
MeetingBot
Middleware
HandleHubspotRateLimit.php
M
RateLimited.php
Streaming
Team
Telephony
User
BaseProcessingJob.php
DummyJob.php
ImportRecallAIRecordingsJob.php
ImportRemoteTrackJob.php
Job.php
JobDispatcher.php
JobDispatcherInterface.php
PurgeSoftDeletedOpportunityJob.php
SqsVisibilityControl.php
Listeners
Mail...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Explorer (⇧⌘E)","depth":19,"bounds":{"left":0.0,"top":0.047885075,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":true},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.057462092,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Search (⇧⌘F)","depth":19,"bounds":{"left":0.0,"top":0.08619314,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.09577015,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Source Control (⌃⇧G) - 22 pending changes","depth":19,"bounds":{"left":0.0,"top":0.1245012,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.13407822,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"22","depth":22,"bounds":{"left":0.007978723,"top":0.1452514,"width":0.0039893617,"height":0.008778931},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.007978723,"top":0.14604948,"width":0.0023271276,"height":0.007980846}},{"char_start":1,"char_count":1,"bounds":{"left":0.009973404,"top":0.14604948,"width":0.0019946808,"height":0.007980846}}],"role_description":"text"},{"role":"AXRadioButton","text":"Run and Debug (⇧⌘D)","depth":19,"bounds":{"left":0.0,"top":0.16280925,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.17238627,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Remote Explorer","depth":19,"bounds":{"left":0.0,"top":0.20111732,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.21069433,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Extensions (⇧⌘X) - 2 require update","depth":19,"bounds":{"left":0.0,"top":0.23942538,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.2490024,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":22,"bounds":{"left":0.009640957,"top":0.2601756,"width":0.0019946808,"height":0.008778931},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Testing","depth":19,"bounds":{"left":0.0,"top":0.27773345,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.28731045,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Claude Code","depth":19,"bounds":{"left":0.0,"top":0.3160415,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"EXPLORER","depth":17,"bounds":{"left":0.022606382,"top":0.047885075,"width":0.018949468,"height":0.02793296},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"EXPLORER","depth":18,"bounds":{"left":0.022606382,"top":0.056664005,"width":0.018949468,"height":0.0103751},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.022606382,"top":0.056664005,"width":0.0023271276,"height":0.0103751}},{"char_start":1,"char_count":7,"bounds":{"left":0.024933511,"top":0.056664005,"width":0.01662234,"height":0.0103751}}],"role_description":"text"},{"role":"AXButton","text":"Explorer Section: app","depth":21,"bounds":{"left":0.015957447,"top":0.07581804,"width":0.09940159,"height":0.017557861},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"","depth":23,"bounds":{"left":0.01662234,"top":0.07821229,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"Explorer Section: app","depth":22,"bounds":{"left":0.022606382,"top":0.07581804,"width":0.0076462766,"height":0.017557861},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"APP","depth":23,"bounds":{"left":0.022606382,"top":0.079010375,"width":0.0076462766,"height":0.0103751},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.0933759,"width":0.0063164895,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"CheckAndRetryRemoteMatch.php","depth":27,"bounds":{"left":0.033909574,"top":0.0933759,"width":0.068484046,"height":0.011173184},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.0933759,"width":0.0029920214,"height":0.011971269}},{"char_start":1,"char_count":27,"bounds":{"left":0.036901597,"top":0.0933759,"width":0.06549202,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.10853951,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"CreateFollowupActivity.php","depth":27,"bounds":{"left":0.033909574,"top":0.110135674,"width":0.054853722,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.11093376,"width":0.0029920214,"height":0.011971269}},{"char_start":1,"char_count":25,"bounds":{"left":0.036901597,"top":0.11093376,"width":0.051861703,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.12609737,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"CreateNotes.php","depth":27,"bounds":{"left":0.033909574,"top":0.12769353,"width":0.034242023,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.12849163,"width":0.0029920214,"height":0.011971269}},{"char_start":1,"char_count":14,"bounds":{"left":0.036901597,"top":0.12849163,"width":0.03125,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.14365523,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"MatchActivitiesToNewOpportunity.php","depth":27,"bounds":{"left":0.033909574,"top":0.1452514,"width":0.07712766,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.14604948,"width":0.0039893617,"height":0.011971269}},{"char_start":1,"char_count":34,"bounds":{"left":0.037898935,"top":0.14604948,"width":0.07347074,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.16121309,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"MatchActivityCrmData.php","depth":27,"bounds":{"left":0.033909574,"top":0.16280925,"width":0.054521278,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.16360734,"width":0.0039893617,"height":0.011971269}},{"char_start":1,"char_count":23,"bounds":{"left":0.037898935,"top":0.16360734,"width":0.050531916,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"bounds":{"left":0.10638298,"top":0.16360734,"width":0.003656915,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.17877094,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"NoteObject.php","depth":27,"bounds":{"left":0.033909574,"top":0.18036711,"width":0.031914894,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.1811652,"width":0.0033244682,"height":0.011971269}},{"char_start":1,"char_count":13,"bounds":{"left":0.03723404,"top":0.1811652,"width":0.028922873,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.1963288,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SaveActivity.php","depth":27,"bounds":{"left":0.033909574,"top":0.19792499,"width":0.03324468,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.19872306,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":15,"bounds":{"left":0.03656915,"top":0.19872306,"width":0.030585106,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.21388668,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SaveTranscription.php","depth":27,"bounds":{"left":0.033909574,"top":0.21548285,"width":0.04454787,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.21628092,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":20,"bounds":{"left":0.03656915,"top":0.21628092,"width":0.042220745,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.23144454,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SetupLayout.php","depth":27,"bounds":{"left":0.033909574,"top":0.2330407,"width":0.034242023,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.23383878,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":14,"bounds":{"left":0.03656915,"top":0.23383878,"width":0.031914894,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.2490024,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SyncActivity.php","depth":27,"bounds":{"left":0.033909574,"top":0.25059855,"width":0.03357713,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.25139666,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":15,"bounds":{"left":0.03656915,"top":0.25139666,"width":0.030917553,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.26656026,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SyncFieldMetadata.php","depth":27,"bounds":{"left":0.033909574,"top":0.26815644,"width":0.047539894,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.26895452,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":20,"bounds":{"left":0.03656915,"top":0.26895452,"width":0.04488032,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.28411812,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SyncHubspotObjects.php","depth":27,"bounds":{"left":0.033909574,"top":0.2857143,"width":0.051861703,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.28651237,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":21,"bounds":{"left":0.03656915,"top":0.28651237,"width":0.04920213,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.30167598,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SyncLeads.php","depth":27,"bounds":{"left":0.033909574,"top":0.30327216,"width":0.030917553,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.30407023,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":12,"bounds":{"left":0.03656915,"top":0.30407023,"width":0.02825798,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.31923383,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SyncObjects.php","depth":27,"bounds":{"left":0.033909574,"top":0.32083002,"width":0.034574468,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.3216281,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":14,"bounds":{"left":0.03656915,"top":0.3216281,"width":0.031914894,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.3367917,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SyncOpportunitiesJob.php","depth":27,"bounds":{"left":0.033909574,"top":0.33838788,"width":0.053856384,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.33918595,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":23,"bounds":{"left":0.03656915,"top":0.33918595,"width":0.05119681,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.35434955,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SyncOpportunity.php","depth":27,"bounds":{"left":0.033909574,"top":0.35594574,"width":0.04288564,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.3567438,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":18,"bounds":{"left":0.03656915,"top":0.3567438,"width":0.040226065,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.3719074,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SyncProfileMetadata.php","depth":27,"bounds":{"left":0.033909574,"top":0.3735036,"width":0.05086436,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.37430167,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":22,"bounds":{"left":0.03656915,"top":0.37430167,"width":0.048204787,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.38946527,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SyncTeamFieldsJob.php","depth":27,"bounds":{"left":0.033909574,"top":0.39106146,"width":0.04886968,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.39185953,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":20,"bounds":{"left":0.03656915,"top":0.39185953,"width":0.046210106,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.40702313,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SyncTeamMetadata.php","depth":27,"bounds":{"left":0.033909574,"top":0.4086193,"width":0.048537236,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.4094174,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":19,"bounds":{"left":0.03656915,"top":0.4094174,"width":0.045877658,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.424581,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"UpdateOpportunitySpecifications.php","depth":27,"bounds":{"left":0.033909574,"top":0.42617717,"width":0.076130316,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.42697525,"width":0.0033244682,"height":0.011971269}},{"char_start":1,"char_count":34,"bounds":{"left":0.03723404,"top":0.42697525,"width":0.0731383,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.44213888,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"UpdateStage.php","depth":27,"bounds":{"left":0.033909574,"top":0.44373503,"width":0.03523936,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.4445331,"width":0.0033244682,"height":0.011971269}},{"char_start":1,"char_count":14,"bounds":{"left":0.03723404,"top":0.4445331,"width":0.032247342,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.024933511,"top":0.4612929,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"DealRisks","depth":27,"bounds":{"left":0.03125,"top":0.4612929,"width":0.019614361,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.46209097,"width":0.0033244682,"height":0.011971269}},{"char_start":1,"char_count":8,"bounds":{"left":0.034574468,"top":0.46209097,"width":0.016289894,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.024933511,"top":0.47885075,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Mailbox","depth":27,"bounds":{"left":0.03125,"top":0.47885075,"width":0.015625,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.47964883,"width":0.0039893617,"height":0.011971269}},{"char_start":1,"char_count":6,"bounds":{"left":0.03523936,"top":0.47964883,"width":0.011635638,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.024933511,"top":0.4964086,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"MeetingBot","depth":27,"bounds":{"left":0.03125,"top":0.4964086,"width":0.023271276,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.49720672,"width":0.0039893617,"height":0.011971269}},{"char_start":1,"char_count":9,"bounds":{"left":0.03523936,"top":0.49720672,"width":0.019281914,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.024933511,"top":0.5139665,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Middleware","depth":27,"bounds":{"left":0.03125,"top":0.5139665,"width":0.023271276,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.51476455,"width":0.0039893617,"height":0.011971269}},{"char_start":1,"char_count":9,"bounds":{"left":0.03523936,"top":0.51476455,"width":0.019281914,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.10605053,"top":0.51476455,"width":0.004654255,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.52992815,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"HandleHubspotRateLimit.php","depth":27,"bounds":{"left":0.033909574,"top":0.53152436,"width":0.059175532,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.5323224,"width":0.0033244682,"height":0.011971269}},{"char_start":1,"char_count":25,"bounds":{"left":0.03723404,"top":0.5323224,"width":0.05618351,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"bounds":{"left":0.10638298,"top":0.5323224,"width":0.003656915,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.026595745,"top":0.547486,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"RateLimited.php","depth":27,"bounds":{"left":0.033909574,"top":0.5490822,"width":0.032912236,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.033909574,"top":0.54988027,"width":0.0029920214,"height":0.011971269}},{"char_start":1,"char_count":14,"bounds":{"left":0.036901597,"top":0.54988027,"width":0.029920213,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.024933511,"top":0.5666401,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Streaming","depth":27,"bounds":{"left":0.03125,"top":0.5666401,"width":0.020611702,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.5674381,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":8,"bounds":{"left":0.033909574,"top":0.5674381,"width":0.017952127,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.024933511,"top":0.58419794,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Team","depth":27,"bounds":{"left":0.03125,"top":0.58419794,"width":0.010970744,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.584996,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":3,"bounds":{"left":0.03357713,"top":0.584996,"width":0.008643617,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.024933511,"top":0.6017558,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Telephony","depth":27,"bounds":{"left":0.03125,"top":0.6017558,"width":0.020611702,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.60255384,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":8,"bounds":{"left":0.03357713,"top":0.60255384,"width":0.018284574,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.024933511,"top":0.61931366,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"User","depth":27,"bounds":{"left":0.03125,"top":0.61931366,"width":0.00930851,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.6201117,"width":0.0033244682,"height":0.011971269}},{"char_start":1,"char_count":3,"bounds":{"left":0.034574468,"top":0.6201117,"width":0.0063164895,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.023936171,"top":0.63527536,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"BaseProcessingJob.php","depth":27,"bounds":{"left":0.03125,"top":0.6368715,"width":0.048537236,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.63766956,"width":0.0029920214,"height":0.011971269}},{"char_start":1,"char_count":20,"bounds":{"left":0.034242023,"top":0.63766956,"width":0.045545213,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.023936171,"top":0.6528332,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"DummyJob.php","depth":27,"bounds":{"left":0.03125,"top":0.6544294,"width":0.03158245,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.6552275,"width":0.0033244682,"height":0.011971269}},{"char_start":1,"char_count":11,"bounds":{"left":0.034574468,"top":0.6552275,"width":0.02825798,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.023936171,"top":0.6703911,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"ImportRecallAIRecordingsJob.php","depth":27,"bounds":{"left":0.03125,"top":0.67198724,"width":0.068484046,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.67278534,"width":0.0013297872,"height":0.011971269}},{"char_start":1,"char_count":30,"bounds":{"left":0.032579787,"top":0.67278534,"width":0.06715426,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.023936171,"top":0.68794894,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"ImportRemoteTrackJob.php","depth":27,"bounds":{"left":0.03125,"top":0.6895451,"width":0.055518616,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.6903432,"width":0.0013297872,"height":0.011971269}},{"char_start":1,"char_count":23,"bounds":{"left":0.032579787,"top":0.6903432,"width":0.054521278,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.023936171,"top":0.7055068,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Job.php","depth":27,"bounds":{"left":0.03125,"top":0.70710295,"width":0.016289894,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.70790106,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":6,"bounds":{"left":0.03357713,"top":0.70790106,"width":0.014295213,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.023936171,"top":0.72306466,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"JobDispatcher.php","depth":27,"bounds":{"left":0.03125,"top":0.7246608,"width":0.037898935,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.7254589,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":16,"bounds":{"left":0.03357713,"top":0.7254589,"width":0.035904255,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.023936171,"top":0.7406225,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"JobDispatcherInterface.php","depth":27,"bounds":{"left":0.03125,"top":0.7422187,"width":0.05618351,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.03125,"top":0.7430168,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":25,"bounds":{"left":0.03357713,"top":0.7430168,"width":0.05418883,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.023936171,"top":0.7581804,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"PurgeSoftDeletedOpportunityJob.php","depth":27,"bounds":{"left":0.03125,"top":0.75977653,"width":0.076130316,"height":0.011971269},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.023936171,"top":0.77573824,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SqsVisibilityControl.php","depth":27,"bounds":{"left":0.03125,"top":0.7773344,"width":0.047872342,"height":0.011971269},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.79489225,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Listeners","depth":27,"bounds":{"left":0.028590426,"top":0.79489225,"width":0.018284574,"height":0.011971269},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.8124501,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Mail","depth":27,"bounds":{"left":0.028590426,"top":0.8124501,"width":0.00831117,"height":0.011971269},"on_screen":true,"role_description":"text"}]...
|
-8047950601265403712
|
8239650277691425090
|
click
|
accessibility
|
NULL
|
Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧ Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧G) - 22 pending changes
22
Run and Debug (⇧⌘D)
Remote Explorer
Extensions (⇧⌘X) - 2 require update
2
Testing
Claude Code
EXPLORER
EXPLORER
Explorer Section: app
Explorer Section: app
APP
CheckAndRetryRemoteMatch.php
CreateFollowupActivity.php
CreateNotes.php
MatchActivitiesToNewOpportunity.php
MatchActivityCrmData.php
M
NoteObject.php
SaveActivity.php
SaveTranscription.php
SetupLayout.php
SyncActivity.php
SyncFieldMetadata.php
SyncHubspotObjects.php
SyncLeads.php
SyncObjects.php
SyncOpportunitiesJob.php
SyncOpportunity.php
SyncProfileMetadata.php
SyncTeamFieldsJob.php
SyncTeamMetadata.php
UpdateOpportunitySpecifications.php
UpdateStage.php
DealRisks
Mailbox
MeetingBot
Middleware
HandleHubspotRateLimit.php
M
RateLimited.php
Streaming
Team
Telephony
User
BaseProcessingJob.php
DummyJob.php
ImportRecallAIRecordingsJob.php
ImportRemoteTrackJob.php
Job.php
JobDispatcher.php
JobDispatcherInterface.php
PurgeSoftDeletedOpportunityJob.php
SqsVisibilityControl.php
Listeners
Mail...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
1063
|
39
|
6
|
2026-05-07T07:58:54.306236+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778140734306_m1.jpg...
|
PhpStorm
|
faVsco.js – ~/jiminny/app/vendor/laravel/framework faVsco.js – ~/jiminny/app/vendor/laravel/framework/src/Illuminate/Cache/RateLimiter.php...
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Code changed:
Hide
Sync Changes
Hide This Notification
37
1
35
63
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
Sync Changes
Hide This Notification
Code changed:
Hide
Reader Mode
Analyzing…
<?php
namespace Illuminate\Cache;
use Closure;
use Illuminate\Contracts\Cache\Repository as Cache;
use Illuminate\Redis\Connections\PhpRedisConnection;
use Illuminate\Support\Collection;
use Illuminate\Support\InteractsWithTime;
use function Illuminate\Support\enum_value;
class RateLimiter
{
use InteractsWithTime;
/**
* The cache store implementation.
*
* @var \Illuminate\Contracts\Cache\Repository
*/
protected $cache;
/**
* The configured limit object resolvers.
*
* @var array
*/
protected $limiters = [];
/**
* Create a new rate limiter instance.
*
* @param \Illuminate\Contracts\Cache\Repository $cache
*/
public function __construct(Cache $cache)
{
$this->cache = $cache;
}
/**
* Register a named rate limiter configuration.
*
* @param \UnitEnum|string $name
* @param \Closure $callback
* @return $this
*/
public function for($name, Closure $callback)
{
$resolvedName = $this->resolveLimiterName($name);
$this->limiters[$resolvedName] = $callback;
return $this;
}
/**
* Get the given named rate limiter.
*
* @param \UnitEnum|string $name
* @return \Closure|null
*/
public function limiter($name)
{
$resolvedName = $this->resolveLimiterName($name);
$limiter = $this->limiters[$resolvedName] ?? null;
if (! is_callable($limiter)) {
return;
}
return function (...$args) use ($limiter) {
$result = $limiter(...$args);
if (! is_array($result)) {
return $result;
}
$duplicates = (new Collection($result))->duplicates('key');
if ($duplicates->isEmpty()) {
return $result;
}
foreach ($result as $limit) {
if ($duplicates->contains($limit->key)) {
$limit->key = $limit->fallbackKey();
}
}
return $result;
};
}
/**
* Attempts to execute a callback if it's not limited.
*
* @param string $key
* @param int $maxAttempts
* @param \Closure $callback
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @return mixed
*/
public function attempt($key, $maxAttempts, Closure $callback, $decaySeconds = 60)
{
if ($this->tooManyAttempts($key, $maxAttempts)) {
return false;
}
if (is_null($result = $callback())) {
$result = true;
}
return tap($result, function () use ($key, $decaySeconds) {
$this->hit($key, $decaySeconds);
});
}
/**
* Determine if the given key has been "accessed" too many times.
*
* @param string $key
* @param int $maxAttempts
* @return bool
*/
public function tooManyAttempts($key, $maxAttempts)
{
if ($this->attempts($key) >= $maxAttempts) {
if ($this->cache->has($this->cleanRateLimiterKey($key).':timer')) {
return true;
}
$this->resetAttempts($key);
}
return false;
}
/**
* Increment (by 1) the counter for a given key for a given decay time.
*
* @param string $key
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @return int
*/
public function hit($key, $decaySeconds = 60)
{
return $this->increment($key, $decaySeconds);
}
/**
* Increment the counter for a given key for a given decay time by a given amount.
*
* @param string $key
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @param int $amount
* @return int
*/
public function increment($key, $decaySeconds = 60, $amount = 1)
{
$key = $this->cleanRateLimiterKey($key);
$this->cache->add(
$key.':timer', $this->availableAt($decaySeconds), $decaySeconds
);
$added = $this->withoutSerializationOrCompression(
fn () => $this->cache->add($key, 0, $decaySeconds)
);
$hits = (int) $this->cache->increment($key, $amount);
if (! $added && $hits == 1) {
$this->withoutSerializationOrCompression(
fn () => $this->cache->put($key, 1, $decaySeconds)
);
}
return $hits;
}
/**
* Decrement the counter for a given key for a given decay time by a given amount.
*
* @param string $key
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @param int $amount
* @return int
*/
public function decrement($key, $decaySeconds = 60, $amount = 1)
{
return $this->increment($key, $decaySeconds, $amount * -1);
}
/**
* Get the number of attempts for the given key.
*
* @param string $key
* @return mixed
*/
public function attempts($key)
{
$key = $this->cleanRateLimiterKey($key);
return $this->withoutSerializationOrCompression(fn () => $this->cache->get($key, 0));
}
/**
* Reset the number of attempts for the given key.
*
* @param string $key
* @return bool
*/
public function resetAttempts($key)
{
$key = $this->cleanRateLimiterKey($key);
return $this->cache->forget($key);
}
/**
* Get the number of retries left for the given key.
*
* @param string $key
* @param int $maxAttempts
* @return int
*/
public function remaining($key, $maxAttempts)
{
$key = $this->cleanRateLimiterKey($key);
$attempts = $this->attempts($key);
return max(0, $maxAttempts - $attempts);
}
/**
* Get the number of retries left for the given key.
*
* @param string $key
* @param int $maxAttempts
* @return int
*/
public function retriesLeft($key, $maxAttempts)
{
return $this->remaining($key, $maxAttempts);
}
/**
* Clear the hits and lockout timer for the given key.
*
* @param string $key
* @return void
*/
public function clear($key)
{
$key = $this->cleanRateLimiterKey($key);
$this->resetAttempts($key);
$this->cache->forget($key.':timer');
}
/**
* Get the number of seconds until the "key" is accessible again.
*
* @param string $key
* @return int
*/
public function availableIn($key)
{
$key = $this->cleanRateLimiterKey($key);
return max(0, $this->cache->get($key.':timer') - $this->currentTime());
}
/**
* Clean the rate limiter key from unicode characters.
*
* @param string $key
* @return string
*/
public function cleanRateLimiterKey($key)
{
return preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities($key));
}
/**
* Execute the given callback without serialization or compression when applicable.
*
* @param callable $callback
* @return mixed
*/
protected function withoutSerializationOrCompression(callable $callback)
{
$store = $this->cache->getStore();
if (! $store instanceof RedisStore) {
return $callback();
}
$connection = $store->connection();
if (! $connection instanceof PhpRedisConnection) {
return $callback();
}
return $connection->withoutSerializationOrCompression($callback);
}
/**
* Resolve the rate limiter name.
*
* @param \UnitEnum|string $name
* @return string
*/
private function resolveLimiterName($name): string
{
return (string) enum_value($name);
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"37","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"35","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"63","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;","depth":4,"on_screen":true,"value":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reader Mode","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Analyzing…","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"<?php\n\nnamespace Illuminate\\Cache;\n\nuse Closure;\nuse Illuminate\\Contracts\\Cache\\Repository as Cache;\nuse Illuminate\\Redis\\Connections\\PhpRedisConnection;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\InteractsWithTime;\n\nuse function Illuminate\\Support\\enum_value;\n\nclass RateLimiter\n{\n use InteractsWithTime;\n\n /**\n * The cache store implementation.\n *\n * @var \\Illuminate\\Contracts\\Cache\\Repository\n */\n protected $cache;\n\n /**\n * The configured limit object resolvers.\n *\n * @var array\n */\n protected $limiters = [];\n\n /**\n * Create a new rate limiter instance.\n *\n * @param \\Illuminate\\Contracts\\Cache\\Repository $cache\n */\n public function __construct(Cache $cache)\n {\n $this->cache = $cache;\n }\n\n /**\n * Register a named rate limiter configuration.\n *\n * @param \\UnitEnum|string $name\n * @param \\Closure $callback\n * @return $this\n */\n public function for($name, Closure $callback)\n {\n $resolvedName = $this->resolveLimiterName($name);\n\n $this->limiters[$resolvedName] = $callback;\n\n return $this;\n }\n\n /**\n * Get the given named rate limiter.\n *\n * @param \\UnitEnum|string $name\n * @return \\Closure|null\n */\n public function limiter($name)\n {\n $resolvedName = $this->resolveLimiterName($name);\n\n $limiter = $this->limiters[$resolvedName] ?? null;\n\n if (! is_callable($limiter)) {\n return;\n }\n\n return function (...$args) use ($limiter) {\n $result = $limiter(...$args);\n\n if (! is_array($result)) {\n return $result;\n }\n\n $duplicates = (new Collection($result))->duplicates('key');\n\n if ($duplicates->isEmpty()) {\n return $result;\n }\n\n foreach ($result as $limit) {\n if ($duplicates->contains($limit->key)) {\n $limit->key = $limit->fallbackKey();\n }\n }\n\n return $result;\n };\n }\n\n /**\n * Attempts to execute a callback if it's not limited.\n *\n * @param string $key\n * @param int $maxAttempts\n * @param \\Closure $callback\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @return mixed\n */\n public function attempt($key, $maxAttempts, Closure $callback, $decaySeconds = 60)\n {\n if ($this->tooManyAttempts($key, $maxAttempts)) {\n return false;\n }\n\n if (is_null($result = $callback())) {\n $result = true;\n }\n\n return tap($result, function () use ($key, $decaySeconds) {\n $this->hit($key, $decaySeconds);\n });\n }\n\n /**\n * Determine if the given key has been \"accessed\" too many times.\n *\n * @param string $key\n * @param int $maxAttempts\n * @return bool\n */\n public function tooManyAttempts($key, $maxAttempts)\n {\n if ($this->attempts($key) >= $maxAttempts) {\n if ($this->cache->has($this->cleanRateLimiterKey($key).':timer')) {\n return true;\n }\n\n $this->resetAttempts($key);\n }\n\n return false;\n }\n\n /**\n * Increment (by 1) the counter for a given key for a given decay time.\n *\n * @param string $key\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @return int\n */\n public function hit($key, $decaySeconds = 60)\n {\n return $this->increment($key, $decaySeconds);\n }\n\n /**\n * Increment the counter for a given key for a given decay time by a given amount.\n *\n * @param string $key\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @param int $amount\n * @return int\n */\n public function increment($key, $decaySeconds = 60, $amount = 1)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n $this->cache->add(\n $key.':timer', $this->availableAt($decaySeconds), $decaySeconds\n );\n\n $added = $this->withoutSerializationOrCompression(\n fn () => $this->cache->add($key, 0, $decaySeconds)\n );\n\n $hits = (int) $this->cache->increment($key, $amount);\n\n if (! $added && $hits == 1) {\n $this->withoutSerializationOrCompression(\n fn () => $this->cache->put($key, 1, $decaySeconds)\n );\n }\n\n return $hits;\n }\n\n /**\n * Decrement the counter for a given key for a given decay time by a given amount.\n *\n * @param string $key\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @param int $amount\n * @return int\n */\n public function decrement($key, $decaySeconds = 60, $amount = 1)\n {\n return $this->increment($key, $decaySeconds, $amount * -1);\n }\n\n /**\n * Get the number of attempts for the given key.\n *\n * @param string $key\n * @return mixed\n */\n public function attempts($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n return $this->withoutSerializationOrCompression(fn () => $this->cache->get($key, 0));\n }\n\n /**\n * Reset the number of attempts for the given key.\n *\n * @param string $key\n * @return bool\n */\n public function resetAttempts($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n return $this->cache->forget($key);\n }\n\n /**\n * Get the number of retries left for the given key.\n *\n * @param string $key\n * @param int $maxAttempts\n * @return int\n */\n public function remaining($key, $maxAttempts)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n $attempts = $this->attempts($key);\n\n return max(0, $maxAttempts - $attempts);\n }\n\n /**\n * Get the number of retries left for the given key.\n *\n * @param string $key\n * @param int $maxAttempts\n * @return int\n */\n public function retriesLeft($key, $maxAttempts)\n {\n return $this->remaining($key, $maxAttempts);\n }\n\n /**\n * Clear the hits and lockout timer for the given key.\n *\n * @param string $key\n * @return void\n */\n public function clear($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n $this->resetAttempts($key);\n\n $this->cache->forget($key.':timer');\n }\n\n /**\n * Get the number of seconds until the \"key\" is accessible again.\n *\n * @param string $key\n * @return int\n */\n public function availableIn($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n return max(0, $this->cache->get($key.':timer') - $this->currentTime());\n }\n\n /**\n * Clean the rate limiter key from unicode characters.\n *\n * @param string $key\n * @return string\n */\n public function cleanRateLimiterKey($key)\n {\n return preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities($key));\n }\n\n /**\n * Execute the given callback without serialization or compression when applicable.\n *\n * @param callable $callback\n * @return mixed\n */\n protected function withoutSerializationOrCompression(callable $callback)\n {\n $store = $this->cache->getStore();\n\n if (! $store instanceof RedisStore) {\n return $callback();\n }\n\n $connection = $store->connection();\n\n if (! $connection instanceof PhpRedisConnection) {\n return $callback();\n }\n\n return $connection->withoutSerializationOrCompression($callback);\n }\n\n /**\n * Resolve the rate limiter name.\n *\n * @param \\UnitEnum|string $name\n * @return string\n */\n private function resolveLimiterName($name): string\n {\n return (string) enum_value($name);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Illuminate\\Cache;\n\nuse Closure;\nuse Illuminate\\Contracts\\Cache\\Repository as Cache;\nuse Illuminate\\Redis\\Connections\\PhpRedisConnection;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\InteractsWithTime;\n\nuse function Illuminate\\Support\\enum_value;\n\nclass RateLimiter\n{\n use InteractsWithTime;\n\n /**\n * The cache store implementation.\n *\n * @var \\Illuminate\\Contracts\\Cache\\Repository\n */\n protected $cache;\n\n /**\n * The configured limit object resolvers.\n *\n * @var array\n */\n protected $limiters = [];\n\n /**\n * Create a new rate limiter instance.\n *\n * @param \\Illuminate\\Contracts\\Cache\\Repository $cache\n */\n public function __construct(Cache $cache)\n {\n $this->cache = $cache;\n }\n\n /**\n * Register a named rate limiter configuration.\n *\n * @param \\UnitEnum|string $name\n * @param \\Closure $callback\n * @return $this\n */\n public function for($name, Closure $callback)\n {\n $resolvedName = $this->resolveLimiterName($name);\n\n $this->limiters[$resolvedName] = $callback;\n\n return $this;\n }\n\n /**\n * Get the given named rate limiter.\n *\n * @param \\UnitEnum|string $name\n * @return \\Closure|null\n */\n public function limiter($name)\n {\n $resolvedName = $this->resolveLimiterName($name);\n\n $limiter = $this->limiters[$resolvedName] ?? null;\n\n if (! is_callable($limiter)) {\n return;\n }\n\n return function (...$args) use ($limiter) {\n $result = $limiter(...$args);\n\n if (! is_array($result)) {\n return $result;\n }\n\n $duplicates = (new Collection($result))->duplicates('key');\n\n if ($duplicates->isEmpty()) {\n return $result;\n }\n\n foreach ($result as $limit) {\n if ($duplicates->contains($limit->key)) {\n $limit->key = $limit->fallbackKey();\n }\n }\n\n return $result;\n };\n }\n\n /**\n * Attempts to execute a callback if it's not limited.\n *\n * @param string $key\n * @param int $maxAttempts\n * @param \\Closure $callback\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @return mixed\n */\n public function attempt($key, $maxAttempts, Closure $callback, $decaySeconds = 60)\n {\n if ($this->tooManyAttempts($key, $maxAttempts)) {\n return false;\n }\n\n if (is_null($result = $callback())) {\n $result = true;\n }\n\n return tap($result, function () use ($key, $decaySeconds) {\n $this->hit($key, $decaySeconds);\n });\n }\n\n /**\n * Determine if the given key has been \"accessed\" too many times.\n *\n * @param string $key\n * @param int $maxAttempts\n * @return bool\n */\n public function tooManyAttempts($key, $maxAttempts)\n {\n if ($this->attempts($key) >= $maxAttempts) {\n if ($this->cache->has($this->cleanRateLimiterKey($key).':timer')) {\n return true;\n }\n\n $this->resetAttempts($key);\n }\n\n return false;\n }\n\n /**\n * Increment (by 1) the counter for a given key for a given decay time.\n *\n * @param string $key\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @return int\n */\n public function hit($key, $decaySeconds = 60)\n {\n return $this->increment($key, $decaySeconds);\n }\n\n /**\n * Increment the counter for a given key for a given decay time by a given amount.\n *\n * @param string $key\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @param int $amount\n * @return int\n */\n public function increment($key, $decaySeconds = 60, $amount = 1)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n $this->cache->add(\n $key.':timer', $this->availableAt($decaySeconds), $decaySeconds\n );\n\n $added = $this->withoutSerializationOrCompression(\n fn () => $this->cache->add($key, 0, $decaySeconds)\n );\n\n $hits = (int) $this->cache->increment($key, $amount);\n\n if (! $added && $hits == 1) {\n $this->withoutSerializationOrCompression(\n fn () => $this->cache->put($key, 1, $decaySeconds)\n );\n }\n\n return $hits;\n }\n\n /**\n * Decrement the counter for a given key for a given decay time by a given amount.\n *\n * @param string $key\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @param int $amount\n * @return int\n */\n public function decrement($key, $decaySeconds = 60, $amount = 1)\n {\n return $this->increment($key, $decaySeconds, $amount * -1);\n }\n\n /**\n * Get the number of attempts for the given key.\n *\n * @param string $key\n * @return mixed\n */\n public function attempts($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n return $this->withoutSerializationOrCompression(fn () => $this->cache->get($key, 0));\n }\n\n /**\n * Reset the number of attempts for the given key.\n *\n * @param string $key\n * @return bool\n */\n public function resetAttempts($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n return $this->cache->forget($key);\n }\n\n /**\n * Get the number of retries left for the given key.\n *\n * @param string $key\n * @param int $maxAttempts\n * @return int\n */\n public function remaining($key, $maxAttempts)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n $attempts = $this->attempts($key);\n\n return max(0, $maxAttempts - $attempts);\n }\n\n /**\n * Get the number of retries left for the given key.\n *\n * @param string $key\n * @param int $maxAttempts\n * @return int\n */\n public function retriesLeft($key, $maxAttempts)\n {\n return $this->remaining($key, $maxAttempts);\n }\n\n /**\n * Clear the hits and lockout timer for the given key.\n *\n * @param string $key\n * @return void\n */\n public function clear($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n $this->resetAttempts($key);\n\n $this->cache->forget($key.':timer');\n }\n\n /**\n * Get the number of seconds until the \"key\" is accessible again.\n *\n * @param string $key\n * @return int\n */\n public function availableIn($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n return max(0, $this->cache->get($key.':timer') - $this->currentTime());\n }\n\n /**\n * Clean the rate limiter key from unicode characters.\n *\n * @param string $key\n * @return string\n */\n public function cleanRateLimiterKey($key)\n {\n return preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities($key));\n }\n\n /**\n * Execute the given callback without serialization or compression when applicable.\n *\n * @param callable $callback\n * @return mixed\n */\n protected function withoutSerializationOrCompression(callable $callback)\n {\n $store = $this->cache->getStore();\n\n if (! $store instanceof RedisStore) {\n return $callback();\n }\n\n $connection = $store->connection();\n\n if (! $connection instanceof PhpRedisConnection) {\n return $callback();\n }\n\n return $connection->withoutSerializationOrCompression($callback);\n }\n\n /**\n * Resolve the rate limiter name.\n *\n * @param \\UnitEnum|string $name\n * @return string\n */\n private function resolveLimiterName($name): string\n {\n return (string) enum_value($name);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8047415539140187333
|
1065731412833220165
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Code changed:
Hide
Sync Changes
Hide This Notification
37
1
35
63
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
Sync Changes
Hide This Notification
Code changed:
Hide
Reader Mode
Analyzing…
<?php
namespace Illuminate\Cache;
use Closure;
use Illuminate\Contracts\Cache\Repository as Cache;
use Illuminate\Redis\Connections\PhpRedisConnection;
use Illuminate\Support\Collection;
use Illuminate\Support\InteractsWithTime;
use function Illuminate\Support\enum_value;
class RateLimiter
{
use InteractsWithTime;
/**
* The cache store implementation.
*
* @var \Illuminate\Contracts\Cache\Repository
*/
protected $cache;
/**
* The configured limit object resolvers.
*
* @var array
*/
protected $limiters = [];
/**
* Create a new rate limiter instance.
*
* @param \Illuminate\Contracts\Cache\Repository $cache
*/
public function __construct(Cache $cache)
{
$this->cache = $cache;
}
/**
* Register a named rate limiter configuration.
*
* @param \UnitEnum|string $name
* @param \Closure $callback
* @return $this
*/
public function for($name, Closure $callback)
{
$resolvedName = $this->resolveLimiterName($name);
$this->limiters[$resolvedName] = $callback;
return $this;
}
/**
* Get the given named rate limiter.
*
* @param \UnitEnum|string $name
* @return \Closure|null
*/
public function limiter($name)
{
$resolvedName = $this->resolveLimiterName($name);
$limiter = $this->limiters[$resolvedName] ?? null;
if (! is_callable($limiter)) {
return;
}
return function (...$args) use ($limiter) {
$result = $limiter(...$args);
if (! is_array($result)) {
return $result;
}
$duplicates = (new Collection($result))->duplicates('key');
if ($duplicates->isEmpty()) {
return $result;
}
foreach ($result as $limit) {
if ($duplicates->contains($limit->key)) {
$limit->key = $limit->fallbackKey();
}
}
return $result;
};
}
/**
* Attempts to execute a callback if it's not limited.
*
* @param string $key
* @param int $maxAttempts
* @param \Closure $callback
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @return mixed
*/
public function attempt($key, $maxAttempts, Closure $callback, $decaySeconds = 60)
{
if ($this->tooManyAttempts($key, $maxAttempts)) {
return false;
}
if (is_null($result = $callback())) {
$result = true;
}
return tap($result, function () use ($key, $decaySeconds) {
$this->hit($key, $decaySeconds);
});
}
/**
* Determine if the given key has been "accessed" too many times.
*
* @param string $key
* @param int $maxAttempts
* @return bool
*/
public function tooManyAttempts($key, $maxAttempts)
{
if ($this->attempts($key) >= $maxAttempts) {
if ($this->cache->has($this->cleanRateLimiterKey($key).':timer')) {
return true;
}
$this->resetAttempts($key);
}
return false;
}
/**
* Increment (by 1) the counter for a given key for a given decay time.
*
* @param string $key
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @return int
*/
public function hit($key, $decaySeconds = 60)
{
return $this->increment($key, $decaySeconds);
}
/**
* Increment the counter for a given key for a given decay time by a given amount.
*
* @param string $key
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @param int $amount
* @return int
*/
public function increment($key, $decaySeconds = 60, $amount = 1)
{
$key = $this->cleanRateLimiterKey($key);
$this->cache->add(
$key.':timer', $this->availableAt($decaySeconds), $decaySeconds
);
$added = $this->withoutSerializationOrCompression(
fn () => $this->cache->add($key, 0, $decaySeconds)
);
$hits = (int) $this->cache->increment($key, $amount);
if (! $added && $hits == 1) {
$this->withoutSerializationOrCompression(
fn () => $this->cache->put($key, 1, $decaySeconds)
);
}
return $hits;
}
/**
* Decrement the counter for a given key for a given decay time by a given amount.
*
* @param string $key
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @param int $amount
* @return int
*/
public function decrement($key, $decaySeconds = 60, $amount = 1)
{
return $this->increment($key, $decaySeconds, $amount * -1);
}
/**
* Get the number of attempts for the given key.
*
* @param string $key
* @return mixed
*/
public function attempts($key)
{
$key = $this->cleanRateLimiterKey($key);
return $this->withoutSerializationOrCompression(fn () => $this->cache->get($key, 0));
}
/**
* Reset the number of attempts for the given key.
*
* @param string $key
* @return bool
*/
public function resetAttempts($key)
{
$key = $this->cleanRateLimiterKey($key);
return $this->cache->forget($key);
}
/**
* Get the number of retries left for the given key.
*
* @param string $key
* @param int $maxAttempts
* @return int
*/
public function remaining($key, $maxAttempts)
{
$key = $this->cleanRateLimiterKey($key);
$attempts = $this->attempts($key);
return max(0, $maxAttempts - $attempts);
}
/**
* Get the number of retries left for the given key.
*
* @param string $key
* @param int $maxAttempts
* @return int
*/
public function retriesLeft($key, $maxAttempts)
{
return $this->remaining($key, $maxAttempts);
}
/**
* Clear the hits and lockout timer for the given key.
*
* @param string $key
* @return void
*/
public function clear($key)
{
$key = $this->cleanRateLimiterKey($key);
$this->resetAttempts($key);
$this->cache->forget($key.':timer');
}
/**
* Get the number of seconds until the "key" is accessible again.
*
* @param string $key
* @return int
*/
public function availableIn($key)
{
$key = $this->cleanRateLimiterKey($key);
return max(0, $this->cache->get($key.':timer') - $this->currentTime());
}
/**
* Clean the rate limiter key from unicode characters.
*
* @param string $key
* @return string
*/
public function cleanRateLimiterKey($key)
{
return preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities($key));
}
/**
* Execute the given callback without serialization or compression when applicable.
*
* @param callable $callback
* @return mixed
*/
protected function withoutSerializationOrCompression(callable $callback)
{
$store = $this->cache->getStore();
if (! $store instanceof RedisStore) {
return $callback();
}
$connection = $store->connection();
if (! $connection instanceof PhpRedisConnection) {
return $callback();
}
return $connection->withoutSerializationOrCompression($callback);
}
/**
* Resolve the rate limiter name.
*
* @param \UnitEnum|string $name
* @return string
*/
private function resolveLimiterName($name): string
{
return (string) enum_value($name);
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
1061
|
NULL
|
NULL
|
NULL
|
|
1064
|
40
|
10
|
2026-05-07T07:58:54.238604+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778140734238_m2.jpg...
|
PhpStorm
|
faVsco.js – ~/jiminny/app/vendor/laravel/framework faVsco.js – ~/jiminny/app/vendor/laravel/framework/src/Illuminate/Cache/RateLimiter.php...
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Code changed:
Hide
Sync Changes
Hide This Notification
37
1
35
63
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
Sync Changes
Hide This Notification
Code changed:
Hide
Reader Mode
Analyzing…
<?php
namespace Illuminate\Cache;
use Closure;
use Illuminate\Contracts\Cache\Repository as Cache;
use Illuminate\Redis\Connections\PhpRedisConnection;
use Illuminate\Support\Collection;
use Illuminate\Support\InteractsWithTime;
use function Illuminate\Support\enum_value;
class RateLimiter
{
use InteractsWithTime;
/**
* The cache store implementation.
*
* @var \Illuminate\Contracts\Cache\Repository
*/
protected $cache;
/**
* The configured limit object resolvers.
*
* @var array
*/
protected $limiters = [];
/**
* Create a new rate limiter instance.
*
* @param \Illuminate\Contracts\Cache\Repository $cache
*/
public function __construct(Cache $cache)
{
$this->cache = $cache;
}
/**
* Register a named rate limiter configuration.
*
* @param \UnitEnum|string $name
* @param \Closure $callback
* @return $this
*/
public function for($name, Closure $callback)
{
$resolvedName = $this->resolveLimiterName($name);
$this->limiters[$resolvedName] = $callback;
return $this;
}
/**
* Get the given named rate limiter.
*
* @param \UnitEnum|string $name
* @return \Closure|null
*/
public function limiter($name)
{
$resolvedName = $this->resolveLimiterName($name);
$limiter = $this->limiters[$resolvedName] ?? null;
if (! is_callable($limiter)) {
return;
}
return function (...$args) use ($limiter) {
$result = $limiter(...$args);
if (! is_array($result)) {
return $result;
}
$duplicates = (new Collection($result))->duplicates('key');
if ($duplicates->isEmpty()) {
return $result;
}
foreach ($result as $limit) {
if ($duplicates->contains($limit->key)) {
$limit->key = $limit->fallbackKey();
}
}
return $result;
};
}
/**
* Attempts to execute a callback if it's not limited.
*
* @param string $key
* @param int $maxAttempts
* @param \Closure $callback
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @return mixed
*/
public function attempt($key, $maxAttempts, Closure $callback, $decaySeconds = 60)
{
if ($this->tooManyAttempts($key, $maxAttempts)) {
return false;
}
if (is_null($result = $callback())) {
$result = true;
}
return tap($result, function () use ($key, $decaySeconds) {
$this->hit($key, $decaySeconds);
});
}
/**
* Determine if the given key has been "accessed" too many times.
*
* @param string $key
* @param int $maxAttempts
* @return bool
*/
public function tooManyAttempts($key, $maxAttempts)
{
if ($this->attempts($key) >= $maxAttempts) {
if ($this->cache->has($this->cleanRateLimiterKey($key).':timer')) {
return true;
}
$this->resetAttempts($key);
}
return false;
}
/**
* Increment (by 1) the counter for a given key for a given decay time.
*
* @param string $key
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @return int
*/
public function hit($key, $decaySeconds = 60)
{
return $this->increment($key, $decaySeconds);
}
/**
* Increment the counter for a given key for a given decay time by a given amount.
*
* @param string $key
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @param int $amount
* @return int
*/
public function increment($key, $decaySeconds = 60, $amount = 1)
{
$key = $this->cleanRateLimiterKey($key);
$this->cache->add(
$key.':timer', $this->availableAt($decaySeconds), $decaySeconds
);
$added = $this->withoutSerializationOrCompression(
fn () => $this->cache->add($key, 0, $decaySeconds)
);
$hits = (int) $this->cache->increment($key, $amount);
if (! $added && $hits == 1) {
$this->withoutSerializationOrCompression(
fn () => $this->cache->put($key, 1, $decaySeconds)
);
}
return $hits;
}
/**
* Decrement the counter for a given key for a given decay time by a given amount.
*
* @param string $key
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @param int $amount
* @return int
*/
public function decrement($key, $decaySeconds = 60, $amount = 1)
{
return $this->increment($key, $decaySeconds, $amount * -1);
}
/**
* Get the number of attempts for the given key.
*
* @param string $key
* @return mixed
*/
public function attempts($key)
{
$key = $this->cleanRateLimiterKey($key);
return $this->withoutSerializationOrCompression(fn () => $this->cache->get($key, 0));
}
/**
* Reset the number of attempts for the given key.
*
* @param string $key
* @return bool
*/
public function resetAttempts($key)
{
$key = $this->cleanRateLimiterKey($key);
return $this->cache->forget($key);
}
/**
* Get the number of retries left for the given key.
*
* @param string $key
* @param int $maxAttempts
* @return int
*/
public function remaining($key, $maxAttempts)
{
$key = $this->cleanRateLimiterKey($key);
$attempts = $this->attempts($key);
return max(0, $maxAttempts - $attempts);
}
/**
* Get the number of retries left for the given key.
*
* @param string $key
* @param int $maxAttempts
* @return int
*/
public function retriesLeft($key, $maxAttempts)
{
return $this->remaining($key, $maxAttempts);
}
/**
* Clear the hits and lockout timer for the given key.
*
* @param string $key
* @return void
*/
public function clear($key)
{
$key = $this->cleanRateLimiterKey($key);
$this->resetAttempts($key);
$this->cache->forget($key.':timer');
}
/**
* Get the number of seconds until the "key" is accessible again.
*
* @param string $key
* @return int
*/
public function availableIn($key)
{
$key = $this->cleanRateLimiterKey($key);
return max(0, $this->cache->get($key.':timer') - $this->currentTime());
}
/**
* Clean the rate limiter key from unicode characters.
*
* @param string $key
* @return string
*/
public function cleanRateLimiterKey($key)
{
return preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities($key));
}
/**
* Execute the given callback without serialization or compression when applicable.
*
* @param callable $callback
* @return mixed
*/
protected function withoutSerializationOrCompression(callable $callback)
{
$store = $this->cache->getStore();
if (! $store instanceof RedisStore) {
return $callback();
}
$connection = $store->connection();
if (! $connection instanceof PhpRedisConnection) {
return $callback();
}
return $connection->withoutSerializationOrCompression($callback);
}
/**
* Resolve the rate limiter name.
*
* @param \UnitEnum|string $name
* @return string
*/
private function resolveLimiterName($name): string
{
return (string) enum_value($name);
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.034242023,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.38297874,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.39162233,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.40259308,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.4112367,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.41988033,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.43085107,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.4418218,"top":0.09896249,"width":0.024268618,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.46841756,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.4793883,"top":0.09896249,"width":0.029587766,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.65359044,"top":0.09896249,"width":0.02825798,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"37","depth":4,"bounds":{"left":0.62333775,"top":0.123703115,"width":0.009973404,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.6353058,"top":0.123703115,"width":0.00731383,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"35","depth":4,"bounds":{"left":0.64461434,"top":0.123703115,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"63","depth":4,"bounds":{"left":0.6569149,"top":0.123703115,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.66888297,"top":0.12210695,"width":0.00731383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.6761968,"top":0.12210695,"width":0.006981383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;","depth":4,"on_screen":true,"value":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reader Mode","depth":4,"bounds":{"left":0.30784574,"top":0.09896249,"width":0.034574468,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Analyzing…","depth":4,"bounds":{"left":0.35837767,"top":0.10055866,"width":0.019946808,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"<?php\n\nnamespace Illuminate\\Cache;\n\nuse Closure;\nuse Illuminate\\Contracts\\Cache\\Repository as Cache;\nuse Illuminate\\Redis\\Connections\\PhpRedisConnection;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\InteractsWithTime;\n\nuse function Illuminate\\Support\\enum_value;\n\nclass RateLimiter\n{\n use InteractsWithTime;\n\n /**\n * The cache store implementation.\n *\n * @var \\Illuminate\\Contracts\\Cache\\Repository\n */\n protected $cache;\n\n /**\n * The configured limit object resolvers.\n *\n * @var array\n */\n protected $limiters = [];\n\n /**\n * Create a new rate limiter instance.\n *\n * @param \\Illuminate\\Contracts\\Cache\\Repository $cache\n */\n public function __construct(Cache $cache)\n {\n $this->cache = $cache;\n }\n\n /**\n * Register a named rate limiter configuration.\n *\n * @param \\UnitEnum|string $name\n * @param \\Closure $callback\n * @return $this\n */\n public function for($name, Closure $callback)\n {\n $resolvedName = $this->resolveLimiterName($name);\n\n $this->limiters[$resolvedName] = $callback;\n\n return $this;\n }\n\n /**\n * Get the given named rate limiter.\n *\n * @param \\UnitEnum|string $name\n * @return \\Closure|null\n */\n public function limiter($name)\n {\n $resolvedName = $this->resolveLimiterName($name);\n\n $limiter = $this->limiters[$resolvedName] ?? null;\n\n if (! is_callable($limiter)) {\n return;\n }\n\n return function (...$args) use ($limiter) {\n $result = $limiter(...$args);\n\n if (! is_array($result)) {\n return $result;\n }\n\n $duplicates = (new Collection($result))->duplicates('key');\n\n if ($duplicates->isEmpty()) {\n return $result;\n }\n\n foreach ($result as $limit) {\n if ($duplicates->contains($limit->key)) {\n $limit->key = $limit->fallbackKey();\n }\n }\n\n return $result;\n };\n }\n\n /**\n * Attempts to execute a callback if it's not limited.\n *\n * @param string $key\n * @param int $maxAttempts\n * @param \\Closure $callback\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @return mixed\n */\n public function attempt($key, $maxAttempts, Closure $callback, $decaySeconds = 60)\n {\n if ($this->tooManyAttempts($key, $maxAttempts)) {\n return false;\n }\n\n if (is_null($result = $callback())) {\n $result = true;\n }\n\n return tap($result, function () use ($key, $decaySeconds) {\n $this->hit($key, $decaySeconds);\n });\n }\n\n /**\n * Determine if the given key has been \"accessed\" too many times.\n *\n * @param string $key\n * @param int $maxAttempts\n * @return bool\n */\n public function tooManyAttempts($key, $maxAttempts)\n {\n if ($this->attempts($key) >= $maxAttempts) {\n if ($this->cache->has($this->cleanRateLimiterKey($key).':timer')) {\n return true;\n }\n\n $this->resetAttempts($key);\n }\n\n return false;\n }\n\n /**\n * Increment (by 1) the counter for a given key for a given decay time.\n *\n * @param string $key\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @return int\n */\n public function hit($key, $decaySeconds = 60)\n {\n return $this->increment($key, $decaySeconds);\n }\n\n /**\n * Increment the counter for a given key for a given decay time by a given amount.\n *\n * @param string $key\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @param int $amount\n * @return int\n */\n public function increment($key, $decaySeconds = 60, $amount = 1)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n $this->cache->add(\n $key.':timer', $this->availableAt($decaySeconds), $decaySeconds\n );\n\n $added = $this->withoutSerializationOrCompression(\n fn () => $this->cache->add($key, 0, $decaySeconds)\n );\n\n $hits = (int) $this->cache->increment($key, $amount);\n\n if (! $added && $hits == 1) {\n $this->withoutSerializationOrCompression(\n fn () => $this->cache->put($key, 1, $decaySeconds)\n );\n }\n\n return $hits;\n }\n\n /**\n * Decrement the counter for a given key for a given decay time by a given amount.\n *\n * @param string $key\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @param int $amount\n * @return int\n */\n public function decrement($key, $decaySeconds = 60, $amount = 1)\n {\n return $this->increment($key, $decaySeconds, $amount * -1);\n }\n\n /**\n * Get the number of attempts for the given key.\n *\n * @param string $key\n * @return mixed\n */\n public function attempts($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n return $this->withoutSerializationOrCompression(fn () => $this->cache->get($key, 0));\n }\n\n /**\n * Reset the number of attempts for the given key.\n *\n * @param string $key\n * @return bool\n */\n public function resetAttempts($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n return $this->cache->forget($key);\n }\n\n /**\n * Get the number of retries left for the given key.\n *\n * @param string $key\n * @param int $maxAttempts\n * @return int\n */\n public function remaining($key, $maxAttempts)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n $attempts = $this->attempts($key);\n\n return max(0, $maxAttempts - $attempts);\n }\n\n /**\n * Get the number of retries left for the given key.\n *\n * @param string $key\n * @param int $maxAttempts\n * @return int\n */\n public function retriesLeft($key, $maxAttempts)\n {\n return $this->remaining($key, $maxAttempts);\n }\n\n /**\n * Clear the hits and lockout timer for the given key.\n *\n * @param string $key\n * @return void\n */\n public function clear($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n $this->resetAttempts($key);\n\n $this->cache->forget($key.':timer');\n }\n\n /**\n * Get the number of seconds until the \"key\" is accessible again.\n *\n * @param string $key\n * @return int\n */\n public function availableIn($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n return max(0, $this->cache->get($key.':timer') - $this->currentTime());\n }\n\n /**\n * Clean the rate limiter key from unicode characters.\n *\n * @param string $key\n * @return string\n */\n public function cleanRateLimiterKey($key)\n {\n return preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities($key));\n }\n\n /**\n * Execute the given callback without serialization or compression when applicable.\n *\n * @param callable $callback\n * @return mixed\n */\n protected function withoutSerializationOrCompression(callable $callback)\n {\n $store = $this->cache->getStore();\n\n if (! $store instanceof RedisStore) {\n return $callback();\n }\n\n $connection = $store->connection();\n\n if (! $connection instanceof PhpRedisConnection) {\n return $callback();\n }\n\n return $connection->withoutSerializationOrCompression($callback);\n }\n\n /**\n * Resolve the rate limiter name.\n *\n * @param \\UnitEnum|string $name\n * @return string\n */\n private function resolveLimiterName($name): string\n {\n return (string) enum_value($name);\n }\n}","depth":4,"bounds":{"left":0.122340426,"top":0.096568234,"width":0.25897607,"height":0.9034318},"on_screen":true,"value":"<?php\n\nnamespace Illuminate\\Cache;\n\nuse Closure;\nuse Illuminate\\Contracts\\Cache\\Repository as Cache;\nuse Illuminate\\Redis\\Connections\\PhpRedisConnection;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\InteractsWithTime;\n\nuse function Illuminate\\Support\\enum_value;\n\nclass RateLimiter\n{\n use InteractsWithTime;\n\n /**\n * The cache store implementation.\n *\n * @var \\Illuminate\\Contracts\\Cache\\Repository\n */\n protected $cache;\n\n /**\n * The configured limit object resolvers.\n *\n * @var array\n */\n protected $limiters = [];\n\n /**\n * Create a new rate limiter instance.\n *\n * @param \\Illuminate\\Contracts\\Cache\\Repository $cache\n */\n public function __construct(Cache $cache)\n {\n $this->cache = $cache;\n }\n\n /**\n * Register a named rate limiter configuration.\n *\n * @param \\UnitEnum|string $name\n * @param \\Closure $callback\n * @return $this\n */\n public function for($name, Closure $callback)\n {\n $resolvedName = $this->resolveLimiterName($name);\n\n $this->limiters[$resolvedName] = $callback;\n\n return $this;\n }\n\n /**\n * Get the given named rate limiter.\n *\n * @param \\UnitEnum|string $name\n * @return \\Closure|null\n */\n public function limiter($name)\n {\n $resolvedName = $this->resolveLimiterName($name);\n\n $limiter = $this->limiters[$resolvedName] ?? null;\n\n if (! is_callable($limiter)) {\n return;\n }\n\n return function (...$args) use ($limiter) {\n $result = $limiter(...$args);\n\n if (! is_array($result)) {\n return $result;\n }\n\n $duplicates = (new Collection($result))->duplicates('key');\n\n if ($duplicates->isEmpty()) {\n return $result;\n }\n\n foreach ($result as $limit) {\n if ($duplicates->contains($limit->key)) {\n $limit->key = $limit->fallbackKey();\n }\n }\n\n return $result;\n };\n }\n\n /**\n * Attempts to execute a callback if it's not limited.\n *\n * @param string $key\n * @param int $maxAttempts\n * @param \\Closure $callback\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @return mixed\n */\n public function attempt($key, $maxAttempts, Closure $callback, $decaySeconds = 60)\n {\n if ($this->tooManyAttempts($key, $maxAttempts)) {\n return false;\n }\n\n if (is_null($result = $callback())) {\n $result = true;\n }\n\n return tap($result, function () use ($key, $decaySeconds) {\n $this->hit($key, $decaySeconds);\n });\n }\n\n /**\n * Determine if the given key has been \"accessed\" too many times.\n *\n * @param string $key\n * @param int $maxAttempts\n * @return bool\n */\n public function tooManyAttempts($key, $maxAttempts)\n {\n if ($this->attempts($key) >= $maxAttempts) {\n if ($this->cache->has($this->cleanRateLimiterKey($key).':timer')) {\n return true;\n }\n\n $this->resetAttempts($key);\n }\n\n return false;\n }\n\n /**\n * Increment (by 1) the counter for a given key for a given decay time.\n *\n * @param string $key\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @return int\n */\n public function hit($key, $decaySeconds = 60)\n {\n return $this->increment($key, $decaySeconds);\n }\n\n /**\n * Increment the counter for a given key for a given decay time by a given amount.\n *\n * @param string $key\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @param int $amount\n * @return int\n */\n public function increment($key, $decaySeconds = 60, $amount = 1)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n $this->cache->add(\n $key.':timer', $this->availableAt($decaySeconds), $decaySeconds\n );\n\n $added = $this->withoutSerializationOrCompression(\n fn () => $this->cache->add($key, 0, $decaySeconds)\n );\n\n $hits = (int) $this->cache->increment($key, $amount);\n\n if (! $added && $hits == 1) {\n $this->withoutSerializationOrCompression(\n fn () => $this->cache->put($key, 1, $decaySeconds)\n );\n }\n\n return $hits;\n }\n\n /**\n * Decrement the counter for a given key for a given decay time by a given amount.\n *\n * @param string $key\n * @param \\DateTimeInterface|\\DateInterval|int $decaySeconds\n * @param int $amount\n * @return int\n */\n public function decrement($key, $decaySeconds = 60, $amount = 1)\n {\n return $this->increment($key, $decaySeconds, $amount * -1);\n }\n\n /**\n * Get the number of attempts for the given key.\n *\n * @param string $key\n * @return mixed\n */\n public function attempts($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n return $this->withoutSerializationOrCompression(fn () => $this->cache->get($key, 0));\n }\n\n /**\n * Reset the number of attempts for the given key.\n *\n * @param string $key\n * @return bool\n */\n public function resetAttempts($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n return $this->cache->forget($key);\n }\n\n /**\n * Get the number of retries left for the given key.\n *\n * @param string $key\n * @param int $maxAttempts\n * @return int\n */\n public function remaining($key, $maxAttempts)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n $attempts = $this->attempts($key);\n\n return max(0, $maxAttempts - $attempts);\n }\n\n /**\n * Get the number of retries left for the given key.\n *\n * @param string $key\n * @param int $maxAttempts\n * @return int\n */\n public function retriesLeft($key, $maxAttempts)\n {\n return $this->remaining($key, $maxAttempts);\n }\n\n /**\n * Clear the hits and lockout timer for the given key.\n *\n * @param string $key\n * @return void\n */\n public function clear($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n $this->resetAttempts($key);\n\n $this->cache->forget($key.':timer');\n }\n\n /**\n * Get the number of seconds until the \"key\" is accessible again.\n *\n * @param string $key\n * @return int\n */\n public function availableIn($key)\n {\n $key = $this->cleanRateLimiterKey($key);\n\n return max(0, $this->cache->get($key.':timer') - $this->currentTime());\n }\n\n /**\n * Clean the rate limiter key from unicode characters.\n *\n * @param string $key\n * @return string\n */\n public function cleanRateLimiterKey($key)\n {\n return preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities($key));\n }\n\n /**\n * Execute the given callback without serialization or compression when applicable.\n *\n * @param callable $callback\n * @return mixed\n */\n protected function withoutSerializationOrCompression(callable $callback)\n {\n $store = $this->cache->getStore();\n\n if (! $store instanceof RedisStore) {\n return $callback();\n }\n\n $connection = $store->connection();\n\n if (! $connection instanceof PhpRedisConnection) {\n return $callback();\n }\n\n return $connection->withoutSerializationOrCompression($callback);\n }\n\n /**\n * Resolve the rate limiter name.\n *\n * @param \\UnitEnum|string $name\n * @return string\n */\n private function resolveLimiterName($name): string\n {\n return (string) enum_value($name);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8047415539140187333
|
1065731412833220165
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Code changed:
Hide
Sync Changes
Hide This Notification
37
1
35
63
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
Sync Changes
Hide This Notification
Code changed:
Hide
Reader Mode
Analyzing…
<?php
namespace Illuminate\Cache;
use Closure;
use Illuminate\Contracts\Cache\Repository as Cache;
use Illuminate\Redis\Connections\PhpRedisConnection;
use Illuminate\Support\Collection;
use Illuminate\Support\InteractsWithTime;
use function Illuminate\Support\enum_value;
class RateLimiter
{
use InteractsWithTime;
/**
* The cache store implementation.
*
* @var \Illuminate\Contracts\Cache\Repository
*/
protected $cache;
/**
* The configured limit object resolvers.
*
* @var array
*/
protected $limiters = [];
/**
* Create a new rate limiter instance.
*
* @param \Illuminate\Contracts\Cache\Repository $cache
*/
public function __construct(Cache $cache)
{
$this->cache = $cache;
}
/**
* Register a named rate limiter configuration.
*
* @param \UnitEnum|string $name
* @param \Closure $callback
* @return $this
*/
public function for($name, Closure $callback)
{
$resolvedName = $this->resolveLimiterName($name);
$this->limiters[$resolvedName] = $callback;
return $this;
}
/**
* Get the given named rate limiter.
*
* @param \UnitEnum|string $name
* @return \Closure|null
*/
public function limiter($name)
{
$resolvedName = $this->resolveLimiterName($name);
$limiter = $this->limiters[$resolvedName] ?? null;
if (! is_callable($limiter)) {
return;
}
return function (...$args) use ($limiter) {
$result = $limiter(...$args);
if (! is_array($result)) {
return $result;
}
$duplicates = (new Collection($result))->duplicates('key');
if ($duplicates->isEmpty()) {
return $result;
}
foreach ($result as $limit) {
if ($duplicates->contains($limit->key)) {
$limit->key = $limit->fallbackKey();
}
}
return $result;
};
}
/**
* Attempts to execute a callback if it's not limited.
*
* @param string $key
* @param int $maxAttempts
* @param \Closure $callback
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @return mixed
*/
public function attempt($key, $maxAttempts, Closure $callback, $decaySeconds = 60)
{
if ($this->tooManyAttempts($key, $maxAttempts)) {
return false;
}
if (is_null($result = $callback())) {
$result = true;
}
return tap($result, function () use ($key, $decaySeconds) {
$this->hit($key, $decaySeconds);
});
}
/**
* Determine if the given key has been "accessed" too many times.
*
* @param string $key
* @param int $maxAttempts
* @return bool
*/
public function tooManyAttempts($key, $maxAttempts)
{
if ($this->attempts($key) >= $maxAttempts) {
if ($this->cache->has($this->cleanRateLimiterKey($key).':timer')) {
return true;
}
$this->resetAttempts($key);
}
return false;
}
/**
* Increment (by 1) the counter for a given key for a given decay time.
*
* @param string $key
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @return int
*/
public function hit($key, $decaySeconds = 60)
{
return $this->increment($key, $decaySeconds);
}
/**
* Increment the counter for a given key for a given decay time by a given amount.
*
* @param string $key
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @param int $amount
* @return int
*/
public function increment($key, $decaySeconds = 60, $amount = 1)
{
$key = $this->cleanRateLimiterKey($key);
$this->cache->add(
$key.':timer', $this->availableAt($decaySeconds), $decaySeconds
);
$added = $this->withoutSerializationOrCompression(
fn () => $this->cache->add($key, 0, $decaySeconds)
);
$hits = (int) $this->cache->increment($key, $amount);
if (! $added && $hits == 1) {
$this->withoutSerializationOrCompression(
fn () => $this->cache->put($key, 1, $decaySeconds)
);
}
return $hits;
}
/**
* Decrement the counter for a given key for a given decay time by a given amount.
*
* @param string $key
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
* @param int $amount
* @return int
*/
public function decrement($key, $decaySeconds = 60, $amount = 1)
{
return $this->increment($key, $decaySeconds, $amount * -1);
}
/**
* Get the number of attempts for the given key.
*
* @param string $key
* @return mixed
*/
public function attempts($key)
{
$key = $this->cleanRateLimiterKey($key);
return $this->withoutSerializationOrCompression(fn () => $this->cache->get($key, 0));
}
/**
* Reset the number of attempts for the given key.
*
* @param string $key
* @return bool
*/
public function resetAttempts($key)
{
$key = $this->cleanRateLimiterKey($key);
return $this->cache->forget($key);
}
/**
* Get the number of retries left for the given key.
*
* @param string $key
* @param int $maxAttempts
* @return int
*/
public function remaining($key, $maxAttempts)
{
$key = $this->cleanRateLimiterKey($key);
$attempts = $this->attempts($key);
return max(0, $maxAttempts - $attempts);
}
/**
* Get the number of retries left for the given key.
*
* @param string $key
* @param int $maxAttempts
* @return int
*/
public function retriesLeft($key, $maxAttempts)
{
return $this->remaining($key, $maxAttempts);
}
/**
* Clear the hits and lockout timer for the given key.
*
* @param string $key
* @return void
*/
public function clear($key)
{
$key = $this->cleanRateLimiterKey($key);
$this->resetAttempts($key);
$this->cache->forget($key.':timer');
}
/**
* Get the number of seconds until the "key" is accessible again.
*
* @param string $key
* @return int
*/
public function availableIn($key)
{
$key = $this->cleanRateLimiterKey($key);
return max(0, $this->cache->get($key.':timer') - $this->currentTime());
}
/**
* Clean the rate limiter key from unicode characters.
*
* @param string $key
* @return string
*/
public function cleanRateLimiterKey($key)
{
return preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities($key));
}
/**
* Execute the given callback without serialization or compression when applicable.
*
* @param callable $callback
* @return mixed
*/
protected function withoutSerializationOrCompression(callable $callback)
{
$store = $this->cache->getStore();
if (! $store instanceof RedisStore) {
return $callback();
}
$connection = $store->connection();
if (! $connection instanceof PhpRedisConnection) {
return $callback();
}
return $connection->withoutSerializationOrCompression($callback);
}
/**
* Resolve the rate limiter name.
*
* @param \UnitEnum|string $name
* @return string
*/
private function resolveLimiterName($name): string
{
return (string) enum_value($name);
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
2839
|
114
|
34
|
2026-05-07T11:43:01.971562+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778154181971_m2.jpg...
|
PhpStorm
|
faVsco.js – SyncCrmEntitiesTrait.php
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
Editor for custom.log
Sync Changes
Hide This Notification
Code changed:
Hide
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot\ServiceTraits;
use Carbon\Carbon;
use Exception;
use Illuminate\Support\Str;
use Jiminny\Exceptions\CrmException;
use Jiminny\Jobs\Crm\Delete\DeleteAccountJob;
use Jiminny\Jobs\Crm\Delete\DeleteContactJob;
use Jiminny\Jobs\Crm\Delete\DeleteOpportunityJob;
use Jiminny\Models\Account;
use Jiminny\Models\Contact;
use Jiminny\Models\Lead;
use Jiminny\Repositories\Crm\CrmEntityRepository;
use Jiminny\Services\Avatar\ProspectPhotoPathService;
use Jiminny\Services\Crm\Hubspot\HubspotClientInterface;
use Jiminny\Services\Crm\Hubspot\WebhookSyncBatchProcessor;
use Jiminny\Utils\StringUtil;
trait SyncCrmEntitiesTrait
{
use OpportunitySyncTrait;
private const string CDN_URL = '[URL_WITH_CREDENTIALS] Carbon $since Fetch contacts modified after this date
* @param Carbon|null $to Optional end date for modification range
*
* @return int Number of contacts successfully synced
*/
public function syncContacts(Carbon $since, ?Carbon $to = null): int
{
$syncCount = 0;
try {
if (! $this->client instanceof HubspotClientInterface) {
throw new \InvalidArgumentException('Client must implement HubspotClientInterface');
}
$fields = $this->getContactFields();
$payload = $this->payloadBuilder->getRecentlyUpdatedSearchPayload($since, $to, $fields);
foreach ($this->client->getPaginatedDataGenerator($payload, 'contacts') as $hsContact) {
$this->importContact($hsContact);
$syncCount++;
}
} catch (Exception $exception) {
$this->logger->error('[' . $this->getDisplayName() . '] Sync contacts failed', [
'teamId' => $this->team->getUuid(),
'reason' => $exception->getMessage(),
]);
}
return $syncCount;
}
/**
* @inheritdoc
*/
public function syncContact(string $crmId): ?Contact
{
try {
if (! $this->client instanceof HubspotClientInterface) {
throw new \InvalidArgumentException('Client must implement HubspotClientInterface');
}
$fields = $this->getContactFields();
$hsContact = $this->client->getContactById($crmId, $fields);
} catch (\HubSpot\Client\Crm\Contacts\ApiException $e) {
$this->logger->info('[' . $this->getDisplayName() . '] Contact fetch failed', [
'teamId' => $this->team->getUuid(),
'crmId' => $crmId,
'reason' => $e->getMessage(),
]);
return null;
} catch (CrmException $e) {
$this->logger->info('[' . $this->getDisplayName() . '] Contact not found', [
'teamId' => $this->team->getUuid(),
'crmId' => $crmId,
'reason' => $e->getMessage(),
]);
return null;
}
if (empty($hsContact['properties']) || empty($hsContact['id'])) {
$this->logger->warning('[' . $this->getDisplayName() . '] Contact data incomplete', [
'teamId' => $this->team->getUuid(),
'crmId' => $crmId,
'has_properties' => ! empty($hsContact['properties']),
'has_id' => ! empty($hsContact['id']),
]);
return null;
}
return $this->importContact($hsContact);
}
private function getContactFields(): array
{
return [
'associatedcompanyid',
'country',
'firstname',
'lastname',
'phone',
'mobilephone',
'email',
'photo',
'hs_avatar_filemanager_key',
'jobtitle',
'hubspot_owner_id',
'hs_object_id',
'createdate',
'hs_lastmodifieddate',
];
}
/**
* @inheritdoc
*/
private function importContact($crmData, array $accountMappings = []): ?Contact
{
$crmProviderId = $crmData['id'] ?? null;
$this->logger->info('[HubSpot] importContact', [
'crm_provider_id' => $crmProviderId,
'config_id' => $this->config->getId(),
]);
if (empty($crmData['properties'])) {
$this->logger->info('[HubSpot] importContact failed: empty properties', [
'crm_provider_id' => $crmProviderId,
'config_id' => $this->config->getId(),
]);
return null;
}
$properties = $crmData['properties'];
$crmId = (string) $crmData['id'];
$accountId = $this->resolveContactAccount($properties, $accountMappings);
$data = $this->buildContactData($crmId, $properties, $accountId);
return $this->crmEntityRepository->importContact($this->config, $data);
}
private function resolveContactAccount(array $properties, array $accountMappings): ?int
{
if (empty($properties['associatedcompanyid'])) {
return null;
}
$companyId = (string) $properties['associatedcompanyid'];
if (! empty($accountMappings)) {
return $accountMappings[$companyId] ?? null;
}
return $this->crmEntityRepository->findAccountByExternalId(
$this->team->getCrmConfiguration(),
$companyId
)?->getId() ?? $this->syncAccount($companyId)?->getId();
}
private function buildContactData(string $crmId, array $properties, ?int $accountId): array
{
$countryCode = $this->buildContactCountry($properties);
$name = $this->buildContactName($properties);
$photoPath = $this->teamService->generateAvatar(
$crmId,
empty($name) ? ($properties['email'] ?? 'N/A') : $name,
);
$parsedNumber = $this->buildContactPhone($countryCode, $properties);
$mobileNumber = $this->buildContactMobilePhone($countryCode, $properties);
$ownerId = $properties['hubspot_owner_id'] ?? null;
$profile = $ownerId !== null
? $this->crmEntityRepository->findProfileByExternalId($this->config, (string) $ownerId)
: null;
$ext = (isset($parsedNumber['ext']) && is_string($parsedNumber['ext']) && strlen($parsedNumber['ext']) <= 10)
? $parsedNumber['ext']
: null;
$title = isset($properties['jobtitle']) ? mb_strimwidth($properties['jobtitle'], 0, 128) : null;
$email = isset($properties['email']) ? mb_strimwidth($properties['email'], 0, 191) : null;
$remotelyCreatedAt = ! empty($properties['createdate']) ? Carbon::parse($properties['createdate']) : null;
return [
'crm_provider_id' => $crmId,
'team_id' => $this->team->getId(),
'account_id' => $accountId,
'user_id' => $profile?->getUserId(),
'owner_id' => $ownerId,
'name' => $name,
'title' => $title,
'email' => $email,
'country_code' => $countryCode,
'phone' => $parsedNumber['phone'] ?? null,
'mobile_phone' => $mobileNumber ?? null,
'ext' => $ext,
'photo_path' => $photoPath,
'remotely_created_at' => $remotelyCreatedAt,
];
}
/**
* @param $properties
*/
private function buildContactName($properties): string
{
if (is_array($properties)) {
return $this->buildContactNameFromArray($properties);
}
return $this->buildContactNameFromObject($properties);
}
private function buildContactNameFromArray(array $properties): string
{
if (! empty($properties['name'])) {
return mb_strimwidth($properties['name'], 0, 100);
}
$name = '';
if (! empty($properties['firstname'])) {
$name = $properties['firstname'] . ' ';
}
if (! empty($properties['lastname'])) {
$name .= $properties['lastname'];
}
if ($name === '' && ! empty($properties['email'])) {
$name = $properties['email'];
}
return mb_strimwidth($name, 0, 100);
}
private function buildContactNameFromObject($properties): string
{
$name = '';
if (isset($properties->firstname)) {
$name = $properties->firstname->value . ' ';
}
if (isset($properties->lastname)) {
$name .= $properties->lastname->value;
}
if ($name === '' && isset($properties->email)) {
$name = $properties->email->value;
}
return mb_strimwidth($name, 0, 100);
}
/**
* @param $properties
*/
private function buildContactPhone(?string $countryCode, $properties): ?array
{
if (is_array($properties) && empty($properties['phone']) === false) {
$number = mb_strimwidth($properties['phone'], 0, 25);
return parsePhoneNumber($countryCode, $number);
} elseif (isset($properties->phone)) {
$number = mb_strimwidth($properties->phone->value, 0, 25);
return parsePhoneNumber($countryCode, $number);
}
return [];
}
/**
* @param $properties
*/
private function buildContactMobilePhone(?string $countryCode, $properties): ?string
{
return isset($properties['mobilephone'])
? Str::limit(phone_e164($countryCode, $properties['mobilephone']), 25, '')
: null;
}
/**
* @param $properties
* @param $account
*/
private function buildContactCountry($properties): ?string
{
if (is_array($properties) && empty($properties['country']) === false) {
return $this->convertCountryNameToCode($properties['country']);
}
if (isset($properties->country)) {
return $this->convertCountryNameToCode($properties->country->value);
}
return null;
}
/**
* HubSpot doesn't have leads, so this method does nothing.
*
* @param Carbon $since
* @param Carbon|null $to
* @param string|null $crmProfileId
*
* @return int
*/
public function syncLeads(Carbon $since, ?Carbon $to = null, ?string $crmProfileId = null): int
{
// Mark unused parameters to avoid code smell warnings
unset($since, $to, $crmProfileId);
return 0;
}
/**
* HubSpot doesn't have leads.
*
* @param string $crmId
*
* @inheritdoc
*/
public function syncLead(string $crmId): ?Lead
{
// Mark unused parameter to avoid code smell warnings
unset($crmId);
return null;
}
/**
* Sync accounts (companies) modified since a given date (manual sync mode).
*
* This method fetches companies from HubSpot API based on modification date and
* imports them one by one. It is used for:
* - Manual sync commands (e.g., crm:sync-account with --from parameter)
* - Initial sync for new teams
* - Backfill operations
*
* For regular sync webhook batchSyncCompanies is used:
*
* @param Carbon $since Fetch companies modified after this date
* @param Carbon|null $to Optional end date for modification range
*
* @return int Number of companies successfully synced
*/
public function syncAccounts(Carbon $since, ?Carbon $to = null): int
{
$syncCount = 0;
try {
if (! $this->client instanceof HubspotClientInterface) {
throw new \InvalidArgumentException('Client must implement HubspotClientInterface');
}
$fields = $this->getCompanyFields();
$payload = $this->payloadBuilder->getRecentlyUpdatedSearchPayload($since, $to, $fields);
foreach ($this->client->getPaginatedDataGenerator($payload, 'companies') as $hsAccount) {
$this->importAccount($hsAccount);
$syncCount++;
}
} catch (Exception $exception) {
$this->logger->error('[' . $this->getDisplayName() . '] Sync accounts failed', [
'teamId' => $this->team->getUuid(),
'reason' => $exception->getMessage(),
]);
}
return $syncCount;
}
/**
* @inheritdoc
*/
public function syncAccount(string $crmId): ?Account
{
try {
if (! $this->client instanceof HubspotClientInterface) {
throw new \InvalidArgumentException('Client must implement HubspotClientInterface');
}
$fields = $this->getCompanyFields();
$hsAccount = $this->client->getAccountById($crmId, $fields);
} catch (\HubSpot\Client\Crm\Companies\ApiException $e) {
$this->logger->info('[' . $this->getDisplayName() . '] Account fetch failed', [
'teamId' => $this->team->getUuid(),
'crmId' => $crmId,
'reason' => $e->getMessage(),
]);
return null;
} catch (CrmException $e) {
$this->logger->info('[' . $this->getDisplayName() . '] Account not found', [
'teamId' => $this->team->getUuid(),
'crmId' => $crmId,
'reason' => $e->getMessage(),
]);
return null;
}
return $this->importAccount($hsAccount);
}
/**
* Process webhook-collected contact batches.
*
* Drains Redis sets containing contact CRM IDs collected from webhook events
* and dispatches ImportContactBatch jobs for batch processing.
*
* @return int Number of contact IDs dispatched to jobs
*/
public function batchSyncContacts(): int
{
$configId = $this->team->getCrmConfiguration()->getId();
return $this->batchProcessor->processBatchesForObjectType(
WebhookSyncBatchProcessor::OBJECT_TYPE_CONTACT,
$configId
);
}
public function importContactBatchByIds(array $crmIds): array
{
$result = [
'success_count' => 0,
'failed_ids' => [],
'errors' => [],
];
if (! $this->client instanceof HubspotClientInterface) {
throw new \InvalidArgumentException('Client must implement HubspotClientInterface');
}
$batchStart = microtime(true);
$slowContacts = [];
$fetchStart = microtime(true);
$allContacts = $this->fetchContactsByIdsInChunks($crmIds);
$fetchMs = (int) round((microtime(true) - $fetchStart) * 1000);
$fetchedIds = array_map('strval', array_column($allContacts, 'id'));
$notFoundIds = array_values(array_diff(array_map('strval', $crmIds), $fetchedIds));
if (! empty($notFoundIds)) {
$this->logger->info('[' . $this->getDisplayName() . '] Contact CRM IDs not found in HubSpot', [
'teamId' => $this->team->getId(),
'notFoundCount' => \count($notFoundIds),
'notFoundIds' => $notFoundIds,
'requestedCount' => \count($crmIds),
'fetchedCount' => \count($allContacts),
]);
}
if (empty($allContacts)) {
return $result;
}
$prepareStart = microtime(true);
$accountMappings = $this->prepareAccountMappingsForContacts($allContacts);
$prepareAccountsMs = (int) round((microtime(true) - $prepareStart) * 1000);
$loopStart = microtime(true);
foreach ($allContacts as $contactData) {
$contactStart = microtime(true);
try {
$contact = $this->importContact($contactData, $accountMappings);
if ($contact !== null) {
$result['success_count']++;
}
} catch (\Throwable $e) {
$crmId = $contactData['id'] ?? 'unknown';
$result['failed_ids'][] = $crmId;
$result['errors'][$crmId] = $e->getMessage();
$this->logger->warning('[' . $this->getDisplayName() . '] Failed to import contact', [
'teamId' => $this->team->getId(),
'crmId' => $crmId,
'error' => $e->getMessage(),
]);
}
$contactMs = (int) round((microtime(true) - $contactStart) * 1000);
if ($contactMs > 1000) {
$slowContacts[] = ['crmId' => $contactData['id'] ?? 'unknown', 'ms' => $contactMs];
}
}
$loopMs = (int) round((microtime(true) - $loopStart) * 1000);
$totalMs = (int) round((microtime(true) - $batchStart) * 1000);
$this->logger->info('[' . $this->getDisplayName() . '] importContactBatch timing', [
'teamId' => $this->team->getId(),
'contact_count' => \count($allContacts),
'requested_count' => \count($crmIds),
'not_found_count' => \count($notFoundIds),
'total_ms' => $totalMs,
'fetch_api_ms' => $fetchMs,
'prepare_accounts_ms' => $prepareAccountsMs,
'contacts_loop_ms' => $loopMs,
'avg_contact_ms' => ! empty($allContacts) ? (int) round($loopMs / \count($allContacts)) : 0,
'slow_contacts_count' => \count($slowContacts),
'slow_contacts' => array_slice($slowContacts, 0, 10),
]);
return $result;
}
private function fetchContactsByIdsInChunks(array $crmIds): array
{
$fields = $this->getContactFields();
$allContacts = [];
foreach (array_chunk($crmIds, self::BATCH_SIZE) as $chunk) {
try {
$contacts = $this->client->getContactsByIds($chunk, $fields);
foreach ($contacts as $contactData) {
$allContacts[] = $contactData;
}
} catch (\Throwable $e) {
// @TODO what will happen if this exception is thrown
$this->logger->warning('[' . $this->getDisplayName() . '] Batch contact fetch failed', [
'chunk_size' => \count($chunk),
'error' => $e->getMessage(),
]);
throw $e;
}
}
return $allContacts;
}
private function prepareAccountMappingsForContacts(array $contacts): array
{
$companyIds = [];
foreach ($contacts as $contact) {
$companyId = $contact['properties']['associatedcompanyid'] ?? null;
if ($companyId !== null && $companyId !== '') {
$companyIds[] = (string) $companyId;
}
}
$companyIds = array_unique($companyIds);
if (empty($companyIds)) {
return [];
}
$mappings = $this->crmEntityRepository
->getExistingAccountIdsMap($this->config, $companyIds);
$missingCompanyIds = array_diff($companyIds, array_keys($mappings));
if (empty($missingCompanyIds)) {
return $mappings;
}
$this->logger->info('[' . $this->getDisplayName() . '] Batch syncing missing accounts for contacts', [
'teamId' => $this->team->getId(),
'total_companies' => \count($companyIds),
'existing_companies' => \count($mappings),
'missing_companies' => \count($missingCompanyIds),
]);
try {
$syncedAccounts = $this->batchSyncAccountsForContacts($missingCompanyIds);
$mappings = array_merge($mappings, $syncedAccounts);
} catch (\Throwable $e) {
$this->logger->error('[' . $this->getDisplayName() . '] Failed to batch sync missing accounts', [
'teamId' => $this->team->getId(),
'missingCompanyIds' => $missingCompanyIds,
'missingCount' => count($missingCompanyIds),
'error' => $e->getMessage(),
]);
}
return $mappings;
}
private function batchSyncAccountsForContacts(array $companyIds): array
{
$syncedAccounts = [];
$fields = $this->getCompanyFields();
foreach (array_chunk($companyIds, self::BATCH_SIZE) as $chunk) {
try {
$companies = $this->client->getCompaniesByIds($chunk, $fields);
foreach ($companies as $companyData) {
try {
$account = $this->importAccount($companyData);
if ($account) {
$syncedAccounts[$account->getCrmProviderId()] = $account->getId();
}
} catch (\Throwable $e) {
$this->logger->warning('[' . $this->getDisplayName() . '] Failed to import account in batch', [
'teamId' => $this->team->getId(),
'companyId' => $companyData['id'] ?? 'unknown',
'error' => $e->getMessage(),
]);
}
}
} catch (\Throwable $e) {
$this->logger->warning('[' . $this->getDisplayName() . '] Batch company fetch failed', [
'teamId' => $this->team->getId(),
'chunk_size' => \count($chunk),
'error' => $e->getMessage(),
]);
}
}
return $syncedAccounts;
}
/**
* Process webhook-collected company batches.
*
* Drains Redis sets containing company CRM IDs collected from webhook events
* and dispatches ImportAccountBatch jobs for batch processing.
*
* @return int Number of company IDs dispatched to jobs
*/
public function batchSyncCompanies(): int
{
$configId = $this->team->getCrmConfiguration()->getId();
return $this->batchProcessor->processBatchesForObjectType(
WebhookSyncBatchProcessor::OBJECT_TYPE_COMPANY,
$configId
);
}
public function importAccountBatchByIds(array $crmIds): array
{
$result = [
'success_count' => 0,
'failed_ids' => [],
'errors' => [],
];
if (! $this->client instanceof HubspotClientInterface) {
throw new \InvalidArgumentException('Client must implement HubspotClientInterface');
}
$batchStart = microtime(true);
$slowAccounts = [];
$fields = $this->getCompanyFields();
$allCompanies = [];
$fetchStart = microtime(true);
foreach (array_chunk($crmIds, self::BATCH_SIZE) as $chunk) {
try {
$companies = $this->client->getCompaniesByIds($chunk, $fields);
foreach ($companies as $companyData) {
$allCompanies[] = $companyData;
}
} catch (\Throwable $e) {
$this->logger->warning('[' . $this->getDisplayName() . '] Batch company fetch failed', [
'chunk_size' => \count($chunk),
'error' => $e->getMessage(),
]);
throw $e;
}
}
$fetchMs = (int) round((microtime(true) - $fetchStart) * 1000);
$fetchedIds = array_map('strval', array_column($allCompanies, 'id'));
$notFoundIds = array_values(array_diff(array_map('strval', $crmIds), $fetchedIds));
if (! empty($notFoundIds)) {
$this->logger->info('[' . $this->getDisplayName() . '] Company CRM IDs not found in HubSpot', [
'teamId' => $this->team->getId(),
'notFoundCount' => \count($notFoundIds),
'notFoundIds' => $notFoundIds,
'requestedCount' => \count($crmIds),
'fetchedCount' => \count($allCompanies),
]);
}
$loopStart = microtime(true);
foreach ($allCompanies as $companyData) {
$accountStart = microtime(true);
try {
$account = $this->importAccount($companyData);
if ($account !== null) {
$result['success_count']++;
}
} catch (\Throwable $e) {
$crmId = $companyData['id'] ?? $companyData['properties']['hs_object_id'] ?? 'unknown';
$result['failed_ids'][] = $crmId;
$result['errors'][$crmId] = $e->getMessage();
$this->logger->warning('[' . $this->getDisplayName() . '] Failed to import account', [
'crmId' => $crmId,
'error' => $e->getMessage(),
]);
}
$accountMs = (int) round((microtime(true) - $accountStart) * 1000);
if ($accountMs > 1000) {
$crmId = $companyData['id'] ?? $companyData['properties']['hs_object_id'] ?? 'unknown';
$slowAccounts[] = ['crmId' => $crmId, 'ms' => $accountMs];
}
}
$loopMs = (int) round((microtime(true) - $loopStart) * 1000);
$totalMs = (int) round((microtime(true) - $batchStart) * 1000);
$this->logger->info('[' . $this->getDisplayName() . '] importAccountBatch timing', [
'teamId' => $this->team->getId(),
'account_count' => \count($allCompanies),
'requested_count' => \count($crmIds),
'not_found_count' => \count($notFoundIds),
'total_ms' => $totalMs,
'fetch_api_ms' => $fetchMs,
'accounts_loop_ms' => $loopMs,
'avg_account_ms' => ! empty($allCompanies) ? (int) round($loopMs / \count($allCompanies)) : 0,
'slow_accounts_count' => \count($slowAccounts),
'slow_accounts' => array_slice($slowAccounts, 0, 10),
]);
return $result;
}
private function getCompanyFields(): array
{
return [
'country',
'name',
'phone',
'domain',
'hs_avatar_filemanager_key',
'industry',
'hubspot_owner_id',
'hs_object_id',
'createdate',
'hs_lastmodifieddate',
];
}
private function importAccount($crmData): ?Account
{
$crmProviderId = $crmData['id'] ?? $crmData['properties']['hs_object_id'] ?? null;
$this->logger->info('[HubSpot] importAccount', [
'crm_provider_id' => $crmProviderId,
'config_id' => $this->config->getId(),
]);
if (empty($crmData['properties'])) {
$this->logger->info('[HubSpot] importAccount failed: empty properties', [
'crm_provider_id' => $crmProviderId,
'config_id' => $this->config->getId(),
]);
return null;
}
$properties = $crmData['properties'];
$crmId = (string) $properties['hs_object_id'];
$countryCode = isset($properties['country']) ? $this->convertCountryNameToCode($properties['country']) : null;
if (isset($properties['phone'])) {
// Trim to our width and attempt to parse it.
$number = mb_strimwidth($properties['phone'], 0, 25);
$parsedNumber = parsePhoneNumber($countryCode, $number);
} else {
$parsedNumber = [];
}
$name = '[unknown]';
if (isset($properties['name'])) {
$name = $properties['name'];
}
$photoPath = $this->prospectPhotoPathService->getOrGeneratePhotoPath(
$this->config,
$crmId,
Account::class,
$crmId,
$name
);
$industry = null;
if (isset($properties['industry'])) {
$industry = mb_strimwidth($properties['industry'], 0, 40);
}
$ownerId = $profile = null;
if (isset($properties['hubspot_owner_id'])) {
$ownerId = $properties['hubspot_owner_id'];
$profile = $this->crmEntityRepository->findProfileByExternalId($this->config, (string) $ownerId);
}
$domain = null;
if (isset($properties['domain'])) {
$domain = StringUtil::resolveDomain($properties['domain']);
}
$remotelyCreatedAt = null;
if (isset($properties['createdate']) && ! empty($properties['createdate'])) {
$remotelyCreatedAt = Carbon::parse($properties['createdate']);
}
$data = [
'crm_provider_id' => $crmId,
'team_id' => $this->team->id,
'user_id' => $profile ? $profile->user_id : null,
'owner_id' => $ownerId,
'name' => mb_strimwidth($name, 0, 191),
'photo_path' => $photoPath,
'industry' => $industry,
'domain' => $domain !== null
? substr($domain, 0, 191)
: null,
'phone' => $parsedNumber['phone'] ?? null,
'ext' => $parsedNumber['ext'] ?? null,
'country_code' => $countryCode,
'remotely_created_at' => $remotelyCreatedAt,
];
return $this->crmEntityRepository->importAccount($this->config, $data);
}
public function deleteContact(string $crmProviderId): bool
{
try {
$contact = $this->crmEntityRepository->findContactByExternalId($this->config, $crmProviderId);
if (! $contact) {
$this->logger->info('[HubSpot] Contact not found for deletion', [
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
]);
// return success because we do not know which instance is the target
return true;
}
$id = $contact->getId();
$this->logger->info('[HubSpot] Deleting contact via webhook', [
'contact_id' => $id,
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
]);
$contact->delete();
DeleteContactJob::dispatch($id)->afterCommit();
return true;
} catch (Exception $e) {
$this->logger->error('[HubSpot] Failed to delete contact via webhook', [
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
'error' => $e->getMessage(),
]);
return false;
}
}
public function deleteAccount(string $crmProviderId): bool
{
try {
$account = $this->crmEntityRepository->findAccountByExternalId($this->config, $crmProviderId);
if (! $account) {
$this->logger->info('[HubSpot] Account not found for deletion', [
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
]);
// return success because we do not know which instance is the target
return true;
}
$id = $account->getId();
$this->logger->info('[HubSpot] Deleting account via webhook', [
'account_id' => $id,
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
]);
$account->delete();
DeleteAccountJob::dispatch($id)->afterCommit();
return true;
} catch (Exception $e) {
$this->logger->error('[HubSpot] Failed to delete account via webhook', [
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
'error' => $e->getMessage(),
]);
return false;
}
}
public function deleteOpportunity(string $crmProviderId): bool
{
try {
$opportunity = $this->crmEntityRepository->findOpportunityByExternalId($this->config, $crmProviderId);
if (! $opportunity) {
$this->logger->info('[HubSpot] Opportunity not found for deletion', [
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
]);
// return success because we do not know which instance is the target
return true;
}
$id = $opportunity->getId();
$this->logger->info('[HubSpot] Deleting opportunity via webhook', [
'opportunity_id' => $id,
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
]);
$opportunity->delete();
DeleteOpportunityJob::dispatch($id)->afterCommit();
return true;
} catch (Exception $e) {
$this->logger->error('[HubSpot] Failed to delete opportunity via webhook', [
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
'error' => $e->getMessage(),
]);
return false;
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.034242023,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"Editor for custom.log","depth":4,"bounds":{"left":0.5475399,"top":0.0726257,"width":0.44082448,"height":0.9066241},"on_screen":true,"role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Hubspot\\ServiceTraits;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Support\\Str;\nuse Jiminny\\Exceptions\\CrmException;\nuse Jiminny\\Jobs\\Crm\\Delete\\DeleteAccountJob;\nuse Jiminny\\Jobs\\Crm\\Delete\\DeleteContactJob;\nuse Jiminny\\Jobs\\Crm\\Delete\\DeleteOpportunityJob;\nuse Jiminny\\Models\\Account;\nuse Jiminny\\Models\\Contact;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Repositories\\Crm\\CrmEntityRepository;\nuse Jiminny\\Services\\Avatar\\ProspectPhotoPathService;\nuse Jiminny\\Services\\Crm\\Hubspot\\HubspotClientInterface;\nuse Jiminny\\Services\\Crm\\Hubspot\\WebhookSyncBatchProcessor;\nuse Jiminny\\Utils\\StringUtil;\n\ntrait SyncCrmEntitiesTrait\n{\n use OpportunitySyncTrait;\n private const string CDN_URL = 'https://cdn2.hubspot.net/';\n protected CrmEntityRepository $crmEntityRepository;\n protected ProspectPhotoPathService $prospectPhotoPathService;\n\n private function getAssociationDataForCollection(array $collection, string $fromObject, string $toObject): array\n {\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $hsOpportunityIds = array_column($collection, 'id');\n\n return $this->client->getAssociationsData($hsOpportunityIds, $fromObject, $toObject);\n }\n\n private function importAssociationData(array $collection, array $associatedData): array\n {\n $data = [];\n if (! empty($associatedData[$collection['id']])) {\n foreach ($associatedData[$collection['id']] as $id) {\n $data[] = [\n 'id' => $id,\n ];\n }\n }\n\n return ['results' => $data];\n }\n\n /**\n * Sync contacts modified since a given date (manual sync mode).\n *\n * This method fetches contacts from HubSpot API based on modification date and\n * imports them one by one. It is used for:\n * - Manual sync commands (e.g., crm:sync-contact with --from parameter)\n * - Initial sync for new teams\n * - Backfill operations\n *\n * For regular sync webhook batchSyncContacts is used:\n *\n * @param Carbon $since Fetch contacts modified after this date\n * @param Carbon|null $to Optional end date for modification range\n *\n * @return int Number of contacts successfully synced\n */\n public function syncContacts(Carbon $since, ?Carbon $to = null): int\n {\n $syncCount = 0;\n\n try {\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $fields = $this->getContactFields();\n $payload = $this->payloadBuilder->getRecentlyUpdatedSearchPayload($since, $to, $fields);\n\n foreach ($this->client->getPaginatedDataGenerator($payload, 'contacts') as $hsContact) {\n $this->importContact($hsContact);\n $syncCount++;\n }\n } catch (Exception $exception) {\n $this->logger->error('[' . $this->getDisplayName() . '] Sync contacts failed', [\n 'teamId' => $this->team->getUuid(),\n 'reason' => $exception->getMessage(),\n ]);\n }\n\n return $syncCount;\n }\n\n /**\n * @inheritdoc\n */\n public function syncContact(string $crmId): ?Contact\n {\n try {\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $fields = $this->getContactFields();\n $hsContact = $this->client->getContactById($crmId, $fields);\n } catch (\\HubSpot\\Client\\Crm\\Contacts\\ApiException $e) {\n $this->logger->info('[' . $this->getDisplayName() . '] Contact fetch failed', [\n 'teamId' => $this->team->getUuid(),\n 'crmId' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n return null;\n } catch (CrmException $e) {\n $this->logger->info('[' . $this->getDisplayName() . '] Contact not found', [\n 'teamId' => $this->team->getUuid(),\n 'crmId' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n return null;\n }\n\n if (empty($hsContact['properties']) || empty($hsContact['id'])) {\n $this->logger->warning('[' . $this->getDisplayName() . '] Contact data incomplete', [\n 'teamId' => $this->team->getUuid(),\n 'crmId' => $crmId,\n 'has_properties' => ! empty($hsContact['properties']),\n 'has_id' => ! empty($hsContact['id']),\n ]);\n\n return null;\n }\n\n return $this->importContact($hsContact);\n }\n\n private function getContactFields(): array\n {\n return [\n 'associatedcompanyid',\n 'country',\n 'firstname',\n 'lastname',\n 'phone',\n 'mobilephone',\n 'email',\n 'photo',\n 'hs_avatar_filemanager_key',\n 'jobtitle',\n 'hubspot_owner_id',\n 'hs_object_id',\n 'createdate',\n 'hs_lastmodifieddate',\n ];\n }\n\n /**\n * @inheritdoc\n */\n private function importContact($crmData, array $accountMappings = []): ?Contact\n {\n $crmProviderId = $crmData['id'] ?? null;\n\n $this->logger->info('[HubSpot] importContact', [\n 'crm_provider_id' => $crmProviderId,\n 'config_id' => $this->config->getId(),\n ]);\n\n if (empty($crmData['properties'])) {\n $this->logger->info('[HubSpot] importContact failed: empty properties', [\n 'crm_provider_id' => $crmProviderId,\n 'config_id' => $this->config->getId(),\n ]);\n\n return null;\n }\n\n $properties = $crmData['properties'];\n $crmId = (string) $crmData['id'];\n\n $accountId = $this->resolveContactAccount($properties, $accountMappings);\n $data = $this->buildContactData($crmId, $properties, $accountId);\n\n return $this->crmEntityRepository->importContact($this->config, $data);\n }\n\n private function resolveContactAccount(array $properties, array $accountMappings): ?int\n {\n if (empty($properties['associatedcompanyid'])) {\n return null;\n }\n\n $companyId = (string) $properties['associatedcompanyid'];\n\n if (! empty($accountMappings)) {\n return $accountMappings[$companyId] ?? null;\n }\n\n return $this->crmEntityRepository->findAccountByExternalId(\n $this->team->getCrmConfiguration(),\n $companyId\n )?->getId() ?? $this->syncAccount($companyId)?->getId();\n }\n\n private function buildContactData(string $crmId, array $properties, ?int $accountId): array\n {\n $countryCode = $this->buildContactCountry($properties);\n $name = $this->buildContactName($properties);\n $photoPath = $this->teamService->generateAvatar(\n $crmId,\n empty($name) ? ($properties['email'] ?? 'N/A') : $name,\n );\n $parsedNumber = $this->buildContactPhone($countryCode, $properties);\n $mobileNumber = $this->buildContactMobilePhone($countryCode, $properties);\n\n $ownerId = $properties['hubspot_owner_id'] ?? null;\n $profile = $ownerId !== null\n ? $this->crmEntityRepository->findProfileByExternalId($this->config, (string) $ownerId)\n : null;\n\n $ext = (isset($parsedNumber['ext']) && is_string($parsedNumber['ext']) && strlen($parsedNumber['ext']) <= 10)\n ? $parsedNumber['ext']\n : null;\n\n $title = isset($properties['jobtitle']) ? mb_strimwidth($properties['jobtitle'], 0, 128) : null;\n $email = isset($properties['email']) ? mb_strimwidth($properties['email'], 0, 191) : null;\n $remotelyCreatedAt = ! empty($properties['createdate']) ? Carbon::parse($properties['createdate']) : null;\n\n return [\n 'crm_provider_id' => $crmId,\n 'team_id' => $this->team->getId(),\n 'account_id' => $accountId,\n 'user_id' => $profile?->getUserId(),\n 'owner_id' => $ownerId,\n 'name' => $name,\n 'title' => $title,\n 'email' => $email,\n 'country_code' => $countryCode,\n 'phone' => $parsedNumber['phone'] ?? null,\n 'mobile_phone' => $mobileNumber ?? null,\n 'ext' => $ext,\n 'photo_path' => $photoPath,\n 'remotely_created_at' => $remotelyCreatedAt,\n ];\n }\n\n /**\n * @param $properties\n */\n private function buildContactName($properties): string\n {\n if (is_array($properties)) {\n return $this->buildContactNameFromArray($properties);\n }\n\n return $this->buildContactNameFromObject($properties);\n }\n\n private function buildContactNameFromArray(array $properties): string\n {\n if (! empty($properties['name'])) {\n return mb_strimwidth($properties['name'], 0, 100);\n }\n\n $name = '';\n if (! empty($properties['firstname'])) {\n $name = $properties['firstname'] . ' ';\n }\n\n if (! empty($properties['lastname'])) {\n $name .= $properties['lastname'];\n }\n\n if ($name === '' && ! empty($properties['email'])) {\n $name = $properties['email'];\n }\n\n return mb_strimwidth($name, 0, 100);\n }\n\n private function buildContactNameFromObject($properties): string\n {\n $name = '';\n if (isset($properties->firstname)) {\n $name = $properties->firstname->value . ' ';\n }\n if (isset($properties->lastname)) {\n $name .= $properties->lastname->value;\n }\n if ($name === '' && isset($properties->email)) {\n $name = $properties->email->value;\n }\n\n return mb_strimwidth($name, 0, 100);\n }\n\n /**\n * @param $properties\n */\n private function buildContactPhone(?string $countryCode, $properties): ?array\n {\n if (is_array($properties) && empty($properties['phone']) === false) {\n $number = mb_strimwidth($properties['phone'], 0, 25);\n\n return parsePhoneNumber($countryCode, $number);\n } elseif (isset($properties->phone)) {\n $number = mb_strimwidth($properties->phone->value, 0, 25);\n\n return parsePhoneNumber($countryCode, $number);\n }\n\n return [];\n }\n\n /**\n * @param $properties\n */\n private function buildContactMobilePhone(?string $countryCode, $properties): ?string\n {\n return isset($properties['mobilephone'])\n ? Str::limit(phone_e164($countryCode, $properties['mobilephone']), 25, '')\n : null;\n }\n\n /**\n * @param $properties\n * @param $account\n */\n private function buildContactCountry($properties): ?string\n {\n if (is_array($properties) && empty($properties['country']) === false) {\n return $this->convertCountryNameToCode($properties['country']);\n }\n\n if (isset($properties->country)) {\n return $this->convertCountryNameToCode($properties->country->value);\n }\n\n return null;\n }\n\n /**\n * HubSpot doesn't have leads, so this method does nothing.\n *\n * @param Carbon $since\n * @param Carbon|null $to\n * @param string|null $crmProfileId\n *\n * @return int\n */\n public function syncLeads(Carbon $since, ?Carbon $to = null, ?string $crmProfileId = null): int\n {\n // Mark unused parameters to avoid code smell warnings\n unset($since, $to, $crmProfileId);\n\n return 0;\n }\n\n /**\n * HubSpot doesn't have leads.\n *\n * @param string $crmId\n *\n * @inheritdoc\n */\n public function syncLead(string $crmId): ?Lead\n {\n // Mark unused parameter to avoid code smell warnings\n unset($crmId);\n\n return null;\n }\n\n /**\n * Sync accounts (companies) modified since a given date (manual sync mode).\n *\n * This method fetches companies from HubSpot API based on modification date and\n * imports them one by one. It is used for:\n * - Manual sync commands (e.g., crm:sync-account with --from parameter)\n * - Initial sync for new teams\n * - Backfill operations\n *\n * For regular sync webhook batchSyncCompanies is used:\n *\n * @param Carbon $since Fetch companies modified after this date\n * @param Carbon|null $to Optional end date for modification range\n *\n * @return int Number of companies successfully synced\n */\n public function syncAccounts(Carbon $since, ?Carbon $to = null): int\n {\n $syncCount = 0;\n\n try {\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $fields = $this->getCompanyFields();\n $payload = $this->payloadBuilder->getRecentlyUpdatedSearchPayload($since, $to, $fields);\n\n foreach ($this->client->getPaginatedDataGenerator($payload, 'companies') as $hsAccount) {\n $this->importAccount($hsAccount);\n $syncCount++;\n }\n } catch (Exception $exception) {\n $this->logger->error('[' . $this->getDisplayName() . '] Sync accounts failed', [\n 'teamId' => $this->team->getUuid(),\n 'reason' => $exception->getMessage(),\n ]);\n }\n\n return $syncCount;\n }\n\n /**\n * @inheritdoc\n */\n public function syncAccount(string $crmId): ?Account\n {\n try {\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $fields = $this->getCompanyFields();\n $hsAccount = $this->client->getAccountById($crmId, $fields);\n } catch (\\HubSpot\\Client\\Crm\\Companies\\ApiException $e) {\n $this->logger->info('[' . $this->getDisplayName() . '] Account fetch failed', [\n 'teamId' => $this->team->getUuid(),\n 'crmId' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n return null;\n } catch (CrmException $e) {\n $this->logger->info('[' . $this->getDisplayName() . '] Account not found', [\n 'teamId' => $this->team->getUuid(),\n 'crmId' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n return null;\n }\n\n return $this->importAccount($hsAccount);\n }\n\n /**\n * Process webhook-collected contact batches.\n *\n * Drains Redis sets containing contact CRM IDs collected from webhook events\n * and dispatches ImportContactBatch jobs for batch processing.\n *\n * @return int Number of contact IDs dispatched to jobs\n */\n public function batchSyncContacts(): int\n {\n $configId = $this->team->getCrmConfiguration()->getId();\n\n return $this->batchProcessor->processBatchesForObjectType(\n WebhookSyncBatchProcessor::OBJECT_TYPE_CONTACT,\n $configId\n );\n }\n\n public function importContactBatchByIds(array $crmIds): array\n {\n $result = [\n 'success_count' => 0,\n 'failed_ids' => [],\n 'errors' => [],\n ];\n\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $batchStart = microtime(true);\n $slowContacts = [];\n\n $fetchStart = microtime(true);\n $allContacts = $this->fetchContactsByIdsInChunks($crmIds);\n $fetchMs = (int) round((microtime(true) - $fetchStart) * 1000);\n\n $fetchedIds = array_map('strval', array_column($allContacts, 'id'));\n $notFoundIds = array_values(array_diff(array_map('strval', $crmIds), $fetchedIds));\n\n if (! empty($notFoundIds)) {\n $this->logger->info('[' . $this->getDisplayName() . '] Contact CRM IDs not found in HubSpot', [\n 'teamId' => $this->team->getId(),\n 'notFoundCount' => \\count($notFoundIds),\n 'notFoundIds' => $notFoundIds,\n 'requestedCount' => \\count($crmIds),\n 'fetchedCount' => \\count($allContacts),\n ]);\n }\n\n if (empty($allContacts)) {\n return $result;\n }\n\n $prepareStart = microtime(true);\n $accountMappings = $this->prepareAccountMappingsForContacts($allContacts);\n $prepareAccountsMs = (int) round((microtime(true) - $prepareStart) * 1000);\n\n $loopStart = microtime(true);\n foreach ($allContacts as $contactData) {\n $contactStart = microtime(true);\n\n try {\n $contact = $this->importContact($contactData, $accountMappings);\n if ($contact !== null) {\n $result['success_count']++;\n }\n } catch (\\Throwable $e) {\n $crmId = $contactData['id'] ?? 'unknown';\n $result['failed_ids'][] = $crmId;\n $result['errors'][$crmId] = $e->getMessage();\n\n $this->logger->warning('[' . $this->getDisplayName() . '] Failed to import contact', [\n 'teamId' => $this->team->getId(),\n 'crmId' => $crmId,\n 'error' => $e->getMessage(),\n ]);\n }\n\n $contactMs = (int) round((microtime(true) - $contactStart) * 1000);\n if ($contactMs > 1000) {\n $slowContacts[] = ['crmId' => $contactData['id'] ?? 'unknown', 'ms' => $contactMs];\n }\n }\n $loopMs = (int) round((microtime(true) - $loopStart) * 1000);\n $totalMs = (int) round((microtime(true) - $batchStart) * 1000);\n\n $this->logger->info('[' . $this->getDisplayName() . '] importContactBatch timing', [\n 'teamId' => $this->team->getId(),\n 'contact_count' => \\count($allContacts),\n 'requested_count' => \\count($crmIds),\n 'not_found_count' => \\count($notFoundIds),\n 'total_ms' => $totalMs,\n 'fetch_api_ms' => $fetchMs,\n 'prepare_accounts_ms' => $prepareAccountsMs,\n 'contacts_loop_ms' => $loopMs,\n 'avg_contact_ms' => ! empty($allContacts) ? (int) round($loopMs / \\count($allContacts)) : 0,\n 'slow_contacts_count' => \\count($slowContacts),\n 'slow_contacts' => array_slice($slowContacts, 0, 10),\n ]);\n\n return $result;\n }\n\n private function fetchContactsByIdsInChunks(array $crmIds): array\n {\n $fields = $this->getContactFields();\n $allContacts = [];\n\n foreach (array_chunk($crmIds, self::BATCH_SIZE) as $chunk) {\n try {\n $contacts = $this->client->getContactsByIds($chunk, $fields);\n foreach ($contacts as $contactData) {\n $allContacts[] = $contactData;\n }\n } catch (\\Throwable $e) {\n // @TODO what will happen if this exception is thrown\n $this->logger->warning('[' . $this->getDisplayName() . '] Batch contact fetch failed', [\n 'chunk_size' => \\count($chunk),\n 'error' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n }\n\n return $allContacts;\n }\n\n private function prepareAccountMappingsForContacts(array $contacts): array\n {\n $companyIds = [];\n foreach ($contacts as $contact) {\n $companyId = $contact['properties']['associatedcompanyid'] ?? null;\n if ($companyId !== null && $companyId !== '') {\n $companyIds[] = (string) $companyId;\n }\n }\n\n $companyIds = array_unique($companyIds);\n\n if (empty($companyIds)) {\n return [];\n }\n\n $mappings = $this->crmEntityRepository\n ->getExistingAccountIdsMap($this->config, $companyIds);\n\n $missingCompanyIds = array_diff($companyIds, array_keys($mappings));\n\n if (empty($missingCompanyIds)) {\n return $mappings;\n }\n\n $this->logger->info('[' . $this->getDisplayName() . '] Batch syncing missing accounts for contacts', [\n 'teamId' => $this->team->getId(),\n 'total_companies' => \\count($companyIds),\n 'existing_companies' => \\count($mappings),\n 'missing_companies' => \\count($missingCompanyIds),\n ]);\n\n try {\n $syncedAccounts = $this->batchSyncAccountsForContacts($missingCompanyIds);\n $mappings = array_merge($mappings, $syncedAccounts);\n } catch (\\Throwable $e) {\n $this->logger->error('[' . $this->getDisplayName() . '] Failed to batch sync missing accounts', [\n 'teamId' => $this->team->getId(),\n 'missingCompanyIds' => $missingCompanyIds,\n 'missingCount' => count($missingCompanyIds),\n 'error' => $e->getMessage(),\n ]);\n }\n\n return $mappings;\n }\n\n private function batchSyncAccountsForContacts(array $companyIds): array\n {\n $syncedAccounts = [];\n $fields = $this->getCompanyFields();\n\n foreach (array_chunk($companyIds, self::BATCH_SIZE) as $chunk) {\n try {\n $companies = $this->client->getCompaniesByIds($chunk, $fields);\n\n foreach ($companies as $companyData) {\n try {\n $account = $this->importAccount($companyData);\n if ($account) {\n $syncedAccounts[$account->getCrmProviderId()] = $account->getId();\n }\n } catch (\\Throwable $e) {\n $this->logger->warning('[' . $this->getDisplayName() . '] Failed to import account in batch', [\n 'teamId' => $this->team->getId(),\n 'companyId' => $companyData['id'] ?? 'unknown',\n 'error' => $e->getMessage(),\n ]);\n }\n }\n } catch (\\Throwable $e) {\n $this->logger->warning('[' . $this->getDisplayName() . '] Batch company fetch failed', [\n 'teamId' => $this->team->getId(),\n 'chunk_size' => \\count($chunk),\n 'error' => $e->getMessage(),\n ]);\n }\n }\n\n return $syncedAccounts;\n }\n\n /**\n * Process webhook-collected company batches.\n *\n * Drains Redis sets containing company CRM IDs collected from webhook events\n * and dispatches ImportAccountBatch jobs for batch processing.\n *\n * @return int Number of company IDs dispatched to jobs\n */\n public function batchSyncCompanies(): int\n {\n $configId = $this->team->getCrmConfiguration()->getId();\n\n return $this->batchProcessor->processBatchesForObjectType(\n WebhookSyncBatchProcessor::OBJECT_TYPE_COMPANY,\n $configId\n );\n }\n\n public function importAccountBatchByIds(array $crmIds): array\n {\n $result = [\n 'success_count' => 0,\n 'failed_ids' => [],\n 'errors' => [],\n ];\n\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $batchStart = microtime(true);\n $slowAccounts = [];\n\n $fields = $this->getCompanyFields();\n $allCompanies = [];\n\n $fetchStart = microtime(true);\n foreach (array_chunk($crmIds, self::BATCH_SIZE) as $chunk) {\n try {\n $companies = $this->client->getCompaniesByIds($chunk, $fields);\n foreach ($companies as $companyData) {\n $allCompanies[] = $companyData;\n }\n } catch (\\Throwable $e) {\n $this->logger->warning('[' . $this->getDisplayName() . '] Batch company fetch failed', [\n 'chunk_size' => \\count($chunk),\n 'error' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n }\n $fetchMs = (int) round((microtime(true) - $fetchStart) * 1000);\n\n $fetchedIds = array_map('strval', array_column($allCompanies, 'id'));\n $notFoundIds = array_values(array_diff(array_map('strval', $crmIds), $fetchedIds));\n\n if (! empty($notFoundIds)) {\n $this->logger->info('[' . $this->getDisplayName() . '] Company CRM IDs not found in HubSpot', [\n 'teamId' => $this->team->getId(),\n 'notFoundCount' => \\count($notFoundIds),\n 'notFoundIds' => $notFoundIds,\n 'requestedCount' => \\count($crmIds),\n 'fetchedCount' => \\count($allCompanies),\n ]);\n }\n\n $loopStart = microtime(true);\n foreach ($allCompanies as $companyData) {\n $accountStart = microtime(true);\n\n try {\n $account = $this->importAccount($companyData);\n if ($account !== null) {\n $result['success_count']++;\n }\n } catch (\\Throwable $e) {\n $crmId = $companyData['id'] ?? $companyData['properties']['hs_object_id'] ?? 'unknown';\n $result['failed_ids'][] = $crmId;\n $result['errors'][$crmId] = $e->getMessage();\n\n $this->logger->warning('[' . $this->getDisplayName() . '] Failed to import account', [\n 'crmId' => $crmId,\n 'error' => $e->getMessage(),\n ]);\n }\n\n $accountMs = (int) round((microtime(true) - $accountStart) * 1000);\n if ($accountMs > 1000) {\n $crmId = $companyData['id'] ?? $companyData['properties']['hs_object_id'] ?? 'unknown';\n $slowAccounts[] = ['crmId' => $crmId, 'ms' => $accountMs];\n }\n }\n $loopMs = (int) round((microtime(true) - $loopStart) * 1000);\n $totalMs = (int) round((microtime(true) - $batchStart) * 1000);\n\n $this->logger->info('[' . $this->getDisplayName() . '] importAccountBatch timing', [\n 'teamId' => $this->team->getId(),\n 'account_count' => \\count($allCompanies),\n 'requested_count' => \\count($crmIds),\n 'not_found_count' => \\count($notFoundIds),\n 'total_ms' => $totalMs,\n 'fetch_api_ms' => $fetchMs,\n 'accounts_loop_ms' => $loopMs,\n 'avg_account_ms' => ! empty($allCompanies) ? (int) round($loopMs / \\count($allCompanies)) : 0,\n 'slow_accounts_count' => \\count($slowAccounts),\n 'slow_accounts' => array_slice($slowAccounts, 0, 10),\n ]);\n\n return $result;\n }\n\n private function getCompanyFields(): array\n {\n return [\n 'country',\n 'name',\n 'phone',\n 'domain',\n 'hs_avatar_filemanager_key',\n 'industry',\n 'hubspot_owner_id',\n 'hs_object_id',\n 'createdate',\n 'hs_lastmodifieddate',\n ];\n }\n\n private function importAccount($crmData): ?Account\n {\n $crmProviderId = $crmData['id'] ?? $crmData['properties']['hs_object_id'] ?? null;\n\n $this->logger->info('[HubSpot] importAccount', [\n 'crm_provider_id' => $crmProviderId,\n 'config_id' => $this->config->getId(),\n ]);\n\n if (empty($crmData['properties'])) {\n $this->logger->info('[HubSpot] importAccount failed: empty properties', [\n 'crm_provider_id' => $crmProviderId,\n 'config_id' => $this->config->getId(),\n ]);\n\n return null;\n }\n\n $properties = $crmData['properties'];\n $crmId = (string) $properties['hs_object_id'];\n\n $countryCode = isset($properties['country']) ? $this->convertCountryNameToCode($properties['country']) : null;\n\n if (isset($properties['phone'])) {\n // Trim to our width and attempt to parse it.\n $number = mb_strimwidth($properties['phone'], 0, 25);\n $parsedNumber = parsePhoneNumber($countryCode, $number);\n } else {\n $parsedNumber = [];\n }\n\n $name = '[unknown]';\n if (isset($properties['name'])) {\n $name = $properties['name'];\n }\n\n $photoPath = $this->prospectPhotoPathService->getOrGeneratePhotoPath(\n $this->config,\n $crmId,\n Account::class,\n $crmId,\n $name\n );\n\n $industry = null;\n if (isset($properties['industry'])) {\n $industry = mb_strimwidth($properties['industry'], 0, 40);\n }\n\n $ownerId = $profile = null;\n if (isset($properties['hubspot_owner_id'])) {\n $ownerId = $properties['hubspot_owner_id'];\n $profile = $this->crmEntityRepository->findProfileByExternalId($this->config, (string) $ownerId);\n }\n\n $domain = null;\n if (isset($properties['domain'])) {\n $domain = StringUtil::resolveDomain($properties['domain']);\n }\n\n $remotelyCreatedAt = null;\n if (isset($properties['createdate']) && ! empty($properties['createdate'])) {\n $remotelyCreatedAt = Carbon::parse($properties['createdate']);\n }\n\n $data = [\n 'crm_provider_id' => $crmId,\n 'team_id' => $this->team->id,\n 'user_id' => $profile ? $profile->user_id : null,\n 'owner_id' => $ownerId,\n 'name' => mb_strimwidth($name, 0, 191),\n 'photo_path' => $photoPath,\n 'industry' => $industry,\n 'domain' => $domain !== null\n ? substr($domain, 0, 191)\n : null,\n 'phone' => $parsedNumber['phone'] ?? null,\n 'ext' => $parsedNumber['ext'] ?? null,\n 'country_code' => $countryCode,\n 'remotely_created_at' => $remotelyCreatedAt,\n ];\n\n return $this->crmEntityRepository->importAccount($this->config, $data);\n }\n\n public function deleteContact(string $crmProviderId): bool\n {\n try {\n $contact = $this->crmEntityRepository->findContactByExternalId($this->config, $crmProviderId);\n\n if (! $contact) {\n $this->logger->info('[HubSpot] Contact not found for deletion', [\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n ]);\n\n // return success because we do not know which instance is the target\n return true;\n }\n\n $id = $contact->getId();\n\n $this->logger->info('[HubSpot] Deleting contact via webhook', [\n 'contact_id' => $id,\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n ]);\n\n $contact->delete();\n DeleteContactJob::dispatch($id)->afterCommit();\n\n return true;\n } catch (Exception $e) {\n $this->logger->error('[HubSpot] Failed to delete contact via webhook', [\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n 'error' => $e->getMessage(),\n ]);\n\n return false;\n }\n }\n\n public function deleteAccount(string $crmProviderId): bool\n {\n try {\n $account = $this->crmEntityRepository->findAccountByExternalId($this->config, $crmProviderId);\n\n if (! $account) {\n $this->logger->info('[HubSpot] Account not found for deletion', [\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n ]);\n\n // return success because we do not know which instance is the target\n return true;\n }\n\n $id = $account->getId();\n\n $this->logger->info('[HubSpot] Deleting account via webhook', [\n 'account_id' => $id,\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n ]);\n\n $account->delete();\n DeleteAccountJob::dispatch($id)->afterCommit();\n\n return true;\n } catch (Exception $e) {\n $this->logger->error('[HubSpot] Failed to delete account via webhook', [\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n 'error' => $e->getMessage(),\n ]);\n\n return false;\n }\n }\n\n public function deleteOpportunity(string $crmProviderId): bool\n {\n try {\n $opportunity = $this->crmEntityRepository->findOpportunityByExternalId($this->config, $crmProviderId);\n\n if (! $opportunity) {\n $this->logger->info('[HubSpot] Opportunity not found for deletion', [\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n ]);\n\n // return success because we do not know which instance is the target\n return true;\n }\n\n $id = $opportunity->getId();\n\n $this->logger->info('[HubSpot] Deleting opportunity via webhook', [\n 'opportunity_id' => $id,\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n ]);\n\n $opportunity->delete();\n DeleteOpportunityJob::dispatch($id)->afterCommit();\n\n return true;\n } catch (Exception $e) {\n $this->logger->error('[HubSpot] Failed to delete opportunity via webhook', [\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n 'error' => $e->getMessage(),\n ]);\n\n return false;\n }\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Hubspot\\ServiceTraits;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Support\\Str;\nuse Jiminny\\Exceptions\\CrmException;\nuse Jiminny\\Jobs\\Crm\\Delete\\DeleteAccountJob;\nuse Jiminny\\Jobs\\Crm\\Delete\\DeleteContactJob;\nuse Jiminny\\Jobs\\Crm\\Delete\\DeleteOpportunityJob;\nuse Jiminny\\Models\\Account;\nuse Jiminny\\Models\\Contact;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Repositories\\Crm\\CrmEntityRepository;\nuse Jiminny\\Services\\Avatar\\ProspectPhotoPathService;\nuse Jiminny\\Services\\Crm\\Hubspot\\HubspotClientInterface;\nuse Jiminny\\Services\\Crm\\Hubspot\\WebhookSyncBatchProcessor;\nuse Jiminny\\Utils\\StringUtil;\n\ntrait SyncCrmEntitiesTrait\n{\n use OpportunitySyncTrait;\n private const string CDN_URL = 'https://cdn2.hubspot.net/';\n protected CrmEntityRepository $crmEntityRepository;\n protected ProspectPhotoPathService $prospectPhotoPathService;\n\n private function getAssociationDataForCollection(array $collection, string $fromObject, string $toObject): array\n {\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $hsOpportunityIds = array_column($collection, 'id');\n\n return $this->client->getAssociationsData($hsOpportunityIds, $fromObject, $toObject);\n }\n\n private function importAssociationData(array $collection, array $associatedData): array\n {\n $data = [];\n if (! empty($associatedData[$collection['id']])) {\n foreach ($associatedData[$collection['id']] as $id) {\n $data[] = [\n 'id' => $id,\n ];\n }\n }\n\n return ['results' => $data];\n }\n\n /**\n * Sync contacts modified since a given date (manual sync mode).\n *\n * This method fetches contacts from HubSpot API based on modification date and\n * imports them one by one. It is used for:\n * - Manual sync commands (e.g., crm:sync-contact with --from parameter)\n * - Initial sync for new teams\n * - Backfill operations\n *\n * For regular sync webhook batchSyncContacts is used:\n *\n * @param Carbon $since Fetch contacts modified after this date\n * @param Carbon|null $to Optional end date for modification range\n *\n * @return int Number of contacts successfully synced\n */\n public function syncContacts(Carbon $since, ?Carbon $to = null): int\n {\n $syncCount = 0;\n\n try {\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $fields = $this->getContactFields();\n $payload = $this->payloadBuilder->getRecentlyUpdatedSearchPayload($since, $to, $fields);\n\n foreach ($this->client->getPaginatedDataGenerator($payload, 'contacts') as $hsContact) {\n $this->importContact($hsContact);\n $syncCount++;\n }\n } catch (Exception $exception) {\n $this->logger->error('[' . $this->getDisplayName() . '] Sync contacts failed', [\n 'teamId' => $this->team->getUuid(),\n 'reason' => $exception->getMessage(),\n ]);\n }\n\n return $syncCount;\n }\n\n /**\n * @inheritdoc\n */\n public function syncContact(string $crmId): ?Contact\n {\n try {\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $fields = $this->getContactFields();\n $hsContact = $this->client->getContactById($crmId, $fields);\n } catch (\\HubSpot\\Client\\Crm\\Contacts\\ApiException $e) {\n $this->logger->info('[' . $this->getDisplayName() . '] Contact fetch failed', [\n 'teamId' => $this->team->getUuid(),\n 'crmId' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n return null;\n } catch (CrmException $e) {\n $this->logger->info('[' . $this->getDisplayName() . '] Contact not found', [\n 'teamId' => $this->team->getUuid(),\n 'crmId' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n return null;\n }\n\n if (empty($hsContact['properties']) || empty($hsContact['id'])) {\n $this->logger->warning('[' . $this->getDisplayName() . '] Contact data incomplete', [\n 'teamId' => $this->team->getUuid(),\n 'crmId' => $crmId,\n 'has_properties' => ! empty($hsContact['properties']),\n 'has_id' => ! empty($hsContact['id']),\n ]);\n\n return null;\n }\n\n return $this->importContact($hsContact);\n }\n\n private function getContactFields(): array\n {\n return [\n 'associatedcompanyid',\n 'country',\n 'firstname',\n 'lastname',\n 'phone',\n 'mobilephone',\n 'email',\n 'photo',\n 'hs_avatar_filemanager_key',\n 'jobtitle',\n 'hubspot_owner_id',\n 'hs_object_id',\n 'createdate',\n 'hs_lastmodifieddate',\n ];\n }\n\n /**\n * @inheritdoc\n */\n private function importContact($crmData, array $accountMappings = []): ?Contact\n {\n $crmProviderId = $crmData['id'] ?? null;\n\n $this->logger->info('[HubSpot] importContact', [\n 'crm_provider_id' => $crmProviderId,\n 'config_id' => $this->config->getId(),\n ]);\n\n if (empty($crmData['properties'])) {\n $this->logger->info('[HubSpot] importContact failed: empty properties', [\n 'crm_provider_id' => $crmProviderId,\n 'config_id' => $this->config->getId(),\n ]);\n\n return null;\n }\n\n $properties = $crmData['properties'];\n $crmId = (string) $crmData['id'];\n\n $accountId = $this->resolveContactAccount($properties, $accountMappings);\n $data = $this->buildContactData($crmId, $properties, $accountId);\n\n return $this->crmEntityRepository->importContact($this->config, $data);\n }\n\n private function resolveContactAccount(array $properties, array $accountMappings): ?int\n {\n if (empty($properties['associatedcompanyid'])) {\n return null;\n }\n\n $companyId = (string) $properties['associatedcompanyid'];\n\n if (! empty($accountMappings)) {\n return $accountMappings[$companyId] ?? null;\n }\n\n return $this->crmEntityRepository->findAccountByExternalId(\n $this->team->getCrmConfiguration(),\n $companyId\n )?->getId() ?? $this->syncAccount($companyId)?->getId();\n }\n\n private function buildContactData(string $crmId, array $properties, ?int $accountId): array\n {\n $countryCode = $this->buildContactCountry($properties);\n $name = $this->buildContactName($properties);\n $photoPath = $this->teamService->generateAvatar(\n $crmId,\n empty($name) ? ($properties['email'] ?? 'N/A') : $name,\n );\n $parsedNumber = $this->buildContactPhone($countryCode, $properties);\n $mobileNumber = $this->buildContactMobilePhone($countryCode, $properties);\n\n $ownerId = $properties['hubspot_owner_id'] ?? null;\n $profile = $ownerId !== null\n ? $this->crmEntityRepository->findProfileByExternalId($this->config, (string) $ownerId)\n : null;\n\n $ext = (isset($parsedNumber['ext']) && is_string($parsedNumber['ext']) && strlen($parsedNumber['ext']) <= 10)\n ? $parsedNumber['ext']\n : null;\n\n $title = isset($properties['jobtitle']) ? mb_strimwidth($properties['jobtitle'], 0, 128) : null;\n $email = isset($properties['email']) ? mb_strimwidth($properties['email'], 0, 191) : null;\n $remotelyCreatedAt = ! empty($properties['createdate']) ? Carbon::parse($properties['createdate']) : null;\n\n return [\n 'crm_provider_id' => $crmId,\n 'team_id' => $this->team->getId(),\n 'account_id' => $accountId,\n 'user_id' => $profile?->getUserId(),\n 'owner_id' => $ownerId,\n 'name' => $name,\n 'title' => $title,\n 'email' => $email,\n 'country_code' => $countryCode,\n 'phone' => $parsedNumber['phone'] ?? null,\n 'mobile_phone' => $mobileNumber ?? null,\n 'ext' => $ext,\n 'photo_path' => $photoPath,\n 'remotely_created_at' => $remotelyCreatedAt,\n ];\n }\n\n /**\n * @param $properties\n */\n private function buildContactName($properties): string\n {\n if (is_array($properties)) {\n return $this->buildContactNameFromArray($properties);\n }\n\n return $this->buildContactNameFromObject($properties);\n }\n\n private function buildContactNameFromArray(array $properties): string\n {\n if (! empty($properties['name'])) {\n return mb_strimwidth($properties['name'], 0, 100);\n }\n\n $name = '';\n if (! empty($properties['firstname'])) {\n $name = $properties['firstname'] . ' ';\n }\n\n if (! empty($properties['lastname'])) {\n $name .= $properties['lastname'];\n }\n\n if ($name === '' && ! empty($properties['email'])) {\n $name = $properties['email'];\n }\n\n return mb_strimwidth($name, 0, 100);\n }\n\n private function buildContactNameFromObject($properties): string\n {\n $name = '';\n if (isset($properties->firstname)) {\n $name = $properties->firstname->value . ' ';\n }\n if (isset($properties->lastname)) {\n $name .= $properties->lastname->value;\n }\n if ($name === '' && isset($properties->email)) {\n $name = $properties->email->value;\n }\n\n return mb_strimwidth($name, 0, 100);\n }\n\n /**\n * @param $properties\n */\n private function buildContactPhone(?string $countryCode, $properties): ?array\n {\n if (is_array($properties) && empty($properties['phone']) === false) {\n $number = mb_strimwidth($properties['phone'], 0, 25);\n\n return parsePhoneNumber($countryCode, $number);\n } elseif (isset($properties->phone)) {\n $number = mb_strimwidth($properties->phone->value, 0, 25);\n\n return parsePhoneNumber($countryCode, $number);\n }\n\n return [];\n }\n\n /**\n * @param $properties\n */\n private function buildContactMobilePhone(?string $countryCode, $properties): ?string\n {\n return isset($properties['mobilephone'])\n ? Str::limit(phone_e164($countryCode, $properties['mobilephone']), 25, '')\n : null;\n }\n\n /**\n * @param $properties\n * @param $account\n */\n private function buildContactCountry($properties): ?string\n {\n if (is_array($properties) && empty($properties['country']) === false) {\n return $this->convertCountryNameToCode($properties['country']);\n }\n\n if (isset($properties->country)) {\n return $this->convertCountryNameToCode($properties->country->value);\n }\n\n return null;\n }\n\n /**\n * HubSpot doesn't have leads, so this method does nothing.\n *\n * @param Carbon $since\n * @param Carbon|null $to\n * @param string|null $crmProfileId\n *\n * @return int\n */\n public function syncLeads(Carbon $since, ?Carbon $to = null, ?string $crmProfileId = null): int\n {\n // Mark unused parameters to avoid code smell warnings\n unset($since, $to, $crmProfileId);\n\n return 0;\n }\n\n /**\n * HubSpot doesn't have leads.\n *\n * @param string $crmId\n *\n * @inheritdoc\n */\n public function syncLead(string $crmId): ?Lead\n {\n // Mark unused parameter to avoid code smell warnings\n unset($crmId);\n\n return null;\n }\n\n /**\n * Sync accounts (companies) modified since a given date (manual sync mode).\n *\n * This method fetches companies from HubSpot API based on modification date and\n * imports them one by one. It is used for:\n * - Manual sync commands (e.g., crm:sync-account with --from parameter)\n * - Initial sync for new teams\n * - Backfill operations\n *\n * For regular sync webhook batchSyncCompanies is used:\n *\n * @param Carbon $since Fetch companies modified after this date\n * @param Carbon|null $to Optional end date for modification range\n *\n * @return int Number of companies successfully synced\n */\n public function syncAccounts(Carbon $since, ?Carbon $to = null): int\n {\n $syncCount = 0;\n\n try {\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $fields = $this->getCompanyFields();\n $payload = $this->payloadBuilder->getRecentlyUpdatedSearchPayload($since, $to, $fields);\n\n foreach ($this->client->getPaginatedDataGenerator($payload, 'companies') as $hsAccount) {\n $this->importAccount($hsAccount);\n $syncCount++;\n }\n } catch (Exception $exception) {\n $this->logger->error('[' . $this->getDisplayName() . '] Sync accounts failed', [\n 'teamId' => $this->team->getUuid(),\n 'reason' => $exception->getMessage(),\n ]);\n }\n\n return $syncCount;\n }\n\n /**\n * @inheritdoc\n */\n public function syncAccount(string $crmId): ?Account\n {\n try {\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $fields = $this->getCompanyFields();\n $hsAccount = $this->client->getAccountById($crmId, $fields);\n } catch (\\HubSpot\\Client\\Crm\\Companies\\ApiException $e) {\n $this->logger->info('[' . $this->getDisplayName() . '] Account fetch failed', [\n 'teamId' => $this->team->getUuid(),\n 'crmId' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n return null;\n } catch (CrmException $e) {\n $this->logger->info('[' . $this->getDisplayName() . '] Account not found', [\n 'teamId' => $this->team->getUuid(),\n 'crmId' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n return null;\n }\n\n return $this->importAccount($hsAccount);\n }\n\n /**\n * Process webhook-collected contact batches.\n *\n * Drains Redis sets containing contact CRM IDs collected from webhook events\n * and dispatches ImportContactBatch jobs for batch processing.\n *\n * @return int Number of contact IDs dispatched to jobs\n */\n public function batchSyncContacts(): int\n {\n $configId = $this->team->getCrmConfiguration()->getId();\n\n return $this->batchProcessor->processBatchesForObjectType(\n WebhookSyncBatchProcessor::OBJECT_TYPE_CONTACT,\n $configId\n );\n }\n\n public function importContactBatchByIds(array $crmIds): array\n {\n $result = [\n 'success_count' => 0,\n 'failed_ids' => [],\n 'errors' => [],\n ];\n\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $batchStart = microtime(true);\n $slowContacts = [];\n\n $fetchStart = microtime(true);\n $allContacts = $this->fetchContactsByIdsInChunks($crmIds);\n $fetchMs = (int) round((microtime(true) - $fetchStart) * 1000);\n\n $fetchedIds = array_map('strval', array_column($allContacts, 'id'));\n $notFoundIds = array_values(array_diff(array_map('strval', $crmIds), $fetchedIds));\n\n if (! empty($notFoundIds)) {\n $this->logger->info('[' . $this->getDisplayName() . '] Contact CRM IDs not found in HubSpot', [\n 'teamId' => $this->team->getId(),\n 'notFoundCount' => \\count($notFoundIds),\n 'notFoundIds' => $notFoundIds,\n 'requestedCount' => \\count($crmIds),\n 'fetchedCount' => \\count($allContacts),\n ]);\n }\n\n if (empty($allContacts)) {\n return $result;\n }\n\n $prepareStart = microtime(true);\n $accountMappings = $this->prepareAccountMappingsForContacts($allContacts);\n $prepareAccountsMs = (int) round((microtime(true) - $prepareStart) * 1000);\n\n $loopStart = microtime(true);\n foreach ($allContacts as $contactData) {\n $contactStart = microtime(true);\n\n try {\n $contact = $this->importContact($contactData, $accountMappings);\n if ($contact !== null) {\n $result['success_count']++;\n }\n } catch (\\Throwable $e) {\n $crmId = $contactData['id'] ?? 'unknown';\n $result['failed_ids'][] = $crmId;\n $result['errors'][$crmId] = $e->getMessage();\n\n $this->logger->warning('[' . $this->getDisplayName() . '] Failed to import contact', [\n 'teamId' => $this->team->getId(),\n 'crmId' => $crmId,\n 'error' => $e->getMessage(),\n ]);\n }\n\n $contactMs = (int) round((microtime(true) - $contactStart) * 1000);\n if ($contactMs > 1000) {\n $slowContacts[] = ['crmId' => $contactData['id'] ?? 'unknown', 'ms' => $contactMs];\n }\n }\n $loopMs = (int) round((microtime(true) - $loopStart) * 1000);\n $totalMs = (int) round((microtime(true) - $batchStart) * 1000);\n\n $this->logger->info('[' . $this->getDisplayName() . '] importContactBatch timing', [\n 'teamId' => $this->team->getId(),\n 'contact_count' => \\count($allContacts),\n 'requested_count' => \\count($crmIds),\n 'not_found_count' => \\count($notFoundIds),\n 'total_ms' => $totalMs,\n 'fetch_api_ms' => $fetchMs,\n 'prepare_accounts_ms' => $prepareAccountsMs,\n 'contacts_loop_ms' => $loopMs,\n 'avg_contact_ms' => ! empty($allContacts) ? (int) round($loopMs / \\count($allContacts)) : 0,\n 'slow_contacts_count' => \\count($slowContacts),\n 'slow_contacts' => array_slice($slowContacts, 0, 10),\n ]);\n\n return $result;\n }\n\n private function fetchContactsByIdsInChunks(array $crmIds): array\n {\n $fields = $this->getContactFields();\n $allContacts = [];\n\n foreach (array_chunk($crmIds, self::BATCH_SIZE) as $chunk) {\n try {\n $contacts = $this->client->getContactsByIds($chunk, $fields);\n foreach ($contacts as $contactData) {\n $allContacts[] = $contactData;\n }\n } catch (\\Throwable $e) {\n // @TODO what will happen if this exception is thrown\n $this->logger->warning('[' . $this->getDisplayName() . '] Batch contact fetch failed', [\n 'chunk_size' => \\count($chunk),\n 'error' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n }\n\n return $allContacts;\n }\n\n private function prepareAccountMappingsForContacts(array $contacts): array\n {\n $companyIds = [];\n foreach ($contacts as $contact) {\n $companyId = $contact['properties']['associatedcompanyid'] ?? null;\n if ($companyId !== null && $companyId !== '') {\n $companyIds[] = (string) $companyId;\n }\n }\n\n $companyIds = array_unique($companyIds);\n\n if (empty($companyIds)) {\n return [];\n }\n\n $mappings = $this->crmEntityRepository\n ->getExistingAccountIdsMap($this->config, $companyIds);\n\n $missingCompanyIds = array_diff($companyIds, array_keys($mappings));\n\n if (empty($missingCompanyIds)) {\n return $mappings;\n }\n\n $this->logger->info('[' . $this->getDisplayName() . '] Batch syncing missing accounts for contacts', [\n 'teamId' => $this->team->getId(),\n 'total_companies' => \\count($companyIds),\n 'existing_companies' => \\count($mappings),\n 'missing_companies' => \\count($missingCompanyIds),\n ]);\n\n try {\n $syncedAccounts = $this->batchSyncAccountsForContacts($missingCompanyIds);\n $mappings = array_merge($mappings, $syncedAccounts);\n } catch (\\Throwable $e) {\n $this->logger->error('[' . $this->getDisplayName() . '] Failed to batch sync missing accounts', [\n 'teamId' => $this->team->getId(),\n 'missingCompanyIds' => $missingCompanyIds,\n 'missingCount' => count($missingCompanyIds),\n 'error' => $e->getMessage(),\n ]);\n }\n\n return $mappings;\n }\n\n private function batchSyncAccountsForContacts(array $companyIds): array\n {\n $syncedAccounts = [];\n $fields = $this->getCompanyFields();\n\n foreach (array_chunk($companyIds, self::BATCH_SIZE) as $chunk) {\n try {\n $companies = $this->client->getCompaniesByIds($chunk, $fields);\n\n foreach ($companies as $companyData) {\n try {\n $account = $this->importAccount($companyData);\n if ($account) {\n $syncedAccounts[$account->getCrmProviderId()] = $account->getId();\n }\n } catch (\\Throwable $e) {\n $this->logger->warning('[' . $this->getDisplayName() . '] Failed to import account in batch', [\n 'teamId' => $this->team->getId(),\n 'companyId' => $companyData['id'] ?? 'unknown',\n 'error' => $e->getMessage(),\n ]);\n }\n }\n } catch (\\Throwable $e) {\n $this->logger->warning('[' . $this->getDisplayName() . '] Batch company fetch failed', [\n 'teamId' => $this->team->getId(),\n 'chunk_size' => \\count($chunk),\n 'error' => $e->getMessage(),\n ]);\n }\n }\n\n return $syncedAccounts;\n }\n\n /**\n * Process webhook-collected company batches.\n *\n * Drains Redis sets containing company CRM IDs collected from webhook events\n * and dispatches ImportAccountBatch jobs for batch processing.\n *\n * @return int Number of company IDs dispatched to jobs\n */\n public function batchSyncCompanies(): int\n {\n $configId = $this->team->getCrmConfiguration()->getId();\n\n return $this->batchProcessor->processBatchesForObjectType(\n WebhookSyncBatchProcessor::OBJECT_TYPE_COMPANY,\n $configId\n );\n }\n\n public function importAccountBatchByIds(array $crmIds): array\n {\n $result = [\n 'success_count' => 0,\n 'failed_ids' => [],\n 'errors' => [],\n ];\n\n if (! $this->client instanceof HubspotClientInterface) {\n throw new \\InvalidArgumentException('Client must implement HubspotClientInterface');\n }\n\n $batchStart = microtime(true);\n $slowAccounts = [];\n\n $fields = $this->getCompanyFields();\n $allCompanies = [];\n\n $fetchStart = microtime(true);\n foreach (array_chunk($crmIds, self::BATCH_SIZE) as $chunk) {\n try {\n $companies = $this->client->getCompaniesByIds($chunk, $fields);\n foreach ($companies as $companyData) {\n $allCompanies[] = $companyData;\n }\n } catch (\\Throwable $e) {\n $this->logger->warning('[' . $this->getDisplayName() . '] Batch company fetch failed', [\n 'chunk_size' => \\count($chunk),\n 'error' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n }\n $fetchMs = (int) round((microtime(true) - $fetchStart) * 1000);\n\n $fetchedIds = array_map('strval', array_column($allCompanies, 'id'));\n $notFoundIds = array_values(array_diff(array_map('strval', $crmIds), $fetchedIds));\n\n if (! empty($notFoundIds)) {\n $this->logger->info('[' . $this->getDisplayName() . '] Company CRM IDs not found in HubSpot', [\n 'teamId' => $this->team->getId(),\n 'notFoundCount' => \\count($notFoundIds),\n 'notFoundIds' => $notFoundIds,\n 'requestedCount' => \\count($crmIds),\n 'fetchedCount' => \\count($allCompanies),\n ]);\n }\n\n $loopStart = microtime(true);\n foreach ($allCompanies as $companyData) {\n $accountStart = microtime(true);\n\n try {\n $account = $this->importAccount($companyData);\n if ($account !== null) {\n $result['success_count']++;\n }\n } catch (\\Throwable $e) {\n $crmId = $companyData['id'] ?? $companyData['properties']['hs_object_id'] ?? 'unknown';\n $result['failed_ids'][] = $crmId;\n $result['errors'][$crmId] = $e->getMessage();\n\n $this->logger->warning('[' . $this->getDisplayName() . '] Failed to import account', [\n 'crmId' => $crmId,\n 'error' => $e->getMessage(),\n ]);\n }\n\n $accountMs = (int) round((microtime(true) - $accountStart) * 1000);\n if ($accountMs > 1000) {\n $crmId = $companyData['id'] ?? $companyData['properties']['hs_object_id'] ?? 'unknown';\n $slowAccounts[] = ['crmId' => $crmId, 'ms' => $accountMs];\n }\n }\n $loopMs = (int) round((microtime(true) - $loopStart) * 1000);\n $totalMs = (int) round((microtime(true) - $batchStart) * 1000);\n\n $this->logger->info('[' . $this->getDisplayName() . '] importAccountBatch timing', [\n 'teamId' => $this->team->getId(),\n 'account_count' => \\count($allCompanies),\n 'requested_count' => \\count($crmIds),\n 'not_found_count' => \\count($notFoundIds),\n 'total_ms' => $totalMs,\n 'fetch_api_ms' => $fetchMs,\n 'accounts_loop_ms' => $loopMs,\n 'avg_account_ms' => ! empty($allCompanies) ? (int) round($loopMs / \\count($allCompanies)) : 0,\n 'slow_accounts_count' => \\count($slowAccounts),\n 'slow_accounts' => array_slice($slowAccounts, 0, 10),\n ]);\n\n return $result;\n }\n\n private function getCompanyFields(): array\n {\n return [\n 'country',\n 'name',\n 'phone',\n 'domain',\n 'hs_avatar_filemanager_key',\n 'industry',\n 'hubspot_owner_id',\n 'hs_object_id',\n 'createdate',\n 'hs_lastmodifieddate',\n ];\n }\n\n private function importAccount($crmData): ?Account\n {\n $crmProviderId = $crmData['id'] ?? $crmData['properties']['hs_object_id'] ?? null;\n\n $this->logger->info('[HubSpot] importAccount', [\n 'crm_provider_id' => $crmProviderId,\n 'config_id' => $this->config->getId(),\n ]);\n\n if (empty($crmData['properties'])) {\n $this->logger->info('[HubSpot] importAccount failed: empty properties', [\n 'crm_provider_id' => $crmProviderId,\n 'config_id' => $this->config->getId(),\n ]);\n\n return null;\n }\n\n $properties = $crmData['properties'];\n $crmId = (string) $properties['hs_object_id'];\n\n $countryCode = isset($properties['country']) ? $this->convertCountryNameToCode($properties['country']) : null;\n\n if (isset($properties['phone'])) {\n // Trim to our width and attempt to parse it.\n $number = mb_strimwidth($properties['phone'], 0, 25);\n $parsedNumber = parsePhoneNumber($countryCode, $number);\n } else {\n $parsedNumber = [];\n }\n\n $name = '[unknown]';\n if (isset($properties['name'])) {\n $name = $properties['name'];\n }\n\n $photoPath = $this->prospectPhotoPathService->getOrGeneratePhotoPath(\n $this->config,\n $crmId,\n Account::class,\n $crmId,\n $name\n );\n\n $industry = null;\n if (isset($properties['industry'])) {\n $industry = mb_strimwidth($properties['industry'], 0, 40);\n }\n\n $ownerId = $profile = null;\n if (isset($properties['hubspot_owner_id'])) {\n $ownerId = $properties['hubspot_owner_id'];\n $profile = $this->crmEntityRepository->findProfileByExternalId($this->config, (string) $ownerId);\n }\n\n $domain = null;\n if (isset($properties['domain'])) {\n $domain = StringUtil::resolveDomain($properties['domain']);\n }\n\n $remotelyCreatedAt = null;\n if (isset($properties['createdate']) && ! empty($properties['createdate'])) {\n $remotelyCreatedAt = Carbon::parse($properties['createdate']);\n }\n\n $data = [\n 'crm_provider_id' => $crmId,\n 'team_id' => $this->team->id,\n 'user_id' => $profile ? $profile->user_id : null,\n 'owner_id' => $ownerId,\n 'name' => mb_strimwidth($name, 0, 191),\n 'photo_path' => $photoPath,\n 'industry' => $industry,\n 'domain' => $domain !== null\n ? substr($domain, 0, 191)\n : null,\n 'phone' => $parsedNumber['phone'] ?? null,\n 'ext' => $parsedNumber['ext'] ?? null,\n 'country_code' => $countryCode,\n 'remotely_created_at' => $remotelyCreatedAt,\n ];\n\n return $this->crmEntityRepository->importAccount($this->config, $data);\n }\n\n public function deleteContact(string $crmProviderId): bool\n {\n try {\n $contact = $this->crmEntityRepository->findContactByExternalId($this->config, $crmProviderId);\n\n if (! $contact) {\n $this->logger->info('[HubSpot] Contact not found for deletion', [\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n ]);\n\n // return success because we do not know which instance is the target\n return true;\n }\n\n $id = $contact->getId();\n\n $this->logger->info('[HubSpot] Deleting contact via webhook', [\n 'contact_id' => $id,\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n ]);\n\n $contact->delete();\n DeleteContactJob::dispatch($id)->afterCommit();\n\n return true;\n } catch (Exception $e) {\n $this->logger->error('[HubSpot] Failed to delete contact via webhook', [\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n 'error' => $e->getMessage(),\n ]);\n\n return false;\n }\n }\n\n public function deleteAccount(string $crmProviderId): bool\n {\n try {\n $account = $this->crmEntityRepository->findAccountByExternalId($this->config, $crmProviderId);\n\n if (! $account) {\n $this->logger->info('[HubSpot] Account not found for deletion', [\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n ]);\n\n // return success because we do not know which instance is the target\n return true;\n }\n\n $id = $account->getId();\n\n $this->logger->info('[HubSpot] Deleting account via webhook', [\n 'account_id' => $id,\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n ]);\n\n $account->delete();\n DeleteAccountJob::dispatch($id)->afterCommit();\n\n return true;\n } catch (Exception $e) {\n $this->logger->error('[HubSpot] Failed to delete account via webhook', [\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n 'error' => $e->getMessage(),\n ]);\n\n return false;\n }\n }\n\n public function deleteOpportunity(string $crmProviderId): bool\n {\n try {\n $opportunity = $this->crmEntityRepository->findOpportunityByExternalId($this->config, $crmProviderId);\n\n if (! $opportunity) {\n $this->logger->info('[HubSpot] Opportunity not found for deletion', [\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n ]);\n\n // return success because we do not know which instance is the target\n return true;\n }\n\n $id = $opportunity->getId();\n\n $this->logger->info('[HubSpot] Deleting opportunity via webhook', [\n 'opportunity_id' => $id,\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n ]);\n\n $opportunity->delete();\n DeleteOpportunityJob::dispatch($id)->afterCommit();\n\n return true;\n } catch (Exception $e) {\n $this->logger->error('[HubSpot] Failed to delete opportunity via webhook', [\n 'crm_provider_id' => $crmProviderId,\n 'team_id' => $this->team->getId(),\n 'error' => $e->getMessage(),\n ]);\n\n return false;\n }\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8046841189839988101
|
-4187333948484548378
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
Editor for custom.log
Sync Changes
Hide This Notification
Code changed:
Hide
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot\ServiceTraits;
use Carbon\Carbon;
use Exception;
use Illuminate\Support\Str;
use Jiminny\Exceptions\CrmException;
use Jiminny\Jobs\Crm\Delete\DeleteAccountJob;
use Jiminny\Jobs\Crm\Delete\DeleteContactJob;
use Jiminny\Jobs\Crm\Delete\DeleteOpportunityJob;
use Jiminny\Models\Account;
use Jiminny\Models\Contact;
use Jiminny\Models\Lead;
use Jiminny\Repositories\Crm\CrmEntityRepository;
use Jiminny\Services\Avatar\ProspectPhotoPathService;
use Jiminny\Services\Crm\Hubspot\HubspotClientInterface;
use Jiminny\Services\Crm\Hubspot\WebhookSyncBatchProcessor;
use Jiminny\Utils\StringUtil;
trait SyncCrmEntitiesTrait
{
use OpportunitySyncTrait;
private const string CDN_URL = '[URL_WITH_CREDENTIALS] Carbon $since Fetch contacts modified after this date
* @param Carbon|null $to Optional end date for modification range
*
* @return int Number of contacts successfully synced
*/
public function syncContacts(Carbon $since, ?Carbon $to = null): int
{
$syncCount = 0;
try {
if (! $this->client instanceof HubspotClientInterface) {
throw new \InvalidArgumentException('Client must implement HubspotClientInterface');
}
$fields = $this->getContactFields();
$payload = $this->payloadBuilder->getRecentlyUpdatedSearchPayload($since, $to, $fields);
foreach ($this->client->getPaginatedDataGenerator($payload, 'contacts') as $hsContact) {
$this->importContact($hsContact);
$syncCount++;
}
} catch (Exception $exception) {
$this->logger->error('[' . $this->getDisplayName() . '] Sync contacts failed', [
'teamId' => $this->team->getUuid(),
'reason' => $exception->getMessage(),
]);
}
return $syncCount;
}
/**
* @inheritdoc
*/
public function syncContact(string $crmId): ?Contact
{
try {
if (! $this->client instanceof HubspotClientInterface) {
throw new \InvalidArgumentException('Client must implement HubspotClientInterface');
}
$fields = $this->getContactFields();
$hsContact = $this->client->getContactById($crmId, $fields);
} catch (\HubSpot\Client\Crm\Contacts\ApiException $e) {
$this->logger->info('[' . $this->getDisplayName() . '] Contact fetch failed', [
'teamId' => $this->team->getUuid(),
'crmId' => $crmId,
'reason' => $e->getMessage(),
]);
return null;
} catch (CrmException $e) {
$this->logger->info('[' . $this->getDisplayName() . '] Contact not found', [
'teamId' => $this->team->getUuid(),
'crmId' => $crmId,
'reason' => $e->getMessage(),
]);
return null;
}
if (empty($hsContact['properties']) || empty($hsContact['id'])) {
$this->logger->warning('[' . $this->getDisplayName() . '] Contact data incomplete', [
'teamId' => $this->team->getUuid(),
'crmId' => $crmId,
'has_properties' => ! empty($hsContact['properties']),
'has_id' => ! empty($hsContact['id']),
]);
return null;
}
return $this->importContact($hsContact);
}
private function getContactFields(): array
{
return [
'associatedcompanyid',
'country',
'firstname',
'lastname',
'phone',
'mobilephone',
'email',
'photo',
'hs_avatar_filemanager_key',
'jobtitle',
'hubspot_owner_id',
'hs_object_id',
'createdate',
'hs_lastmodifieddate',
];
}
/**
* @inheritdoc
*/
private function importContact($crmData, array $accountMappings = []): ?Contact
{
$crmProviderId = $crmData['id'] ?? null;
$this->logger->info('[HubSpot] importContact', [
'crm_provider_id' => $crmProviderId,
'config_id' => $this->config->getId(),
]);
if (empty($crmData['properties'])) {
$this->logger->info('[HubSpot] importContact failed: empty properties', [
'crm_provider_id' => $crmProviderId,
'config_id' => $this->config->getId(),
]);
return null;
}
$properties = $crmData['properties'];
$crmId = (string) $crmData['id'];
$accountId = $this->resolveContactAccount($properties, $accountMappings);
$data = $this->buildContactData($crmId, $properties, $accountId);
return $this->crmEntityRepository->importContact($this->config, $data);
}
private function resolveContactAccount(array $properties, array $accountMappings): ?int
{
if (empty($properties['associatedcompanyid'])) {
return null;
}
$companyId = (string) $properties['associatedcompanyid'];
if (! empty($accountMappings)) {
return $accountMappings[$companyId] ?? null;
}
return $this->crmEntityRepository->findAccountByExternalId(
$this->team->getCrmConfiguration(),
$companyId
)?->getId() ?? $this->syncAccount($companyId)?->getId();
}
private function buildContactData(string $crmId, array $properties, ?int $accountId): array
{
$countryCode = $this->buildContactCountry($properties);
$name = $this->buildContactName($properties);
$photoPath = $this->teamService->generateAvatar(
$crmId,
empty($name) ? ($properties['email'] ?? 'N/A') : $name,
);
$parsedNumber = $this->buildContactPhone($countryCode, $properties);
$mobileNumber = $this->buildContactMobilePhone($countryCode, $properties);
$ownerId = $properties['hubspot_owner_id'] ?? null;
$profile = $ownerId !== null
? $this->crmEntityRepository->findProfileByExternalId($this->config, (string) $ownerId)
: null;
$ext = (isset($parsedNumber['ext']) && is_string($parsedNumber['ext']) && strlen($parsedNumber['ext']) <= 10)
? $parsedNumber['ext']
: null;
$title = isset($properties['jobtitle']) ? mb_strimwidth($properties['jobtitle'], 0, 128) : null;
$email = isset($properties['email']) ? mb_strimwidth($properties['email'], 0, 191) : null;
$remotelyCreatedAt = ! empty($properties['createdate']) ? Carbon::parse($properties['createdate']) : null;
return [
'crm_provider_id' => $crmId,
'team_id' => $this->team->getId(),
'account_id' => $accountId,
'user_id' => $profile?->getUserId(),
'owner_id' => $ownerId,
'name' => $name,
'title' => $title,
'email' => $email,
'country_code' => $countryCode,
'phone' => $parsedNumber['phone'] ?? null,
'mobile_phone' => $mobileNumber ?? null,
'ext' => $ext,
'photo_path' => $photoPath,
'remotely_created_at' => $remotelyCreatedAt,
];
}
/**
* @param $properties
*/
private function buildContactName($properties): string
{
if (is_array($properties)) {
return $this->buildContactNameFromArray($properties);
}
return $this->buildContactNameFromObject($properties);
}
private function buildContactNameFromArray(array $properties): string
{
if (! empty($properties['name'])) {
return mb_strimwidth($properties['name'], 0, 100);
}
$name = '';
if (! empty($properties['firstname'])) {
$name = $properties['firstname'] . ' ';
}
if (! empty($properties['lastname'])) {
$name .= $properties['lastname'];
}
if ($name === '' && ! empty($properties['email'])) {
$name = $properties['email'];
}
return mb_strimwidth($name, 0, 100);
}
private function buildContactNameFromObject($properties): string
{
$name = '';
if (isset($properties->firstname)) {
$name = $properties->firstname->value . ' ';
}
if (isset($properties->lastname)) {
$name .= $properties->lastname->value;
}
if ($name === '' && isset($properties->email)) {
$name = $properties->email->value;
}
return mb_strimwidth($name, 0, 100);
}
/**
* @param $properties
*/
private function buildContactPhone(?string $countryCode, $properties): ?array
{
if (is_array($properties) && empty($properties['phone']) === false) {
$number = mb_strimwidth($properties['phone'], 0, 25);
return parsePhoneNumber($countryCode, $number);
} elseif (isset($properties->phone)) {
$number = mb_strimwidth($properties->phone->value, 0, 25);
return parsePhoneNumber($countryCode, $number);
}
return [];
}
/**
* @param $properties
*/
private function buildContactMobilePhone(?string $countryCode, $properties): ?string
{
return isset($properties['mobilephone'])
? Str::limit(phone_e164($countryCode, $properties['mobilephone']), 25, '')
: null;
}
/**
* @param $properties
* @param $account
*/
private function buildContactCountry($properties): ?string
{
if (is_array($properties) && empty($properties['country']) === false) {
return $this->convertCountryNameToCode($properties['country']);
}
if (isset($properties->country)) {
return $this->convertCountryNameToCode($properties->country->value);
}
return null;
}
/**
* HubSpot doesn't have leads, so this method does nothing.
*
* @param Carbon $since
* @param Carbon|null $to
* @param string|null $crmProfileId
*
* @return int
*/
public function syncLeads(Carbon $since, ?Carbon $to = null, ?string $crmProfileId = null): int
{
// Mark unused parameters to avoid code smell warnings
unset($since, $to, $crmProfileId);
return 0;
}
/**
* HubSpot doesn't have leads.
*
* @param string $crmId
*
* @inheritdoc
*/
public function syncLead(string $crmId): ?Lead
{
// Mark unused parameter to avoid code smell warnings
unset($crmId);
return null;
}
/**
* Sync accounts (companies) modified since a given date (manual sync mode).
*
* This method fetches companies from HubSpot API based on modification date and
* imports them one by one. It is used for:
* - Manual sync commands (e.g., crm:sync-account with --from parameter)
* - Initial sync for new teams
* - Backfill operations
*
* For regular sync webhook batchSyncCompanies is used:
*
* @param Carbon $since Fetch companies modified after this date
* @param Carbon|null $to Optional end date for modification range
*
* @return int Number of companies successfully synced
*/
public function syncAccounts(Carbon $since, ?Carbon $to = null): int
{
$syncCount = 0;
try {
if (! $this->client instanceof HubspotClientInterface) {
throw new \InvalidArgumentException('Client must implement HubspotClientInterface');
}
$fields = $this->getCompanyFields();
$payload = $this->payloadBuilder->getRecentlyUpdatedSearchPayload($since, $to, $fields);
foreach ($this->client->getPaginatedDataGenerator($payload, 'companies') as $hsAccount) {
$this->importAccount($hsAccount);
$syncCount++;
}
} catch (Exception $exception) {
$this->logger->error('[' . $this->getDisplayName() . '] Sync accounts failed', [
'teamId' => $this->team->getUuid(),
'reason' => $exception->getMessage(),
]);
}
return $syncCount;
}
/**
* @inheritdoc
*/
public function syncAccount(string $crmId): ?Account
{
try {
if (! $this->client instanceof HubspotClientInterface) {
throw new \InvalidArgumentException('Client must implement HubspotClientInterface');
}
$fields = $this->getCompanyFields();
$hsAccount = $this->client->getAccountById($crmId, $fields);
} catch (\HubSpot\Client\Crm\Companies\ApiException $e) {
$this->logger->info('[' . $this->getDisplayName() . '] Account fetch failed', [
'teamId' => $this->team->getUuid(),
'crmId' => $crmId,
'reason' => $e->getMessage(),
]);
return null;
} catch (CrmException $e) {
$this->logger->info('[' . $this->getDisplayName() . '] Account not found', [
'teamId' => $this->team->getUuid(),
'crmId' => $crmId,
'reason' => $e->getMessage(),
]);
return null;
}
return $this->importAccount($hsAccount);
}
/**
* Process webhook-collected contact batches.
*
* Drains Redis sets containing contact CRM IDs collected from webhook events
* and dispatches ImportContactBatch jobs for batch processing.
*
* @return int Number of contact IDs dispatched to jobs
*/
public function batchSyncContacts(): int
{
$configId = $this->team->getCrmConfiguration()->getId();
return $this->batchProcessor->processBatchesForObjectType(
WebhookSyncBatchProcessor::OBJECT_TYPE_CONTACT,
$configId
);
}
public function importContactBatchByIds(array $crmIds): array
{
$result = [
'success_count' => 0,
'failed_ids' => [],
'errors' => [],
];
if (! $this->client instanceof HubspotClientInterface) {
throw new \InvalidArgumentException('Client must implement HubspotClientInterface');
}
$batchStart = microtime(true);
$slowContacts = [];
$fetchStart = microtime(true);
$allContacts = $this->fetchContactsByIdsInChunks($crmIds);
$fetchMs = (int) round((microtime(true) - $fetchStart) * 1000);
$fetchedIds = array_map('strval', array_column($allContacts, 'id'));
$notFoundIds = array_values(array_diff(array_map('strval', $crmIds), $fetchedIds));
if (! empty($notFoundIds)) {
$this->logger->info('[' . $this->getDisplayName() . '] Contact CRM IDs not found in HubSpot', [
'teamId' => $this->team->getId(),
'notFoundCount' => \count($notFoundIds),
'notFoundIds' => $notFoundIds,
'requestedCount' => \count($crmIds),
'fetchedCount' => \count($allContacts),
]);
}
if (empty($allContacts)) {
return $result;
}
$prepareStart = microtime(true);
$accountMappings = $this->prepareAccountMappingsForContacts($allContacts);
$prepareAccountsMs = (int) round((microtime(true) - $prepareStart) * 1000);
$loopStart = microtime(true);
foreach ($allContacts as $contactData) {
$contactStart = microtime(true);
try {
$contact = $this->importContact($contactData, $accountMappings);
if ($contact !== null) {
$result['success_count']++;
}
} catch (\Throwable $e) {
$crmId = $contactData['id'] ?? 'unknown';
$result['failed_ids'][] = $crmId;
$result['errors'][$crmId] = $e->getMessage();
$this->logger->warning('[' . $this->getDisplayName() . '] Failed to import contact', [
'teamId' => $this->team->getId(),
'crmId' => $crmId,
'error' => $e->getMessage(),
]);
}
$contactMs = (int) round((microtime(true) - $contactStart) * 1000);
if ($contactMs > 1000) {
$slowContacts[] = ['crmId' => $contactData['id'] ?? 'unknown', 'ms' => $contactMs];
}
}
$loopMs = (int) round((microtime(true) - $loopStart) * 1000);
$totalMs = (int) round((microtime(true) - $batchStart) * 1000);
$this->logger->info('[' . $this->getDisplayName() . '] importContactBatch timing', [
'teamId' => $this->team->getId(),
'contact_count' => \count($allContacts),
'requested_count' => \count($crmIds),
'not_found_count' => \count($notFoundIds),
'total_ms' => $totalMs,
'fetch_api_ms' => $fetchMs,
'prepare_accounts_ms' => $prepareAccountsMs,
'contacts_loop_ms' => $loopMs,
'avg_contact_ms' => ! empty($allContacts) ? (int) round($loopMs / \count($allContacts)) : 0,
'slow_contacts_count' => \count($slowContacts),
'slow_contacts' => array_slice($slowContacts, 0, 10),
]);
return $result;
}
private function fetchContactsByIdsInChunks(array $crmIds): array
{
$fields = $this->getContactFields();
$allContacts = [];
foreach (array_chunk($crmIds, self::BATCH_SIZE) as $chunk) {
try {
$contacts = $this->client->getContactsByIds($chunk, $fields);
foreach ($contacts as $contactData) {
$allContacts[] = $contactData;
}
} catch (\Throwable $e) {
// @TODO what will happen if this exception is thrown
$this->logger->warning('[' . $this->getDisplayName() . '] Batch contact fetch failed', [
'chunk_size' => \count($chunk),
'error' => $e->getMessage(),
]);
throw $e;
}
}
return $allContacts;
}
private function prepareAccountMappingsForContacts(array $contacts): array
{
$companyIds = [];
foreach ($contacts as $contact) {
$companyId = $contact['properties']['associatedcompanyid'] ?? null;
if ($companyId !== null && $companyId !== '') {
$companyIds[] = (string) $companyId;
}
}
$companyIds = array_unique($companyIds);
if (empty($companyIds)) {
return [];
}
$mappings = $this->crmEntityRepository
->getExistingAccountIdsMap($this->config, $companyIds);
$missingCompanyIds = array_diff($companyIds, array_keys($mappings));
if (empty($missingCompanyIds)) {
return $mappings;
}
$this->logger->info('[' . $this->getDisplayName() . '] Batch syncing missing accounts for contacts', [
'teamId' => $this->team->getId(),
'total_companies' => \count($companyIds),
'existing_companies' => \count($mappings),
'missing_companies' => \count($missingCompanyIds),
]);
try {
$syncedAccounts = $this->batchSyncAccountsForContacts($missingCompanyIds);
$mappings = array_merge($mappings, $syncedAccounts);
} catch (\Throwable $e) {
$this->logger->error('[' . $this->getDisplayName() . '] Failed to batch sync missing accounts', [
'teamId' => $this->team->getId(),
'missingCompanyIds' => $missingCompanyIds,
'missingCount' => count($missingCompanyIds),
'error' => $e->getMessage(),
]);
}
return $mappings;
}
private function batchSyncAccountsForContacts(array $companyIds): array
{
$syncedAccounts = [];
$fields = $this->getCompanyFields();
foreach (array_chunk($companyIds, self::BATCH_SIZE) as $chunk) {
try {
$companies = $this->client->getCompaniesByIds($chunk, $fields);
foreach ($companies as $companyData) {
try {
$account = $this->importAccount($companyData);
if ($account) {
$syncedAccounts[$account->getCrmProviderId()] = $account->getId();
}
} catch (\Throwable $e) {
$this->logger->warning('[' . $this->getDisplayName() . '] Failed to import account in batch', [
'teamId' => $this->team->getId(),
'companyId' => $companyData['id'] ?? 'unknown',
'error' => $e->getMessage(),
]);
}
}
} catch (\Throwable $e) {
$this->logger->warning('[' . $this->getDisplayName() . '] Batch company fetch failed', [
'teamId' => $this->team->getId(),
'chunk_size' => \count($chunk),
'error' => $e->getMessage(),
]);
}
}
return $syncedAccounts;
}
/**
* Process webhook-collected company batches.
*
* Drains Redis sets containing company CRM IDs collected from webhook events
* and dispatches ImportAccountBatch jobs for batch processing.
*
* @return int Number of company IDs dispatched to jobs
*/
public function batchSyncCompanies(): int
{
$configId = $this->team->getCrmConfiguration()->getId();
return $this->batchProcessor->processBatchesForObjectType(
WebhookSyncBatchProcessor::OBJECT_TYPE_COMPANY,
$configId
);
}
public function importAccountBatchByIds(array $crmIds): array
{
$result = [
'success_count' => 0,
'failed_ids' => [],
'errors' => [],
];
if (! $this->client instanceof HubspotClientInterface) {
throw new \InvalidArgumentException('Client must implement HubspotClientInterface');
}
$batchStart = microtime(true);
$slowAccounts = [];
$fields = $this->getCompanyFields();
$allCompanies = [];
$fetchStart = microtime(true);
foreach (array_chunk($crmIds, self::BATCH_SIZE) as $chunk) {
try {
$companies = $this->client->getCompaniesByIds($chunk, $fields);
foreach ($companies as $companyData) {
$allCompanies[] = $companyData;
}
} catch (\Throwable $e) {
$this->logger->warning('[' . $this->getDisplayName() . '] Batch company fetch failed', [
'chunk_size' => \count($chunk),
'error' => $e->getMessage(),
]);
throw $e;
}
}
$fetchMs = (int) round((microtime(true) - $fetchStart) * 1000);
$fetchedIds = array_map('strval', array_column($allCompanies, 'id'));
$notFoundIds = array_values(array_diff(array_map('strval', $crmIds), $fetchedIds));
if (! empty($notFoundIds)) {
$this->logger->info('[' . $this->getDisplayName() . '] Company CRM IDs not found in HubSpot', [
'teamId' => $this->team->getId(),
'notFoundCount' => \count($notFoundIds),
'notFoundIds' => $notFoundIds,
'requestedCount' => \count($crmIds),
'fetchedCount' => \count($allCompanies),
]);
}
$loopStart = microtime(true);
foreach ($allCompanies as $companyData) {
$accountStart = microtime(true);
try {
$account = $this->importAccount($companyData);
if ($account !== null) {
$result['success_count']++;
}
} catch (\Throwable $e) {
$crmId = $companyData['id'] ?? $companyData['properties']['hs_object_id'] ?? 'unknown';
$result['failed_ids'][] = $crmId;
$result['errors'][$crmId] = $e->getMessage();
$this->logger->warning('[' . $this->getDisplayName() . '] Failed to import account', [
'crmId' => $crmId,
'error' => $e->getMessage(),
]);
}
$accountMs = (int) round((microtime(true) - $accountStart) * 1000);
if ($accountMs > 1000) {
$crmId = $companyData['id'] ?? $companyData['properties']['hs_object_id'] ?? 'unknown';
$slowAccounts[] = ['crmId' => $crmId, 'ms' => $accountMs];
}
}
$loopMs = (int) round((microtime(true) - $loopStart) * 1000);
$totalMs = (int) round((microtime(true) - $batchStart) * 1000);
$this->logger->info('[' . $this->getDisplayName() . '] importAccountBatch timing', [
'teamId' => $this->team->getId(),
'account_count' => \count($allCompanies),
'requested_count' => \count($crmIds),
'not_found_count' => \count($notFoundIds),
'total_ms' => $totalMs,
'fetch_api_ms' => $fetchMs,
'accounts_loop_ms' => $loopMs,
'avg_account_ms' => ! empty($allCompanies) ? (int) round($loopMs / \count($allCompanies)) : 0,
'slow_accounts_count' => \count($slowAccounts),
'slow_accounts' => array_slice($slowAccounts, 0, 10),
]);
return $result;
}
private function getCompanyFields(): array
{
return [
'country',
'name',
'phone',
'domain',
'hs_avatar_filemanager_key',
'industry',
'hubspot_owner_id',
'hs_object_id',
'createdate',
'hs_lastmodifieddate',
];
}
private function importAccount($crmData): ?Account
{
$crmProviderId = $crmData['id'] ?? $crmData['properties']['hs_object_id'] ?? null;
$this->logger->info('[HubSpot] importAccount', [
'crm_provider_id' => $crmProviderId,
'config_id' => $this->config->getId(),
]);
if (empty($crmData['properties'])) {
$this->logger->info('[HubSpot] importAccount failed: empty properties', [
'crm_provider_id' => $crmProviderId,
'config_id' => $this->config->getId(),
]);
return null;
}
$properties = $crmData['properties'];
$crmId = (string) $properties['hs_object_id'];
$countryCode = isset($properties['country']) ? $this->convertCountryNameToCode($properties['country']) : null;
if (isset($properties['phone'])) {
// Trim to our width and attempt to parse it.
$number = mb_strimwidth($properties['phone'], 0, 25);
$parsedNumber = parsePhoneNumber($countryCode, $number);
} else {
$parsedNumber = [];
}
$name = '[unknown]';
if (isset($properties['name'])) {
$name = $properties['name'];
}
$photoPath = $this->prospectPhotoPathService->getOrGeneratePhotoPath(
$this->config,
$crmId,
Account::class,
$crmId,
$name
);
$industry = null;
if (isset($properties['industry'])) {
$industry = mb_strimwidth($properties['industry'], 0, 40);
}
$ownerId = $profile = null;
if (isset($properties['hubspot_owner_id'])) {
$ownerId = $properties['hubspot_owner_id'];
$profile = $this->crmEntityRepository->findProfileByExternalId($this->config, (string) $ownerId);
}
$domain = null;
if (isset($properties['domain'])) {
$domain = StringUtil::resolveDomain($properties['domain']);
}
$remotelyCreatedAt = null;
if (isset($properties['createdate']) && ! empty($properties['createdate'])) {
$remotelyCreatedAt = Carbon::parse($properties['createdate']);
}
$data = [
'crm_provider_id' => $crmId,
'team_id' => $this->team->id,
'user_id' => $profile ? $profile->user_id : null,
'owner_id' => $ownerId,
'name' => mb_strimwidth($name, 0, 191),
'photo_path' => $photoPath,
'industry' => $industry,
'domain' => $domain !== null
? substr($domain, 0, 191)
: null,
'phone' => $parsedNumber['phone'] ?? null,
'ext' => $parsedNumber['ext'] ?? null,
'country_code' => $countryCode,
'remotely_created_at' => $remotelyCreatedAt,
];
return $this->crmEntityRepository->importAccount($this->config, $data);
}
public function deleteContact(string $crmProviderId): bool
{
try {
$contact = $this->crmEntityRepository->findContactByExternalId($this->config, $crmProviderId);
if (! $contact) {
$this->logger->info('[HubSpot] Contact not found for deletion', [
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
]);
// return success because we do not know which instance is the target
return true;
}
$id = $contact->getId();
$this->logger->info('[HubSpot] Deleting contact via webhook', [
'contact_id' => $id,
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
]);
$contact->delete();
DeleteContactJob::dispatch($id)->afterCommit();
return true;
} catch (Exception $e) {
$this->logger->error('[HubSpot] Failed to delete contact via webhook', [
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
'error' => $e->getMessage(),
]);
return false;
}
}
public function deleteAccount(string $crmProviderId): bool
{
try {
$account = $this->crmEntityRepository->findAccountByExternalId($this->config, $crmProviderId);
if (! $account) {
$this->logger->info('[HubSpot] Account not found for deletion', [
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
]);
// return success because we do not know which instance is the target
return true;
}
$id = $account->getId();
$this->logger->info('[HubSpot] Deleting account via webhook', [
'account_id' => $id,
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
]);
$account->delete();
DeleteAccountJob::dispatch($id)->afterCommit();
return true;
} catch (Exception $e) {
$this->logger->error('[HubSpot] Failed to delete account via webhook', [
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
'error' => $e->getMessage(),
]);
return false;
}
}
public function deleteOpportunity(string $crmProviderId): bool
{
try {
$opportunity = $this->crmEntityRepository->findOpportunityByExternalId($this->config, $crmProviderId);
if (! $opportunity) {
$this->logger->info('[HubSpot] Opportunity not found for deletion', [
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
]);
// return success because we do not know which instance is the target
return true;
}
$id = $opportunity->getId();
$this->logger->info('[HubSpot] Deleting opportunity via webhook', [
'opportunity_id' => $id,
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
]);
$opportunity->delete();
DeleteOpportunityJob::dispatch($id)->afterCommit();
return true;
} catch (Exception $e) {
$this->logger->error('[HubSpot] Failed to delete opportunity via webhook', [
'crm_provider_id' => $crmProviderId,
'team_id' => $this->team->getId(),
'error' => $e->getMessage(),
]);
return false;
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
2837
|
NULL
|
NULL
|
NULL
|
|
25962
|
1082
|
17
|
2026-05-12T11:57:08.055336+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-12/1778 /Users/lukas/.screenpipe/data/data/2026-05-12/1778587028055_m1.jpg...
|
PhpStorm
|
faVsco.js – RetentionRepositoryHandlerTest.php
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
19
14
17...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HandleHubspotRateLimitTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'HandleHubspotRateLimitTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'HandleHubspotRateLimitTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"19","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"17","depth":4,"role_description":"text"}]...
|
-8045970659750539387
|
-8708731274041119934
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
19
14
17
SlackFileEditViewGoHistoryWindowHelpDOCKERO ₴1DEV (-zsh)O $2APP (-zsh)883ec2-user@ip-10--rw-r--r--1 lukasstaff462011May09:29soundcore AeroClip(input)_2026-05-11_$lukasstaff881711May09:29-rw-r--r---rw-r--r---rw-r--r---rw-r--r---rw-r--r---rw-r--r---W-r=-r---rw-r--r---rw-r--r--lukasstaff581211soundcore AeroClip(input)_2026-05-11_0Маy09:30soundcore AeroClip (input)_2026-05-11_0111lukasstaff567111May09:30soundcore AeroClip (input)_2026-05-11_0lukasstaff796311May09:31soundcore AeroCliplukasstaff661411May09:32(input)_2026-05-11_soundcore AeroClip(input)_2026-05-11_9lukasstaff560611May09:32soundcore AeroClip(input)_2026-05-11_/lukasstaff639011May09:33soundcore AeroClip(input)_2026-05-11_/lukasstaff6031311Мaylukasstaff09:33soundcore AeroClip (input)_2026-05-11_08843311May09:34soundcore AeroClip (input)_2026-05-11_01lukasstaff12524911May09:34soundcore AeroClip(input)_2026-05-11_lukasstaff10297511May09:35soundcore AeroClip-rw-r--r---rw-r--r---rw-r--r---rw-r--r---rw-r--r---rw-r--r---rw-r--r---rw-r--r---rw-r--r--lukasstaff2139911(input)_2026-05-11_May09:35soundcore AeroClip(input)_2026-05-11_lukasstaff3937911May09:36soundcore AeroClip(input)_2026-05-11_0lukasstaff995711May09:37soundcore AeroClip1lukasstaff8814811May09:37(input)_2026-05-11_soundcore AeroClip(input)_2026-05-11_0lukasstaff13584011May09:38soundcore AeroClip (input)_2026-05-11_lukasstaff3477011May09:38soundcore AeroClip(input)_2026-05-11_1lukasstafflukasstaff5273711 May09:39soundcore AeroClip (input)_2026-05-11_(7007011May09:39soundcore AeroClip (input)_2026-05-11_01lukasstaff5062811May09:40soundcore AeroClip(input)_2026-05-11_lukasstaff7683811May09:40soundcore AeroClip(input)_2026-05-11_0-rw-r--r---W-r--T---rw-r--r---rw-r--r---rw-r--r---rw-r--r---W-r--r---rw-r--r---rw-r--r--lukasstaff6673311May09:41-soundcore AeroClip (input)_2026-05-11_(1lukasstaff77887 11 May09:41soundcore AeroClip (input)_2026-05-11_1lukasstaff6392211May09:42soundcore AeroClip1lukasstaff1888411May09:42(input)_2026-05-11_soundcore AeroClip(input)_2026-05-11_0lukasstaff1394211May09:43soundcore AeroClip(input)_2026-05-11_(lukasstaff565011May09:44soundcore AeroClip(input)_2026-05-11_/lukasstaff462011May09:45soundcore AeroCliplukasstaff(input)_2026-05-11_685111May09:45soundcore AeroClip (input)_2026-05-11_1lukasstaff110711May09:45soundcore AeroClip(input)_2026-05-11_lukasstaff1780011May19:18soundcore AeroClip-rw-r--r---V=---e-rw-r--r---rw-r--r---rw-r--r---rw-r--r---V=--es-rw-r--r---Ver-=--lukasstaff1273211May19:19(input)_2026-05-11.soundcore AeroClip(input)_2026-05-11.lukasstaff736111May19:19soundcore AeroClip(input)_2026-05-11lukasstaff1662211May19:20soundcore AeroClip1lukasstaff15093611May19:21(input)_2026-05-11soundcore AeroClip (input)_2026-05-11lukasstaff13473211May19:21soundcore AeroClip (input)_2026-05-111lukasstaff2369011May19:22soundcore AeroClip(input)_2026-05-11lukasstaff1665111May19:22soundcore AeroClip1lukasstaff(input)_2026-05-11_6922111 lukasstaffMay19:23soundcore AeroClip (input)_2026-05-11.560311 May19:23soundcore AeroClip(input)_2026-05-11.1lukasstaff4950911May19:24soundcore AeroClip-rw-r--r--1lukasstaff3446211(input)_2026-05-11_May19:24soundcore AeroClip (input)_2026-05-11.lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny~/.screenpipe/data $ cd ..lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny~/.screenpipe $ UHomeDMsActivityFilesLaterMore> 0(allSupport Daily • in 3 m100% C3• Tue 12 May 14:57:07→Describe what you are looking forJiminny ...CHSIICCTIS# general# jiminny-bg#platform-tickets# product_launches# random# releases# sofia-office# support# thank-yous# the_people_of_jimi...0 Direct messages®. Galya DimitrovaR. Steliyan GeorgievPetko Kashinski®. Aneliya Angelova&. Stefka StoyanovaVasil VasilevNikolay IvanovAneliya Angelova, .... Stoyan TanevLukas Kovalik y…..AppsJira CloudToastGoogle Cale…..# releases8 226 0• MessagesC FilesBookmarks+trackinga8b76812 - Mt.Today ~-quest #12024 fromjiminny/JY-20773-fix-automated-reports-user-pilot-trackingjiminny/app| Added by GitHubCircleCI APP 2:41 PMDeployment Successful!Project: appWhen:05/12/202611:41:02Tag:View JobNewGitHub APP 2:50 PM5 new commits pushed tomaster byilian-jiminny1162b043 - fix(security): bump dependencies(alerts #477)2f0ca3a0 - Merge branch 'master' intosecfix/composer-20260507f861c9e7 - Merge branch 'master' intosecfix/composer-202605079b89679e - Merge branch 'master' intosecfix/composer-202605074cb55bd1 - Merge pull request #12049 fromjiminny/secfix/composer-20260507jiminny/app| Added by GitHubMessage #releases+......
|
NULL
|
NULL
|
NULL
|
NULL
|
|
15704
|
696
|
6
|
2026-05-11T07:09:10.422608+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778483350422_m1.jpg...
|
PhpStorm
|
faVsco.js – Client.php
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Firefox FileEditViewHistoryBookmarksProfilesToolsW Firefox FileEditViewHistoryBookmarksProfilesToolsWindowHelp# Support Daily - in 4h 51 mDEV (docker)• жзDOCKERO 81DEV (docker)882APP (-zsh)masterJY-20818-move-AJ-reports-to-separated-datadog-metricJY-20773-fix-automated-reports-user-pilot-trackingJY-20157-AJ-report-not-send-notificationJY-20508-notify-before-AJ-report-expirationJY-20372-ai-reports-promotion-pagesJY-20352-sync-opportunities-without-a-local-owner-user-id-is-nullJY-20738-debug-AJ-tracking-UPJY-18909-automated-reports-ask-jiminnyJY-20692-fix-integration-app-[API_KEY] laysJY-20698-fix-SF-activity-types-on-new-playbookJY-20543-AJ-report-trackingJY-20384-handle-auto-sync-with-no-access-to-event-typeJY-20458-ask-Jiminny-user-definitionsJY-19666-fix-import-contacts-account-associationJY-19666-HS-import-contacts-and-accounts-batch-jobJY-20458-Ask-Jiminny-ReportsJY-20200-batch-update-CRM-objects-SalesforceJY-19666-HS-webhooks-add-contact-and-companyJY-20348-trigger-setup-DI-layout-on-team-creationJY-20326-refactor-info-message-in-commandJY-20317-fix-auto-log-delay-issue-on-all-channels-disabledJY-20312-remove-on-update-change-last-synced-at-crm-configurationsJY-20306-SF-skip-auto-sync-for-task-based-playbookJY-20192-remove-deleted-team-from-saved-search-filtersJY-20197-import-opportunity-batch-jobJY-20293-enable-status-field-for-pipedrive-dealsJY-20191-remove-commands-interactive-promptsJY-20118-change-default-sync-strategyJY-20183-add-cache-on-auto-log-delayJY-20197-add-import-opportunity-batch-job20118-hs-opportunity-make-webhook-strategy-defaultJY-20118-make-default-hs-opportunity-sync-strategy-webhook-basedJY-20196-handle-opportunity-without-noteJY-20118-improve-opportunity-importJY-20189-handle-activity-search-on-deleted-groupsJY-20160JY-20145-filter-out-converted-leads-when-matchingJY-20150-skip-push-summary-on-summary-ready-1f-autologJY-20132-fix-note-encodingJY-19792-clean-logslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20725-handle-HS-search-rate-limit) $ devroot@docker_lamp_1:/home/jiminny# ]-zsh84-zsh885100%8• Mon 11 May 10:09:10181screenpipe"0 ₴6DEV...
|
NULL
|
-8045061717036749887
|
NULL
|
click
|
ocr
|
NULL
|
Firefox FileEditViewHistoryBookmarksProfilesToolsW Firefox FileEditViewHistoryBookmarksProfilesToolsWindowHelp# Support Daily - in 4h 51 mDEV (docker)• жзDOCKERO 81DEV (docker)882APP (-zsh)masterJY-20818-move-AJ-reports-to-separated-datadog-metricJY-20773-fix-automated-reports-user-pilot-trackingJY-20157-AJ-report-not-send-notificationJY-20508-notify-before-AJ-report-expirationJY-20372-ai-reports-promotion-pagesJY-20352-sync-opportunities-without-a-local-owner-user-id-is-nullJY-20738-debug-AJ-tracking-UPJY-18909-automated-reports-ask-jiminnyJY-20692-fix-integration-app-[API_KEY] laysJY-20698-fix-SF-activity-types-on-new-playbookJY-20543-AJ-report-trackingJY-20384-handle-auto-sync-with-no-access-to-event-typeJY-20458-ask-Jiminny-user-definitionsJY-19666-fix-import-contacts-account-associationJY-19666-HS-import-contacts-and-accounts-batch-jobJY-20458-Ask-Jiminny-ReportsJY-20200-batch-update-CRM-objects-SalesforceJY-19666-HS-webhooks-add-contact-and-companyJY-20348-trigger-setup-DI-layout-on-team-creationJY-20326-refactor-info-message-in-commandJY-20317-fix-auto-log-delay-issue-on-all-channels-disabledJY-20312-remove-on-update-change-last-synced-at-crm-configurationsJY-20306-SF-skip-auto-sync-for-task-based-playbookJY-20192-remove-deleted-team-from-saved-search-filtersJY-20197-import-opportunity-batch-jobJY-20293-enable-status-field-for-pipedrive-dealsJY-20191-remove-commands-interactive-promptsJY-20118-change-default-sync-strategyJY-20183-add-cache-on-auto-log-delayJY-20197-add-import-opportunity-batch-job20118-hs-opportunity-make-webhook-strategy-defaultJY-20118-make-default-hs-opportunity-sync-strategy-webhook-basedJY-20196-handle-opportunity-without-noteJY-20118-improve-opportunity-importJY-20189-handle-activity-search-on-deleted-groupsJY-20160JY-20145-filter-out-converted-leads-when-matchingJY-20150-skip-push-summary-on-summary-ready-1f-autologJY-20132-fix-note-encodingJY-19792-clean-logslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20725-handle-HS-search-rate-limit) $ devroot@docker_lamp_1:/home/jiminny# ]-zsh84-zsh885100%8• Mon 11 May 10:09:10181screenpipe"0 ₴6DEV...
|
15702
|
NULL
|
NULL
|
NULL
|
|
4352
|
156
|
13
|
2026-05-07T13:28:53.025002+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778160533025_m2.jpg...
|
Claude
|
Claude
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Skip to content
Skip to content
Click to collapse
Skip to content
Skip to content
Click to collapse
⌘B
Drag to resize
Open sidebar
Chat
Cowork
Code
New chat ⌘N
New chat
⌘N
Projects
Artifacts
Customize
Pinned
Bulgarian citizenship application process for EU residents
More options for Bulgarian citizenship application process for EU residents
Dawarich location tracking project
More options for Dawarich location tracking project
Recents
View all
HubSpot rate limit implementation strategy
More options for HubSpot rate limit implementation strategy
Screenpipe retention policy code location
More options for Screenpipe retention policy code location
Viewing retention policy in screenpipe
More options for Viewing retention policy in screenpipe
Clean shot x video recording termination issue
More options for Clean shot x video recording termination issue
HubSpot rate limit handling with executeRequest
More options for HubSpot rate limit handling with executeRequest
Untitled
More options
💬 Screen pipe. Is there ability…
More options for 💬 Screen pipe. Is there ability…
SMB mount access inconsistency between Finder and iTerm
More options for SMB mount access inconsistency between Finder and iTerm
💬 What is the best switch I can…
More options for 💬 What is the best switch I can…
Permission denied on screenpipe volume
More options for Permission denied on screenpipe volume
Screenpipe sync database attachment error
More options for Screenpipe sync database attachment error
Last swimming outing with Dani
More options for Last swimming outing with Dani
Definition of incarcerated
More options for Definition of incarcerated
Chromecast remote volume buttons not working
More options for Chromecast remote volume buttons not working
Salesforce API errors with Organization and FieldDefinition queries
More options for Salesforce API errors with Organization and FieldDefinition queries
Daily activity summary from screenpipe data
More options for Daily activity summary from screenpipe data
MacBook unexpected restarts and kanji screen
More options for MacBook unexpected restarts and kanji screen
Security patch review and testing guidance
More options for Security patch review and testing guidance
Food calorie values reference
More options for Food calorie values reference
Tracking location history from last week
More options for Tracking location history from last week
Lukas Pro
Get apps and extensions
HubSpot rate limit implementation strategy, rename chat
HubSpot rate limit implementation strategy
More options for HubSpot rate limit implementation strategy
Close
Share chat
Claude finished the response
You said: So just a solution for rate limit implementation.
You said: So just a solution for rate limit implementation.
So just a solution for rate limit implementation. The situation currently is that there are some daily and secondary limits for HubSpot. I would like to make sure I never reach a 429 error rate limit. The requests can come from any flow. It can be:
updating activity (engagement, meeting, call, note)
searching for a company or contact
updating deal
patching IDs
Review what the limit is at the moment in the HubSpot documentation and then think of the solution:
where to store it
how to read it
how to work with multiple jobs
how to work with paginated requests Let's consider a situation when there are 600 opportunities to sync. What would be the flow? How would the rate limit be recognized? How would it be handled? What are the potential issues? [API usage guidelines and limits - HubSpot docs](
https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines
https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines
). Example of such a error Client error:
POST https://api.hubapi.com/crm/v3/objects/contact/search
resulted in a
429 Too Many Requests
response: {"status":"error","message":"You have reached your secondly limit.","errorType":"RATE_LIMIT","correlationId":"019dffc4-4 (truncated...). Think carefully about the implementation and potential issue and bottlenecks.
Show more
10:42
Retry
Edit
Copy
Claude responded: Current HubSpot limits (Apr 2026)
Claude responded: Current HubSpot limits (Apr 2026)
Synthesized HubSpot rate limit architecture with Redis storage and sliding window algorithms
Synthesized HubSpot rate limit architecture with Redis storage and sliding window algorithms
Current HubSpot limits (Apr 2026)
Current HubSpot limits (Apr 2026)
For privately distributed apps (which is what Jiminny presumably uses with HubSpot), the limits are layered: a per-app burst window of 100/10s on Free/Starter, 190/10s on Pro/Enterprise, or 250/10s with the API Limit Increase add-on
, plus a per-account daily cap of 250k / 625k / 1M depending on tier — shared across all private apps in the account
. The burst window is per app; the daily quota is per portal.
hubspot
hubspot
hubspot
hubspot
The Search API is special: five requests per second per account, capped at 200 records per page, with a hard 10,000-result ceiling per query
. That's the limit the 429 in your example is hitting (
secondly limit
on
/crm/v3/objects/contact/search
). It's a separate bucket from the 190/10s, and critically, search responses do not include the
X-HubSpot-RateLimit-*
headers
— you can't read remaining capacity off the response, you have to track it yourself.
hubspot
hubspot
hubspot
hubspot
Non-search endpoints return
X-HubSpot-RateLimit-Remaining
,
-Max
, and
-Interval-Milliseconds
. The daily headers are not returned for OAuth-authenticated calls
, so for those you check the account-info endpoint or maintain your own counter. There's also a soft rule: errors should stay under 5% of total daily requests
— that's enforced for marketplace listing, but it's also a sane operational target.
hubspot
hubspot
hubspot
hubspot
So you have
four buckets
to track at minimum: app-burst (10s sliding), search-secondly (1s sliding), account-daily (24h fixed, midnight in HubSpot's TZ), and per-app daily share (your own budgeting on top of the account cap).
Where to store it
Where to store it
Redis. It's the only realistic option once you have multiple queue workers — DB-backed counters serialize too much, and in-process state can't coordinate across workers. Laravel already speaks Redis natively, and you get atomic
INCR
/
EXPIRE
plus Lua scripting for true CAS semantics.
Key layout I'd use:
Copy to clipboard
hubspot:rl:burst:{portalId}:{appId} ZSET (sliding 10s)
hubspot:rl:search:{portalId} ZSET (sliding 1s)
hubspot:rl:daily:{portalId} STRING + TTL to midnight TZ
hubspot:rl:meta:{portalId} HASH (last seen headers)
The two short-window buckets are sliding-window-log (Redis ZSET, score =
microtime
, member = unique request id). Lua script removes entries older than the window, counts remaining slots, and only adds the new one if there's room — all atomic. Fixed windows are simpler but allow 2× the limit at the boundary, which on a 5/s window is brutal.
The daily bucket is a plain
INCR
with TTL set to seconds-until-midnight in
HubSpot's account timezone
, not yours — Sofia is UTC+2/+3 but your portal might be set to US Eastern. Get this once and cache it.
How to read it
How to read it
Two-phase: optimistic pre-check, authoritative post-update.
Before a call, run the Lua acquire script. If it returns "denied," sleep until a slot frees up (the script can return ms-until-next-slot) or push the job back to the queue with a delay. Don't busy-loop.
After the call, parse
X-HubSpot-RateLimit-Remaining
/
-Max
/
-Interval-Milliseconds
and store them in
hubspot:rl:meta:{portalId}
. This is your reality check — if your local counter says 50 remaining but HubSpot's header says 5, you trust HubSpot and clamp your counter. This handles clock drift, missed accounting (e.g., crashed worker that took a token but never made the request), and other apps in the same account consuming the daily budget invisibly.
For search specifically, since headers don't come back, the local counter
is
the source of truth — meaning if you ever crash mid-flight, you've under-counted. Always release tokens on connection-level failure but
not
on 429 (you really did make that request).
How to work with multiple jobs
How to work with multiple jobs
The queue layer needs to enforce concurrency separately from the rate limiter. Both work together:
Concurrency cap
via
Queue::throttle()
or a Redis semaphore — limits how many sync workers run in parallel against HubSpot. Without this, you can have 50 workers all blocked waiting for tokens, which is wasteful and creates retry storms.
Per-tenant fairness
— if you sync many Jiminny customers into different HubSpot portals, each portal has its own bucket but you still want one slow portal not to starve others. Either separate queues per portal or a fair-share scheduler.
Priority lanes
— webhook-driven updates (user-visible latency) should outrank background batch syncs. Two queues:
hubspot-priority
and
hubspot-bulk
, with priority workers taking 70% of the burst budget and bulk taking 30% (enforce via separate sub-buckets if you really want hard separation, otherwise just pull from priority first).
Backoff on 429
— respect the
Retry-After
header. If absent, exponential with jitter (e.g.,
min(2^attempt * 250ms, 30s) ± 20%
). The jitter is non-negotiable; without it, simultaneous 429s retry in lockstep and you get thundering-herd 429s on retry.
How to work with paginated requests
How to work with paginated requests
The trap is treating "fetch all" as one logical operation. Each page is its own API call and competes for tokens with everything else.
Two practical rules:
Don't hold the worker idle while paginating.
If page N takes 500ms and page N+1 needs to wait 800ms for a token, you've burned 800ms of worker time doing nothing. Instead, fetch page N, dispatch the
processing
of page N as a separate job, and queue a "fetch page N+1" job with a delay equal to the wait time. Each page becomes its own atomic unit.
Always batch where HubSpot offers it.
POST /crm/v3/objects/{type}/batch/{read|update|create}
accepts up to 100 IDs per call. For your "patching IDs" flow this is the difference between 600 calls and 6.
Walkthrough: 600 opportunities
Walkthrough: 600 opportunities
Naive flow (one PATCH per deal): 600 calls. At 190/10s that's ~32s of API time, well under daily. You'd hit burst easily without throttling. Plus likely 1-3 search calls upfront and N association calls.
Sane flow:
Identify deltas
— if you can avoid Search at all, do. Use
lastmodifieddate
filter on a single search if you must, paginate at limit=200. For 600 deals that's 3 search calls @ 5/s = ~600ms naturally throttled.
Batch read
current state —
POST /crm/v3/objects/deals/batch/read
with 100 IDs per call → 6 calls. Burst weight 6.
Compute diff
in your code (no API).
Batch update
—
POST /crm/v3/objects/deals/batch/update
with 100 per call → 6 calls.
Associations
—
POST /crm/v4/associations/{from}/{to}/batch/create
if needed → another few batch calls.
Total: ~15-20 API calls for 600 deals. Burst budget consumed: 20/190 over ~5s. Daily impact: trivial.
Recognition: pre-check denies if
<weight>
slots aren't free; on 429 the response surfaces
policyName
(DAILY/SECONDLY) — log it, push the job back with
Retry-After
delay, increment a metric so you can alarm on sustained 429 rate.
Pitfalls & bottlenecks worth pre-empting
Pitfalls & bottlenecks worth pre-empting
Daily quota is shared across the whole portal
, including any n8n flows, other private apps, marketing automation calling APIs, etc. Budget for ~70-80% of the documented limit, not 100%. Add an internal per-app daily cap so a runaway sync can't starve other apps.
Search is uniquely fragile
: separate 5/s bucket, no headers to read, 10k-result cap per query. If you ever hit 10k+ deals matching a filter, partition by
hs_object_id
ranges or by
lastmodifieddate
windows.
Retry storms after HubSpot incidents
— always jitter, always cap total retries (e.g., 5 attempts, then dead-letter).
Webhook → sync → webhook loops
— when your update fires a HubSpot webhook that triggers another sync. Tag your own writes (e.g., a custom property
jy_last_sync_id
) and ignore webhooks where it just changed.
Token refresh
— OAuth refresh itself counts against burst. Cache the access token in Redis with TTL =
expires_in - 60s
, single-flight the refresh (only one worker refreshes; others wait on a lock).
Search latency for fresh writes
— newly created/updated objects don't appear in search instantly. Don't write-then-search; use returned IDs directly.
Clock skew
— Redis is authoritative. Don't use
time()
from each worker for window scoring; use
redis.call('TIME')
inside the Lua script.
Dead workers with held tokens
— sliding-window-log handles this naturally because tokens expire by score; token-bucket implementations need explicit release-on-crash logic.
The 5% error rule
counts every 429 toward your error budget, even successfully retried ones. If your pre-check is working well, 429s should be near zero — if they're not, your pre-check is wrong, not just slow.
Phantom contention with Laravel
RateLimited
middleware
: it's per-job-class by default, not per-portal. If your
SyncDealJob
and
UpdateActivityJob
are different classes both calling HubSpot, they don't share a Laravel-level limiter — you need a single
HubspotRateLimiter
service that everything routes through.
If you want, I can sketch the Lua script for the sliding-window acquire and the Laravel service wrapper around it.
Copy
Give positive feedback
Give negative feedback
Retry
You said: What will happen if there are two different types of rate limits?
You said: What will happen if there are two different types of rate limits?
What will happen if there are two different types of rate limits?
Search requests that have 5 requests per second
The other rate limit that has, let's say, 100 requests per 10 seconds How do these work together? Is there some conflict? Can I reach the limit with one request and block either as well, or are these separated? Can I still continue making search requests once I hit the normal requests limits?
13:40
Retry
Edit
Copy
Claude responded: They're independent buckets — with one shared bucket on top.
Claude responded: They're independent buckets — with one shared bucket on top.
Analyzed independent rate limit buckets and their practical interactions
Analyzed independent rate limit buckets and their practical interactions
They're independent buckets — with one shared bucket on top.
The three buckets and what each call hits
The three buckets and what each call hits
Copy to clipboard
┌──────────────────┐
Search request ──→ │ Search: 5/sec │ ──┐
└──────────────────┘ │
├──→ ┌─────────────────┐
┌──────────────────┐ │ │ Daily: 250k–1M │
Non-search call ──→ │ Burst: 190/10s │ ──┘ │ (per portal) │
└──────────────────┘ └─────────────────┘
A search call is only metered against the search bucket and the daily bucket. A non-search call (batch read/update, single PATCH, associations, etc.) is only metered against the burst bucket and the daily bucket. The two short-window buckets do not share counters.
What this means practically
What this means practically
Hitting search secondly limit (5/s):
Only further
/search
calls 429. Your batch reads, batch updates, single PATCHes, association calls — all keep working at full burst speed. This is actually useful: if your sync is bottlenecked on Search, you can pivot to using
lastmodifieddate
filters via batch endpoints, or use the IDs you already have to do batch reads, while Search cools off.
Hitting burst limit (190/10s):
Only non-search calls 429. You can still issue Search calls at 5/s. Useful for: continuing to identify deltas for queueing while in-flight updates drain, or refreshing a small set of records via Search even though your write pipeline is paused.
Hitting daily limit:
Everything stops. Search and non-search alike. Doesn't unblock until midnight in your portal's configured timezone — and remember this is shared across every private app in the portal, plus n8n flows, marketing tools, anything else hitting the API with that account.
So can one type of request block the other?
So can one type of request block the other?
Search → Burst:
No.
Saturating Search at 50 calls per 10s leaves your full 190/10s burst untouched.
Burst → Search:
No.
Saturating burst leaves Search's 5/s untouched.
Either → Daily:
Yes
, but only by contributing to the same daily counter. It's volume that kills you here, not the type.
In theory you can sustain ~50 search + ~190 other =
~240 calls per 10 seconds
indefinitely (until daily runs out), because the two buckets bill independently.
Implementation consequence
Implementation consequence
Your rate limiter needs to know which bucket a request hits before it acquires. Cleanest pattern:
Copy to clipboard
php
$limiter
->
acquire
(
'search'
,
$weight
=
1
)
;
// for search endpoints only
$limiter
->
acquire
(
'burst'
,
$weight
=
1
)
;
// for everything else
$limiter
->
acquire
(
'daily'
,
$weight
=
1
)
;
// every call, both kinds
In Redis: three separate keys, three separate Lua acquire scripts (or one script with a bucket parameter). A search call calls
acquire('search')
+...
|
[{"role":"AXLink","text":& [{"role":"AXLink","text":"Skip to content","depth":14,"bounds":{"left":0.029587766,"top":0.03830806,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Skip to content","depth":15,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Click to collapse","depth":16,"bounds":{"left":0.10239362,"top":0.06703911,"width":0.030585106,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.10239362,"top":0.06703911,"width":0.0029920214,"height":0.011971269}},{"char_start":1,"char_count":16,"bounds":{"left":0.10538564,"top":0.06703911,"width":0.027925532,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"⌘B","depth":16,"bounds":{"left":0.1349734,"top":0.06703911,"width":0.0063164895,"height":0.011971269},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Drag to resize","depth":16,"bounds":{"left":0.10239362,"top":0.079010375,"width":0.025930852,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.10239362,"top":0.079010375,"width":0.0029920214,"height":0.011971269}},{"char_start":1,"char_count":13,"bounds":{"left":0.10538564,"top":0.079010375,"width":0.022938829,"height":0.011971269}}],"role_description":"text"},{"role":"AXButton","text":"Open sidebar","depth":14,"bounds":{"left":0.029920213,"top":0.02793296,"width":0.00930851,"height":0.022346368},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Chat","depth":16,"bounds":{"left":0.004986702,"top":0.059856344,"width":0.025930852,"height":0.022346368},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cowork","depth":16,"bounds":{"left":0.03158245,"top":0.059856344,"width":0.03125,"height":0.022346368},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code","depth":16,"bounds":{"left":0.0631649,"top":0.059856344,"width":0.026928192,"height":0.022346368},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New chat ⌘N","depth":15,"bounds":{"left":0.0043218085,"top":0.08938547,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"New chat","depth":16,"bounds":{"left":0.014295213,"top":0.0933759,"width":0.018949468,"height":0.012769354},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.014295213,"top":0.0933759,"width":0.003656915,"height":0.013567438}},{"char_start":1,"char_count":7,"bounds":{"left":0.01761968,"top":0.0933759,"width":0.015957447,"height":0.013567438}}],"role_description":"text"},{"role":"AXStaticText","text":"⌘N","depth":17,"bounds":{"left":0.08178192,"top":0.0933759,"width":0.006981383,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Projects","depth":15,"bounds":{"left":0.0043218085,"top":0.110135674,"width":0.08643617,"height":0.019952115},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Artifacts","depth":15,"bounds":{"left":0.0043218085,"top":0.1300878,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Customize","depth":15,"bounds":{"left":0.0043218085,"top":0.15003991,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Pinned","depth":16,"bounds":{"left":0.0063164895,"top":0.18914606,"width":0.08377659,"height":0.013567438},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXButton","text":"Bulgarian citizenship application process for EU residents","depth":18,"bounds":{"left":0.0043218085,"top":0.20590582,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Bulgarian citizenship application process for EU residents","depth":19,"bounds":{"left":0.08344415,"top":0.20909816,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Dawarich location tracking project","depth":18,"bounds":{"left":0.0043218085,"top":0.22745411,"width":0.08643617,"height":0.019952115},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Dawarich location tracking project","depth":19,"bounds":{"left":0.08344415,"top":0.22984837,"width":0.005984043,"height":0.015163607},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Recents","depth":16,"bounds":{"left":0.0063164895,"top":0.25698325,"width":0.06349734,"height":0.012769354},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXButton","text":"View all","depth":16,"bounds":{"left":0.07114362,"top":0.25698325,"width":0.018949468,"height":0.012769354},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HubSpot rate limit implementation strategy","depth":18,"bounds":{"left":0.0043218085,"top":0.27294493,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for HubSpot rate limit implementation strategy","depth":19,"bounds":{"left":0.08344415,"top":0.27613726,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Screenpipe retention policy code location","depth":18,"bounds":{"left":0.0043218085,"top":0.29449323,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Screenpipe retention policy code location","depth":19,"bounds":{"left":0.08344415,"top":0.29768556,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Viewing retention policy in screenpipe","depth":18,"bounds":{"left":0.0043218085,"top":0.31524342,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Viewing retention policy in screenpipe","depth":19,"bounds":{"left":0.08344415,"top":0.31843576,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Clean shot x video recording termination issue","depth":18,"bounds":{"left":0.0043218085,"top":0.3367917,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Clean shot x video recording termination issue","depth":19,"bounds":{"left":0.08344415,"top":0.33998403,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HubSpot rate limit handling with executeRequest","depth":18,"bounds":{"left":0.0043218085,"top":0.3575419,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for HubSpot rate limit handling with executeRequest","depth":19,"bounds":{"left":0.08344415,"top":0.36073422,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Untitled","depth":18,"bounds":{"left":0.0043218085,"top":0.3790902,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options","depth":19,"bounds":{"left":0.08344415,"top":0.38228253,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"💬 Screen pipe. Is there ability…","depth":18,"bounds":{"left":0.0043218085,"top":0.39984038,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for 💬 Screen pipe. Is there ability…","depth":19,"bounds":{"left":0.08344415,"top":0.40303272,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"SMB mount access inconsistency between Finder and iTerm","depth":18,"bounds":{"left":0.0043218085,"top":0.42138866,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for SMB mount access inconsistency between Finder and iTerm","depth":19,"bounds":{"left":0.08344415,"top":0.4237829,"width":0.005984043,"height":0.015163607},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"💬 What is the best switch I can…","depth":18,"bounds":{"left":0.0043218085,"top":0.44213888,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for 💬 What is the best switch I can…","depth":19,"bounds":{"left":0.08344415,"top":0.44533122,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Permission denied on screenpipe volume","depth":18,"bounds":{"left":0.0043218085,"top":0.46288908,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Permission denied on screenpipe volume","depth":19,"bounds":{"left":0.08344415,"top":0.4660814,"width":0.005984043,"height":0.015163607},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Screenpipe sync database attachment error","depth":18,"bounds":{"left":0.0043218085,"top":0.48443735,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Screenpipe sync database attachment error","depth":19,"bounds":{"left":0.08344415,"top":0.48762968,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Last swimming outing with Dani","depth":18,"bounds":{"left":0.0043218085,"top":0.5051876,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Last swimming outing with Dani","depth":19,"bounds":{"left":0.08344415,"top":0.5083799,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Definition of incarcerated","depth":18,"bounds":{"left":0.0043218085,"top":0.52673584,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Definition of incarcerated","depth":19,"bounds":{"left":0.08344415,"top":0.52992815,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Chromecast remote volume buttons not working","depth":18,"bounds":{"left":0.0043218085,"top":0.547486,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Chromecast remote volume buttons not working","depth":19,"bounds":{"left":0.08344415,"top":0.5506784,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Salesforce API errors with Organization and FieldDefinition queries","depth":18,"bounds":{"left":0.0043218085,"top":0.56903434,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Salesforce API errors with Organization and FieldDefinition queries","depth":19,"bounds":{"left":0.08344415,"top":0.57222664,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Daily activity summary from screenpipe data","depth":18,"bounds":{"left":0.0043218085,"top":0.5897845,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Daily activity summary from screenpipe data","depth":19,"bounds":{"left":0.08344415,"top":0.59297687,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"MacBook unexpected restarts and kanji screen","depth":18,"bounds":{"left":0.0043218085,"top":0.6113328,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for MacBook unexpected restarts and kanji screen","depth":19,"bounds":{"left":0.08344415,"top":0.61452514,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Security patch review and testing guidance","depth":18,"bounds":{"left":0.0043218085,"top":0.632083,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Security patch review and testing guidance","depth":19,"bounds":{"left":0.08344415,"top":0.63527536,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Food calorie values reference","depth":18,"bounds":{"left":0.0043218085,"top":0.65363127,"width":0.08643617,"height":0.0207502},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Food calorie values reference","depth":19,"bounds":{"left":0.08344415,"top":0.65682364,"width":0.005984043,"height":0.014365523},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tracking location history from last week","depth":18,"bounds":{"left":0.0043218085,"top":0.6743815,"width":0.08643617,"height":0.011173184},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Tracking location history from last week","depth":19,"bounds":{"left":0.08344415,"top":0.6775738,"width":0.005984043,"height":0.007980846},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"Lukas Pro","depth":15,"bounds":{"left":0.0043218085,"top":0.6943336,"width":0.037898935,"height":0.01915403},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Get apps and extensions","depth":15,"bounds":{"left":0.08277926,"top":0.6943336,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HubSpot rate limit implementation strategy, rename chat","depth":20,"bounds":{"left":0.043218084,"top":0.02793296,"width":0.09773936,"height":0.022346368},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"HubSpot rate limit implementation strategy","depth":22,"bounds":{"left":0.04454787,"top":0.031923383,"width":0.09507979,"height":0.014365523},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.04454787,"top":0.031923383,"width":0.003656915,"height":0.014365523}},{"char_start":1,"char_count":41,"bounds":{"left":0.048204787,"top":0.031923383,"width":0.09142287,"height":0.014365523}}],"role_description":"text"},{"role":"AXPopUpButton","text":"More options for HubSpot rate limit implementation strategy","depth":20,"bounds":{"left":0.14128989,"top":0.02793296,"width":0.0066489363,"height":0.022346368},"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":22,"bounds":{"left":0.22240691,"top":0.026336791,"width":0.010638298,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Share chat","depth":22,"bounds":{"left":0.234375,"top":0.026336791,"width":0.010638298,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Claude finished the response","depth":22,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"You said: So just a solution for rate limit implementation.","depth":21,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"You said: So just a solution for rate limit implementation.","depth":22,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"So just a solution for rate limit implementation. The situation currently is that there are some daily and secondary limits for HubSpot. I would like to make sure I never reach a 429 error rate limit. The requests can come from any flow. It can be:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"updating activity (engagement, meeting, call, note)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"searching for a company or contact","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"updating deal","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"patching IDs\nReview what the limit is at the moment in the HubSpot documentation and then think of the solution:","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"where to store it","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"how to read it","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"how to work with multiple jobs","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"how to work with paginated requests Let's consider a situation when there are 600 opportunities to sync. What would be the flow? How would the rate limit be recognized? How would it be handled? What are the potential issues? [API usage guidelines and limits - HubSpot docs](","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines","depth":26,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"). Example of such a error Client error:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"POST https://api.hubapi.com/crm/v3/objects/contact/search","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"resulted in a","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"429 Too Many Requests","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT\",\"correlationId\":\"019dffc4-4 (truncated...). Think carefully about the implementation and potential issue and bottlenecks.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Show more","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"10:42","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Retry","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Edit","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Copy","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"Claude responded: Current HubSpot limits (Apr 2026)","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Claude responded: Current HubSpot limits (Apr 2026)","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Synthesized HubSpot rate limit architecture with Redis storage and sliding window algorithms","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Synthesized HubSpot rate limit architecture with Redis storage and sliding window algorithms","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Current HubSpot limits (Apr 2026)","depth":25,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Current HubSpot limits (Apr 2026)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"For privately distributed apps (which is what Jiminny presumably uses with HubSpot), the limits are layered: a per-app burst window of 100/10s on Free/Starter, 190/10s on Pro/Enterprise, or 250/10s with the API Limit Increase add-on","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", plus a per-account daily cap of 250k / 625k / 1M depending on tier — shared across all private apps in the account","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":". The burst window is per app; the daily quota is per portal.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"hubspot","depth":27,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"hubspot","depth":27,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The Search API is special: five requests per second per account, capped at 200 records per page, with a hard 10,000-result ceiling per query","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":". That's the limit the 429 in your example is hitting (","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"secondly limit","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"on","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/crm/v3/objects/contact/search","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"). It's a separate bucket from the 190/10s, and critically, search responses do not include the","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"X-HubSpot-RateLimit-*","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"headers","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— you can't read remaining capacity off the response, you have to track it yourself.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"hubspot","depth":27,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"hubspot","depth":27,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Non-search endpoints return","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"X-HubSpot-RateLimit-Remaining","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"-Max","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", and","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"-Interval-Milliseconds","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":". The daily headers are not returned for OAuth-authenticated calls","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", so for those you check the account-info endpoint or maintain your own counter. There's also a soft rule: errors should stay under 5% of total daily requests","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— that's enforced for marketplace listing, but it's also a sane operational target.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"hubspot","depth":27,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"hubspot","depth":27,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"So you have","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"four buckets","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"to track at minimum: app-burst (10s sliding), search-secondly (1s sliding), account-daily (24h fixed, midnight in HubSpot's TZ), and per-app daily share (your own budgeting on top of the account cap).","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Where to store it","depth":25,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Where to store it","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Redis. It's the only realistic option once you have multiple queue workers — DB-backed counters serialize too much, and in-process state can't coordinate across workers. Laravel already speaks Redis natively, and you get atomic","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"INCR","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"EXPIRE","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"plus Lua scripting for true CAS semantics.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Key layout I'd use:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy to clipboard","depth":28,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"hubspot:rl:burst:{portalId}:{appId} ZSET (sliding 10s)","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hubspot:rl:search:{portalId} ZSET (sliding 1s)","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hubspot:rl:daily:{portalId} STRING + TTL to midnight TZ","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hubspot:rl:meta:{portalId} HASH (last seen headers)","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The two short-window buckets are sliding-window-log (Redis ZSET, score =","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"microtime","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", member = unique request id). Lua script removes entries older than the window, counts remaining slots, and only adds the new one if there's room — all atomic. Fixed windows are simpler but allow 2× the limit at the boundary, which on a 5/s window is brutal.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The daily bucket is a plain","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"INCR","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"with TTL set to seconds-until-midnight in","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"HubSpot's account timezone","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", not yours — Sofia is UTC+2/+3 but your portal might be set to US Eastern. Get this once and cache it.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"How to read it","depth":25,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"How to read it","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Two-phase: optimistic pre-check, authoritative post-update.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Before a call, run the Lua acquire script. If it returns \"denied,\" sleep until a slot frees up (the script can return ms-until-next-slot) or push the job back to the queue with a delay. Don't busy-loop.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"After the call, parse","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"X-HubSpot-RateLimit-Remaining","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"-Max","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"-Interval-Milliseconds","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"and store them in","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hubspot:rl:meta:{portalId}","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":". This is your reality check — if your local counter says 50 remaining but HubSpot's header says 5, you trust HubSpot and clamp your counter. This handles clock drift, missed accounting (e.g., crashed worker that took a token but never made the request), and other apps in the same account consuming the daily budget invisibly.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"For search specifically, since headers don't come back, the local counter","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"is","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"the source of truth — meaning if you ever crash mid-flight, you've under-counted. Always release tokens on connection-level failure but","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"not","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"on 429 (you really did make that request).","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"How to work with multiple jobs","depth":25,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"How to work with multiple jobs","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The queue layer needs to enforce concurrency separately from the rate limiter. Both work together:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Concurrency cap","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"via","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Queue::throttle()","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"or a Redis semaphore — limits how many sync workers run in parallel against HubSpot. Without this, you can have 50 workers all blocked waiting for tokens, which is wasteful and creates retry storms.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Per-tenant fairness","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— if you sync many Jiminny customers into different HubSpot portals, each portal has its own bucket but you still want one slow portal not to starve others. Either separate queues per portal or a fair-share scheduler.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Priority lanes","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— webhook-driven updates (user-visible latency) should outrank background batch syncs. Two queues:","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hubspot-priority","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"and","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hubspot-bulk","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", with priority workers taking 70% of the burst budget and bulk taking 30% (enforce via separate sub-buckets if you really want hard separation, otherwise just pull from priority first).","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Backoff on 429","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— respect the","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Retry-After","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"header. If absent, exponential with jitter (e.g.,","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"min(2^attempt * 250ms, 30s) ± 20%","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"). The jitter is non-negotiable; without it, simultaneous 429s retry in lockstep and you get thundering-herd 429s on retry.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"How to work with paginated requests","depth":25,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"How to work with paginated requests","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The trap is treating \"fetch all\" as one logical operation. Each page is its own API call and competes for tokens with everything else.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Two practical rules:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Don't hold the worker idle while paginating.","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"If page N takes 500ms and page N+1 needs to wait 800ms for a token, you've burned 800ms of worker time doing nothing. Instead, fetch page N, dispatch the","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"processing","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"of page N as a separate job, and queue a \"fetch page N+1\" job with a delay equal to the wait time. Each page becomes its own atomic unit.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Always batch where HubSpot offers it.","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"POST /crm/v3/objects/{type}/batch/{read|update|create}","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"accepts up to 100 IDs per call. For your \"patching IDs\" flow this is the difference between 600 calls and 6.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Walkthrough: 600 opportunities","depth":25,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Walkthrough: 600 opportunities","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Naive flow (one PATCH per deal): 600 calls. At 190/10s that's ~32s of API time, well under daily. You'd hit burst easily without throttling. Plus likely 1-3 search calls upfront and N association calls.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Sane flow:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Identify deltas","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— if you can avoid Search at all, do. Use","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"lastmodifieddate","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"filter on a single search if you must, paginate at limit=200. For 600 deals that's 3 search calls @ 5/s = ~600ms naturally throttled.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Batch read","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"current state —","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"POST /crm/v3/objects/deals/batch/read","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"with 100 IDs per call → 6 calls. Burst weight 6.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Compute diff","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"in your code (no API).","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Batch update","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"—","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"POST /crm/v3/objects/deals/batch/update","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"with 100 per call → 6 calls.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Associations","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"—","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"POST /crm/v4/associations/{from}/{to}/batch/create","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"if needed → another few batch calls.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Total: ~15-20 API calls for 600 deals. Burst budget consumed: 20/190 over ~5s. Daily impact: trivial.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Recognition: pre-check denies if","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"<weight>","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"slots aren't free; on 429 the response surfaces","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"policyName","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"(DAILY/SECONDLY) — log it, push the job back with","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Retry-After","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"delay, increment a metric so you can alarm on sustained 429 rate.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Pitfalls & bottlenecks worth pre-empting","depth":25,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Pitfalls & bottlenecks worth pre-empting","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Daily quota is shared across the whole portal","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", including any n8n flows, other private apps, marketing automation calling APIs, etc. Budget for ~70-80% of the documented limit, not 100%. Add an internal per-app daily cap so a runaway sync can't starve other apps.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Search is uniquely fragile","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":": separate 5/s bucket, no headers to read, 10k-result cap per query. If you ever hit 10k+ deals matching a filter, partition by","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hs_object_id","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ranges or by","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"lastmodifieddate","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"windows.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Retry storms after HubSpot incidents","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— always jitter, always cap total retries (e.g., 5 attempts, then dead-letter).","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Webhook → sync → webhook loops","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— when your update fires a HubSpot webhook that triggers another sync. Tag your own writes (e.g., a custom property","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"jy_last_sync_id","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":") and ignore webhooks where it just changed.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Token refresh","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— OAuth refresh itself counts against burst. Cache the access token in Redis with TTL =","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"expires_in - 60s","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", single-flight the refresh (only one worker refreshes; others wait on a lock).","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Search latency for fresh writes","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— newly created/updated objects don't appear in search instantly. Don't write-then-search; use returned IDs directly.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Clock skew","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— Redis is authoritative. Don't use","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"time()","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"from each worker for window scoring; use","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"redis.call('TIME')","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"inside the Lua script.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Dead workers with held tokens","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— sliding-window-log handles this naturally because tokens expire by score; token-bucket implementations need explicit release-on-crash logic.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The 5% error rule","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"counts every 429 toward your error budget, even successfully retried ones. If your pre-check is working well, 429s should be near zero — if they're not, your pre-check is wrong, not just slow.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Phantom contention with Laravel","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RateLimited","depth":29,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"middleware","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":": it's per-job-class by default, not per-portal. If your","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncDealJob","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"and","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"UpdateActivityJob","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"are different classes both calling HubSpot, they don't share a Laravel-level limiter — you need a single","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"HubspotRateLimiter","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"service that everything routes through.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"If you want, I can sketch the Lua script for the sliding-window acquire and the Laravel service wrapper around it.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Give positive feedback","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Give negative feedback","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Retry","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"You said: What will happen if there are two different types of rate limits?","depth":21,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"You said: What will happen if there are two different types of rate limits?","depth":22,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"What will happen if there are two different types of rate limits?","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Search requests that have 5 requests per second","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The other rate limit that has, let's say, 100 requests per 10 seconds How do these work together? Is there some conflict? Can I reach the limit with one request and block either as well, or are these separated? Can I still continue making search requests once I hit the normal requests limits?","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"13:40","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Retry","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Edit","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Copy","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"Claude responded: They're independent buckets — with one shared bucket on top.","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Claude responded: They're independent buckets — with one shared bucket on top.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Analyzed independent rate limit buckets and their practical interactions","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Analyzed independent rate limit buckets and their practical interactions","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"They're independent buckets — with one shared bucket on top.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"The three buckets and what each call hits","depth":25,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"The three buckets and what each call hits","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy to clipboard","depth":28,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"┌──────────────────┐","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Search request ──→ │ Search: 5/sec │ ──┐","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"└──────────────────┘ │","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"├──→ ┌─────────────────┐","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"┌──────────────────┐ │ │ Daily: 250k–1M │","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Non-search call ──→ │ Burst: 190/10s │ ──┘ │ (per portal) │","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"└──────────────────┘ └─────────────────┘","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"A search call is only metered against the search bucket and the daily bucket. A non-search call (batch read/update, single PATCH, associations, etc.) is only metered against the burst bucket and the daily bucket. The two short-window buckets do not share counters.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"What this means practically","depth":25,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"What this means practically","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Hitting search secondly limit (5/s):","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Only further","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/search","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"calls 429. Your batch reads, batch updates, single PATCHes, association calls — all keep working at full burst speed. This is actually useful: if your sync is bottlenecked on Search, you can pivot to using","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"lastmodifieddate","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"filters via batch endpoints, or use the IDs you already have to do batch reads, while Search cools off.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Hitting burst limit (190/10s):","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Only non-search calls 429. You can still issue Search calls at 5/s. Useful for: continuing to identify deltas for queueing while in-flight updates drain, or refreshing a small set of records via Search even though your write pipeline is paused.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Hitting daily limit:","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Everything stops. Search and non-search alike. Doesn't unblock until midnight in your portal's configured timezone — and remember this is shared across every private app in the portal, plus n8n flows, marketing tools, anything else hitting the API with that account.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"So can one type of request block the other?","depth":25,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"So can one type of request block the other?","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Search → Burst:","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"No.","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Saturating Search at 50 calls per 10s leaves your full 190/10s burst untouched.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Burst → Search:","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"No.","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Saturating burst leaves Search's 5/s untouched.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Either → Daily:","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Yes","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", but only by contributing to the same daily counter. It's volume that kills you here, not the type.","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"In theory you can sustain ~50 search + ~190 other =","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"~240 calls per 10 seconds","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"indefinitely (until daily runs out), because the two buckets bill independently.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Implementation consequence","depth":25,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Implementation consequence","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Your rate limiter needs to know which bucket a request hits before it acquires. Cleanest pattern:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy to clipboard","depth":28,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"php","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$limiter","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"->","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"acquire","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"(","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"'search'","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":",","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$weight","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"=","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":")","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":";","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"// for search endpoints only","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$limiter","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"->","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"acquire","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"(","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"'burst'","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":",","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$weight","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"=","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":")","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":";","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"// for everything else","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$limiter","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"->","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"acquire","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"(","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"'daily'","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":",","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$weight","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"=","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":")","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":";","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"// every call, both kinds","depth":28,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"In Redis: three separate keys, three separate Lua acquire scripts (or one script with a bucket parameter). A search call calls","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"acquire('search')","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"+","depth":26,"on_screen":false,"role_description":"text"}]...
|
-8044090442912334242
|
4039394015615736924
|
click
|
accessibility
|
NULL
|
Skip to content
Skip to content
Click to collapse
Skip to content
Skip to content
Click to collapse
⌘B
Drag to resize
Open sidebar
Chat
Cowork
Code
New chat ⌘N
New chat
⌘N
Projects
Artifacts
Customize
Pinned
Bulgarian citizenship application process for EU residents
More options for Bulgarian citizenship application process for EU residents
Dawarich location tracking project
More options for Dawarich location tracking project
Recents
View all
HubSpot rate limit implementation strategy
More options for HubSpot rate limit implementation strategy
Screenpipe retention policy code location
More options for Screenpipe retention policy code location
Viewing retention policy in screenpipe
More options for Viewing retention policy in screenpipe
Clean shot x video recording termination issue
More options for Clean shot x video recording termination issue
HubSpot rate limit handling with executeRequest
More options for HubSpot rate limit handling with executeRequest
Untitled
More options
💬 Screen pipe. Is there ability…
More options for 💬 Screen pipe. Is there ability…
SMB mount access inconsistency between Finder and iTerm
More options for SMB mount access inconsistency between Finder and iTerm
💬 What is the best switch I can…
More options for 💬 What is the best switch I can…
Permission denied on screenpipe volume
More options for Permission denied on screenpipe volume
Screenpipe sync database attachment error
More options for Screenpipe sync database attachment error
Last swimming outing with Dani
More options for Last swimming outing with Dani
Definition of incarcerated
More options for Definition of incarcerated
Chromecast remote volume buttons not working
More options for Chromecast remote volume buttons not working
Salesforce API errors with Organization and FieldDefinition queries
More options for Salesforce API errors with Organization and FieldDefinition queries
Daily activity summary from screenpipe data
More options for Daily activity summary from screenpipe data
MacBook unexpected restarts and kanji screen
More options for MacBook unexpected restarts and kanji screen
Security patch review and testing guidance
More options for Security patch review and testing guidance
Food calorie values reference
More options for Food calorie values reference
Tracking location history from last week
More options for Tracking location history from last week
Lukas Pro
Get apps and extensions
HubSpot rate limit implementation strategy, rename chat
HubSpot rate limit implementation strategy
More options for HubSpot rate limit implementation strategy
Close
Share chat
Claude finished the response
You said: So just a solution for rate limit implementation.
You said: So just a solution for rate limit implementation.
So just a solution for rate limit implementation. The situation currently is that there are some daily and secondary limits for HubSpot. I would like to make sure I never reach a 429 error rate limit. The requests can come from any flow. It can be:
updating activity (engagement, meeting, call, note)
searching for a company or contact
updating deal
patching IDs
Review what the limit is at the moment in the HubSpot documentation and then think of the solution:
where to store it
how to read it
how to work with multiple jobs
how to work with paginated requests Let's consider a situation when there are 600 opportunities to sync. What would be the flow? How would the rate limit be recognized? How would it be handled? What are the potential issues? [API usage guidelines and limits - HubSpot docs](
https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines
https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines
). Example of such a error Client error:
POST https://api.hubapi.com/crm/v3/objects/contact/search
resulted in a
429 Too Many Requests
response: {"status":"error","message":"You have reached your secondly limit.","errorType":"RATE_LIMIT","correlationId":"019dffc4-4 (truncated...). Think carefully about the implementation and potential issue and bottlenecks.
Show more
10:42
Retry
Edit
Copy
Claude responded: Current HubSpot limits (Apr 2026)
Claude responded: Current HubSpot limits (Apr 2026)
Synthesized HubSpot rate limit architecture with Redis storage and sliding window algorithms
Synthesized HubSpot rate limit architecture with Redis storage and sliding window algorithms
Current HubSpot limits (Apr 2026)
Current HubSpot limits (Apr 2026)
For privately distributed apps (which is what Jiminny presumably uses with HubSpot), the limits are layered: a per-app burst window of 100/10s on Free/Starter, 190/10s on Pro/Enterprise, or 250/10s with the API Limit Increase add-on
, plus a per-account daily cap of 250k / 625k / 1M depending on tier — shared across all private apps in the account
. The burst window is per app; the daily quota is per portal.
hubspot
hubspot
hubspot
hubspot
The Search API is special: five requests per second per account, capped at 200 records per page, with a hard 10,000-result ceiling per query
. That's the limit the 429 in your example is hitting (
secondly limit
on
/crm/v3/objects/contact/search
). It's a separate bucket from the 190/10s, and critically, search responses do not include the
X-HubSpot-RateLimit-*
headers
— you can't read remaining capacity off the response, you have to track it yourself.
hubspot
hubspot
hubspot
hubspot
Non-search endpoints return
X-HubSpot-RateLimit-Remaining
,
-Max
, and
-Interval-Milliseconds
. The daily headers are not returned for OAuth-authenticated calls
, so for those you check the account-info endpoint or maintain your own counter. There's also a soft rule: errors should stay under 5% of total daily requests
— that's enforced for marketplace listing, but it's also a sane operational target.
hubspot
hubspot
hubspot
hubspot
So you have
four buckets
to track at minimum: app-burst (10s sliding), search-secondly (1s sliding), account-daily (24h fixed, midnight in HubSpot's TZ), and per-app daily share (your own budgeting on top of the account cap).
Where to store it
Where to store it
Redis. It's the only realistic option once you have multiple queue workers — DB-backed counters serialize too much, and in-process state can't coordinate across workers. Laravel already speaks Redis natively, and you get atomic
INCR
/
EXPIRE
plus Lua scripting for true CAS semantics.
Key layout I'd use:
Copy to clipboard
hubspot:rl:burst:{portalId}:{appId} ZSET (sliding 10s)
hubspot:rl:search:{portalId} ZSET (sliding 1s)
hubspot:rl:daily:{portalId} STRING + TTL to midnight TZ
hubspot:rl:meta:{portalId} HASH (last seen headers)
The two short-window buckets are sliding-window-log (Redis ZSET, score =
microtime
, member = unique request id). Lua script removes entries older than the window, counts remaining slots, and only adds the new one if there's room — all atomic. Fixed windows are simpler but allow 2× the limit at the boundary, which on a 5/s window is brutal.
The daily bucket is a plain
INCR
with TTL set to seconds-until-midnight in
HubSpot's account timezone
, not yours — Sofia is UTC+2/+3 but your portal might be set to US Eastern. Get this once and cache it.
How to read it
How to read it
Two-phase: optimistic pre-check, authoritative post-update.
Before a call, run the Lua acquire script. If it returns "denied," sleep until a slot frees up (the script can return ms-until-next-slot) or push the job back to the queue with a delay. Don't busy-loop.
After the call, parse
X-HubSpot-RateLimit-Remaining
/
-Max
/
-Interval-Milliseconds
and store them in
hubspot:rl:meta:{portalId}
. This is your reality check — if your local counter says 50 remaining but HubSpot's header says 5, you trust HubSpot and clamp your counter. This handles clock drift, missed accounting (e.g., crashed worker that took a token but never made the request), and other apps in the same account consuming the daily budget invisibly.
For search specifically, since headers don't come back, the local counter
is
the source of truth — meaning if you ever crash mid-flight, you've under-counted. Always release tokens on connection-level failure but
not
on 429 (you really did make that request).
How to work with multiple jobs
How to work with multiple jobs
The queue layer needs to enforce concurrency separately from the rate limiter. Both work together:
Concurrency cap
via
Queue::throttle()
or a Redis semaphore — limits how many sync workers run in parallel against HubSpot. Without this, you can have 50 workers all blocked waiting for tokens, which is wasteful and creates retry storms.
Per-tenant fairness
— if you sync many Jiminny customers into different HubSpot portals, each portal has its own bucket but you still want one slow portal not to starve others. Either separate queues per portal or a fair-share scheduler.
Priority lanes
— webhook-driven updates (user-visible latency) should outrank background batch syncs. Two queues:
hubspot-priority
and
hubspot-bulk
, with priority workers taking 70% of the burst budget and bulk taking 30% (enforce via separate sub-buckets if you really want hard separation, otherwise just pull from priority first).
Backoff on 429
— respect the
Retry-After
header. If absent, exponential with jitter (e.g.,
min(2^attempt * 250ms, 30s) ± 20%
). The jitter is non-negotiable; without it, simultaneous 429s retry in lockstep and you get thundering-herd 429s on retry.
How to work with paginated requests
How to work with paginated requests
The trap is treating "fetch all" as one logical operation. Each page is its own API call and competes for tokens with everything else.
Two practical rules:
Don't hold the worker idle while paginating.
If page N takes 500ms and page N+1 needs to wait 800ms for a token, you've burned 800ms of worker time doing nothing. Instead, fetch page N, dispatch the
processing
of page N as a separate job, and queue a "fetch page N+1" job with a delay equal to the wait time. Each page becomes its own atomic unit.
Always batch where HubSpot offers it.
POST /crm/v3/objects/{type}/batch/{read|update|create}
accepts up to 100 IDs per call. For your "patching IDs" flow this is the difference between 600 calls and 6.
Walkthrough: 600 opportunities
Walkthrough: 600 opportunities
Naive flow (one PATCH per deal): 600 calls. At 190/10s that's ~32s of API time, well under daily. You'd hit burst easily without throttling. Plus likely 1-3 search calls upfront and N association calls.
Sane flow:
Identify deltas
— if you can avoid Search at all, do. Use
lastmodifieddate
filter on a single search if you must, paginate at limit=200. For 600 deals that's 3 search calls @ 5/s = ~600ms naturally throttled.
Batch read
current state —
POST /crm/v3/objects/deals/batch/read
with 100 IDs per call → 6 calls. Burst weight 6.
Compute diff
in your code (no API).
Batch update
—
POST /crm/v3/objects/deals/batch/update
with 100 per call → 6 calls.
Associations
—
POST /crm/v4/associations/{from}/{to}/batch/create
if needed → another few batch calls.
Total: ~15-20 API calls for 600 deals. Burst budget consumed: 20/190 over ~5s. Daily impact: trivial.
Recognition: pre-check denies if
<weight>
slots aren't free; on 429 the response surfaces
policyName
(DAILY/SECONDLY) — log it, push the job back with
Retry-After
delay, increment a metric so you can alarm on sustained 429 rate.
Pitfalls & bottlenecks worth pre-empting
Pitfalls & bottlenecks worth pre-empting
Daily quota is shared across the whole portal
, including any n8n flows, other private apps, marketing automation calling APIs, etc. Budget for ~70-80% of the documented limit, not 100%. Add an internal per-app daily cap so a runaway sync can't starve other apps.
Search is uniquely fragile
: separate 5/s bucket, no headers to read, 10k-result cap per query. If you ever hit 10k+ deals matching a filter, partition by
hs_object_id
ranges or by
lastmodifieddate
windows.
Retry storms after HubSpot incidents
— always jitter, always cap total retries (e.g., 5 attempts, then dead-letter).
Webhook → sync → webhook loops
— when your update fires a HubSpot webhook that triggers another sync. Tag your own writes (e.g., a custom property
jy_last_sync_id
) and ignore webhooks where it just changed.
Token refresh
— OAuth refresh itself counts against burst. Cache the access token in Redis with TTL =
expires_in - 60s
, single-flight the refresh (only one worker refreshes; others wait on a lock).
Search latency for fresh writes
— newly created/updated objects don't appear in search instantly. Don't write-then-search; use returned IDs directly.
Clock skew
— Redis is authoritative. Don't use
time()
from each worker for window scoring; use
redis.call('TIME')
inside the Lua script.
Dead workers with held tokens
— sliding-window-log handles this naturally because tokens expire by score; token-bucket implementations need explicit release-on-crash logic.
The 5% error rule
counts every 429 toward your error budget, even successfully retried ones. If your pre-check is working well, 429s should be near zero — if they're not, your pre-check is wrong, not just slow.
Phantom contention with Laravel
RateLimited
middleware
: it's per-job-class by default, not per-portal. If your
SyncDealJob
and
UpdateActivityJob
are different classes both calling HubSpot, they don't share a Laravel-level limiter — you need a single
HubspotRateLimiter
service that everything routes through.
If you want, I can sketch the Lua script for the sliding-window acquire and the Laravel service wrapper around it.
Copy
Give positive feedback
Give negative feedback
Retry
You said: What will happen if there are two different types of rate limits?
You said: What will happen if there are two different types of rate limits?
What will happen if there are two different types of rate limits?
Search requests that have 5 requests per second
The other rate limit that has, let's say, 100 requests per 10 seconds How do these work together? Is there some conflict? Can I reach the limit with one request and block either as well, or are these separated? Can I still continue making search requests once I hit the normal requests limits?
13:40
Retry
Edit
Copy
Claude responded: They're independent buckets — with one shared bucket on top.
Claude responded: They're independent buckets — with one shared bucket on top.
Analyzed independent rate limit buckets and their practical interactions
Analyzed independent rate limit buckets and their practical interactions
They're independent buckets — with one shared bucket on top.
The three buckets and what each call hits
The three buckets and what each call hits
Copy to clipboard
┌──────────────────┐
Search request ──→ │ Search: 5/sec │ ──┐
└──────────────────┘ │
├──→ ┌─────────────────┐
┌──────────────────┐ │ │ Daily: 250k–1M │
Non-search call ──→ │ Burst: 190/10s │ ──┘ │ (per portal) │
└──────────────────┘ └─────────────────┘
A search call is only metered against the search bucket and the daily bucket. A non-search call (batch read/update, single PATCH, associations, etc.) is only metered against the burst bucket and the daily bucket. The two short-window buckets do not share counters.
What this means practically
What this means practically
Hitting search secondly limit (5/s):
Only further
/search
calls 429. Your batch reads, batch updates, single PATCHes, association calls — all keep working at full burst speed. This is actually useful: if your sync is bottlenecked on Search, you can pivot to using
lastmodifieddate
filters via batch endpoints, or use the IDs you already have to do batch reads, while Search cools off.
Hitting burst limit (190/10s):
Only non-search calls 429. You can still issue Search calls at 5/s. Useful for: continuing to identify deltas for queueing while in-flight updates drain, or refreshing a small set of records via Search even though your write pipeline is paused.
Hitting daily limit:
Everything stops. Search and non-search alike. Doesn't unblock until midnight in your portal's configured timezone — and remember this is shared across every private app in the portal, plus n8n flows, marketing tools, anything else hitting the API with that account.
So can one type of request block the other?
So can one type of request block the other?
Search → Burst:
No.
Saturating Search at 50 calls per 10s leaves your full 190/10s burst untouched.
Burst → Search:
No.
Saturating burst leaves Search's 5/s untouched.
Either → Daily:
Yes
, but only by contributing to the same daily counter. It's volume that kills you here, not the type.
In theory you can sustain ~50 search + ~190 other =
~240 calls per 10 seconds
indefinitely (until daily runs out), because the two buckets bill independently.
Implementation consequence
Implementation consequence
Your rate limiter needs to know which bucket a request hits before it acquires. Cleanest pattern:
Copy to clipboard
php
$limiter
->
acquire
(
'search'
,
$weight
=
1
)
;
// for search endpoints only
$limiter
->
acquire
(
'burst'
,
$weight
=
1
)
;
// for everything else
$limiter
->
acquire
(
'daily'
,
$weight
=
1
)
;
// every call, both kinds
In Redis: three separate keys, three separate Lua acquire scripts (or one script with a bucket parameter). A search call calls
acquire('search')
+...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
12781
|
564
|
9
|
2026-05-09T09:29:50.826831+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-09/1778 /Users/lukas/.screenpipe/data/data/2026-05-09/1778318990826_m2.jpg...
|
Firefox
|
Finance Hub — Personal
|
True
|
finance-hub.lakylak.xyz/outpost.goauthentik.io/sig finance-hub.lakylak.xyz/outpost.goauthentik.io/sign_out...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Pull requests · screenpipe/screenpipe · GitHub
Pul Pull requests · screenpipe/screenpipe · GitHub
Pull requests · screenpipe/screenpipe · GitHub
DNS / Nameservers | Hostinger
DNS / Nameservers | Hostinger
Nginx Proxy Manager
Nginx Proxy Manager
Screenpipe — Archive
Screenpipe — Archive
SQLite Web: archive.db
SQLite Web: archive.db
SQLite Web: db.sqlite
SQLite Web: db.sqlite
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
AFFiNE - All In One KnowledgeOS
AFFiNE - All In One KnowledgeOS
All docs · AFFiNE
All docs · AFFiNE
Payments Logger
Payments Logger
Inbox - [EMAIL] - Gmail
Inbox - [EMAIL] - Gmail
(25) Quora
(25) Quora
Location Logger
Location Logger
Finance Hub
Finance Hub
Finance Hub
Finance Hub
Close tab
Select: payments - db - Adminer
Select: payments - db - Adminer
Електронно банкиране ДСК Директ от Банка ДСК
Електронно банкиране ДСК Директ от Банка ДСК
Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE
Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE
VIVACOM
VIVACOM
Смартфони с Unlimited план до 120 € отстъпка | Vivacom
Смартфони с Unlimited план до 120 € отстъпка | Vivacom
VIVACOM
VIVACOM
Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom
Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom
Claude Code | Claude Platform
Claude Code | Claude Platform
Claude
Claude
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
Finance Hub
Finance Hub
2
transaction
s
Payments
Payments
Upload CSV
Upload CSV
Display settings
Sign out
Upload DSK Bank CSV
Upload DSK Bank CSV
Import transactions from DSK Bank CSV exports. Multiple files are merged automatically. Internal transfers are skipped. Tags are auto-assigned based on payee and description.
Drop DSK Bank CSV files here
or click to select files — multiple files supported
Expected CSV format (DSK Bank export)
Дата, Вид на трансакцията, Основание, Дебит BGN, Кредит BGN, Наредител/Получател, Номер сметка...
Both UTF-8 and Windows-1251 encodings are supported. Tags are auto-applied based on payee and description keywords....
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Pull requests · screenpipe/screenpipe · GitHub","depth":4,"bounds":{"left":0.0,"top":0.0518755,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests · screenpipe/screenpipe · GitHub","depth":5,"bounds":{"left":0.013297873,"top":0.06304868,"width":0.080784574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DNS / Nameservers | Hostinger","depth":4,"bounds":{"left":0.0,"top":0.08459697,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DNS / Nameservers | Hostinger","depth":5,"bounds":{"left":0.013297873,"top":0.09577015,"width":0.053856384,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.0,"top":0.11731844,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.013297873,"top":0.12849163,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.0,"top":0.15003991,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.013297873,"top":0.16121309,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SQLite Web: archive.db","depth":4,"bounds":{"left":0.0,"top":0.18276137,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SQLite Web: archive.db","depth":5,"bounds":{"left":0.013297873,"top":0.19393456,"width":0.040724736,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SQLite Web: db.sqlite","depth":4,"bounds":{"left":0.0,"top":0.21548285,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SQLite Web: db.sqlite","depth":5,"bounds":{"left":0.013297873,"top":0.22665602,"width":0.03756649,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub","depth":4,"bounds":{"left":0.0,"top":0.2482043,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub","depth":5,"bounds":{"left":0.013297873,"top":0.25937748,"width":0.11469415,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.0,"top":0.28092578,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.013297873,"top":0.29209897,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"AFFiNE - All In One KnowledgeOS","depth":4,"bounds":{"left":0.0,"top":0.31364724,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"AFFiNE - All In One KnowledgeOS","depth":5,"bounds":{"left":0.013297873,"top":0.32482043,"width":0.05851064,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"All docs · AFFiNE","depth":4,"bounds":{"left":0.0,"top":0.3463687,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"All docs · AFFiNE","depth":5,"bounds":{"left":0.013297873,"top":0.3575419,"width":0.029587766,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Payments Logger","depth":4,"bounds":{"left":0.0,"top":0.3790902,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Payments Logger","depth":5,"bounds":{"left":0.013297873,"top":0.39026338,"width":0.030086435,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Inbox - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.0,"top":0.41181165,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Inbox - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.013297873,"top":0.42298484,"width":0.06898271,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"(25) Quora","depth":4,"bounds":{"left":0.0,"top":0.4445331,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"(25) Quora","depth":5,"bounds":{"left":0.013297873,"top":0.4557063,"width":0.018949468,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.0,"top":0.4772546,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.013297873,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Finance Hub","depth":4,"bounds":{"left":0.0,"top":0.509976,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Finance Hub","depth":5,"bounds":{"left":0.013297873,"top":0.5211492,"width":0.021609042,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Finance Hub","depth":4,"bounds":{"left":0.0,"top":0.54269755,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Finance Hub","depth":5,"bounds":{"left":0.013297873,"top":0.55387074,"width":0.021609042,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.10139628,"top":0.54988027,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Select: payments - db - Adminer","depth":4,"bounds":{"left":0.0,"top":0.575419,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Select: payments - db - Adminer","depth":5,"bounds":{"left":0.013297873,"top":0.5865922,"width":0.05651596,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Електронно банкиране ДСК Директ от Банка ДСК","depth":4,"bounds":{"left":0.0,"top":0.60814047,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Електронно банкиране ДСК Директ от Банка ДСК","depth":5,"bounds":{"left":0.013297873,"top":0.61931366,"width":0.09059176,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE","depth":4,"bounds":{"left":0.0,"top":0.6408619,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE","depth":5,"bounds":{"left":0.013297873,"top":0.6520351,"width":0.113696806,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"VIVACOM","depth":4,"bounds":{"left":0.0,"top":0.6735834,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"VIVACOM","depth":5,"bounds":{"left":0.013297873,"top":0.6847566,"width":0.016788565,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Смартфони с Unlimited план до 120 € отстъпка | Vivacom","depth":4,"bounds":{"left":0.0,"top":0.70630485,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Смартфони с Unlimited план до 120 € отстъпка | Vivacom","depth":5,"bounds":{"left":0.013297873,"top":0.71747804,"width":0.10239362,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"VIVACOM","depth":4,"bounds":{"left":0.0,"top":0.7390263,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"VIVACOM","depth":5,"bounds":{"left":0.013297873,"top":0.7501995,"width":0.016788565,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom","depth":4,"bounds":{"left":0.0,"top":0.7717478,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom","depth":5,"bounds":{"left":0.013297873,"top":0.782921,"width":0.098902926,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Claude Code | Claude Platform","depth":4,"bounds":{"left":0.0,"top":0.8044693,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Claude Code | Claude Platform","depth":5,"bounds":{"left":0.013297873,"top":0.8156425,"width":0.053357713,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Claude","depth":4,"bounds":{"left":0.0,"top":0.83719075,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Claude","depth":5,"bounds":{"left":0.013297873,"top":0.84836394,"width":0.012134309,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.87150836,"width":0.108211435,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0028257978,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.013796543,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.024933511,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.036070477,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden","depth":6,"bounds":{"left":0.04720745,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Finance Hub","depth":8,"bounds":{"left":0.22539894,"top":0.0622506,"width":0.032081116,"height":0.015961692},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Finance Hub","depth":9,"bounds":{"left":0.22539894,"top":0.06264964,"width":0.032081116,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2","depth":9,"bounds":{"left":0.22539894,"top":0.07861133,"width":0.002493351,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"transaction","depth":9,"bounds":{"left":0.2278923,"top":0.07861133,"width":0.022273935,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"s","depth":9,"bounds":{"left":0.25016624,"top":0.07861133,"width":0.0019946808,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Payments","depth":8,"bounds":{"left":0.38613698,"top":0.06384677,"width":0.036070477,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Payments","depth":10,"bounds":{"left":0.39677528,"top":0.0698324,"width":0.02144282,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Upload CSV","depth":8,"bounds":{"left":0.42287233,"top":0.06384677,"width":0.04105718,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":true,"is_selected":false},{"role":"AXStaticText","text":"Upload CSV","depth":10,"bounds":{"left":0.43351063,"top":0.0698324,"width":0.02642952,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Display settings","depth":8,"bounds":{"left":0.5924202,"top":0.06384677,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Sign out","depth":8,"bounds":{"left":0.6050532,"top":0.06384677,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Upload DSK Bank CSV","depth":8,"bounds":{"left":0.3018617,"top":0.11811652,"width":0.22340426,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Upload DSK Bank CSV","depth":9,"bounds":{"left":0.3018617,"top":0.12090982,"width":0.062832445,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Import transactions from DSK Bank CSV exports. Multiple files are merged automatically. Internal transfers are skipped. Tags are auto-assigned based on payee and description.","depth":9,"bounds":{"left":0.3018617,"top":0.14485236,"width":0.20777926,"height":0.02952913},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Drop DSK Bank CSV files here","depth":10,"bounds":{"left":0.3806516,"top":0.2773344,"width":0.06582447,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or click to select files — multiple files supported","depth":10,"bounds":{"left":0.36851728,"top":0.29569036,"width":0.09009308,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Expected CSV format (DSK Bank export)","depth":9,"bounds":{"left":0.3075133,"top":0.3810854,"width":0.077792555,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Дата, Вид на трансакцията, Основание, Дебит BGN, Кредит BGN, Наредител/Получател, Номер сметка...","depth":9,"bounds":{"left":0.3075133,"top":0.39744613,"width":0.2087766,"height":0.02434158},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Both UTF-8 and Windows-1251 encodings are supported. Tags are auto-applied based on payee and description keywords.","depth":9,"bounds":{"left":0.3075133,"top":0.42897046,"width":0.21126994,"height":0.024740623},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8043317166086412866
|
-7258253442719675113
|
click
|
accessibility
|
NULL
|
Pull requests · screenpipe/screenpipe · GitHub
Pul Pull requests · screenpipe/screenpipe · GitHub
Pull requests · screenpipe/screenpipe · GitHub
DNS / Nameservers | Hostinger
DNS / Nameservers | Hostinger
Nginx Proxy Manager
Nginx Proxy Manager
Screenpipe — Archive
Screenpipe — Archive
SQLite Web: archive.db
SQLite Web: archive.db
SQLite Web: db.sqlite
SQLite Web: db.sqlite
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
AFFiNE - All In One KnowledgeOS
AFFiNE - All In One KnowledgeOS
All docs · AFFiNE
All docs · AFFiNE
Payments Logger
Payments Logger
Inbox - [EMAIL] - Gmail
Inbox - [EMAIL] - Gmail
(25) Quora
(25) Quora
Location Logger
Location Logger
Finance Hub
Finance Hub
Finance Hub
Finance Hub
Close tab
Select: payments - db - Adminer
Select: payments - db - Adminer
Електронно банкиране ДСК Директ от Банка ДСК
Електронно банкиране ДСК Директ от Банка ДСК
Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE
Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE
VIVACOM
VIVACOM
Смартфони с Unlimited план до 120 € отстъпка | Vivacom
Смартфони с Unlimited план до 120 € отстъпка | Vivacom
VIVACOM
VIVACOM
Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom
Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom
Claude Code | Claude Platform
Claude Code | Claude Platform
Claude
Claude
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
Finance Hub
Finance Hub
2
transaction
s
Payments
Payments
Upload CSV
Upload CSV
Display settings
Sign out
Upload DSK Bank CSV
Upload DSK Bank CSV
Import transactions from DSK Bank CSV exports. Multiple files are merged automatically. Internal transfers are skipped. Tags are auto-assigned based on payee and description.
Drop DSK Bank CSV files here
or click to select files — multiple files supported
Expected CSV format (DSK Bank export)
Дата, Вид на трансакцията, Основание, Дебит BGN, Кредит BGN, Наредител/Получател, Номер сметка...
Both UTF-8 and Windows-1251 encodings are supported. Tags are auto-applied based on payee and description keywords....
|
NULL
|
NULL
|
NULL
|
NULL
|
|
12782
|
563
|
12
|
2026-05-09T09:29:50.826820+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-09/1778 /Users/lukas/.screenpipe/data/data/2026-05-09/1778318990826_m1.jpg...
|
Firefox
|
Finance Hub — Personal
|
True
|
finance-hub.lakylak.xyz/outpost.goauthentik.io/sig finance-hub.lakylak.xyz/outpost.goauthentik.io/sign_out...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Pull requests · screenpipe/screenpipe · GitHub
Pul Pull requests · screenpipe/screenpipe · GitHub
Pull requests · screenpipe/screenpipe · GitHub
DNS / Nameservers | Hostinger
DNS / Nameservers | Hostinger
Nginx Proxy Manager
Nginx Proxy Manager
Screenpipe — Archive
Screenpipe — Archive
SQLite Web: archive.db
SQLite Web: archive.db
SQLite Web: db.sqlite
SQLite Web: db.sqlite
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
AFFiNE - All In One KnowledgeOS
AFFiNE - All In One KnowledgeOS
All docs · AFFiNE
All docs · AFFiNE
Payments Logger
Payments Logger
Inbox - [EMAIL] - Gmail
Inbox - [EMAIL] - Gmail
(25) Quora
(25) Quora
Location Logger
Location Logger
Finance Hub
Finance Hub
Finance Hub
Finance Hub
Close tab
Select: payments - db - Adminer
Select: payments - db - Adminer
Електронно банкиране ДСК Директ от Банка ДСК
Електронно банкиране ДСК Директ от Банка ДСК
Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE
Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE
VIVACOM
VIVACOM
Смартфони с Unlimited план до 120 € отстъпка | Vivacom
Смартфони с Unlimited план до 120 € отстъпка | Vivacom
VIVACOM
VIVACOM
Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom
Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom
Claude Code | Claude Platform
Claude Code | Claude Platform
Claude
Claude
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
Finance Hub
Finance Hub
2
transaction
s
Payments
Payments
Upload CSV
Upload CSV
Display settings
Sign out
Upload DSK Bank CSV
Upload DSK Bank CSV
Import transactions from DSK Bank CSV exports. Multiple files are merged automatically. Internal transfers are skipped. Tags are auto-assigned based on payee and description.
Drop DSK Bank CSV files here
or click to select files — multiple files supported
Expected CSV format (DSK Bank export)
Дата, Вид на трансакцията, Основание, Дебит BGN, Кредит BGN, Наредител/Получател, Номер сметка...
Both UTF-8 and Windows-1251 encodings are supported. Tags are auto-applied based on payee and description keywords....
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Pull requests · screenpipe/screenpipe · GitHub","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests · screenpipe/screenpipe · GitHub","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DNS / Nameservers | Hostinger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DNS / Nameservers | Hostinger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SQLite Web: archive.db","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SQLite Web: archive.db","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SQLite Web: db.sqlite","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SQLite Web: db.sqlite","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"AFFiNE - All In One KnowledgeOS","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"AFFiNE - All In One KnowledgeOS","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"All docs · AFFiNE","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"All docs · AFFiNE","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Payments Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Payments Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Inbox - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Inbox - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"(25) Quora","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"(25) Quora","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Finance Hub","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Finance Hub","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Finance Hub","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Finance Hub","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Select: payments - db - Adminer","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Select: payments - db - Adminer","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Електронно банкиране ДСК Директ от Банка ДСК","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Електронно банкиране ДСК Директ от Банка ДСК","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"VIVACOM","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"VIVACOM","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Смартфони с Unlimited план до 120 € отстъпка | Vivacom","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Смартфони с Unlimited план до 120 € отстъпка | Vivacom","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"VIVACOM","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"VIVACOM","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Claude Code | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Claude Code | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Claude","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Claude","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Finance Hub","depth":8,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Finance Hub","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"transaction","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"s","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Payments","depth":8,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Payments","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Upload CSV","depth":8,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":true,"is_selected":false},{"role":"AXStaticText","text":"Upload CSV","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Display settings","depth":8,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Sign out","depth":8,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Upload DSK Bank CSV","depth":8,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Upload DSK Bank CSV","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Import transactions from DSK Bank CSV exports. Multiple files are merged automatically. Internal transfers are skipped. Tags are auto-assigned based on payee and description.","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Drop DSK Bank CSV files here","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or click to select files — multiple files supported","depth":10,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Expected CSV format (DSK Bank export)","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Дата, Вид на трансакцията, Основание, Дебит BGN, Кредит BGN, Наредител/Получател, Номер сметка...","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Both UTF-8 and Windows-1251 encodings are supported. Tags are auto-applied based on payee and description keywords.","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8043317166086412866
|
-7258253442719675113
|
click
|
accessibility
|
NULL
|
Pull requests · screenpipe/screenpipe · GitHub
Pul Pull requests · screenpipe/screenpipe · GitHub
Pull requests · screenpipe/screenpipe · GitHub
DNS / Nameservers | Hostinger
DNS / Nameservers | Hostinger
Nginx Proxy Manager
Nginx Proxy Manager
Screenpipe — Archive
Screenpipe — Archive
SQLite Web: archive.db
SQLite Web: archive.db
SQLite Web: db.sqlite
SQLite Web: db.sqlite
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
AFFiNE - All In One KnowledgeOS
AFFiNE - All In One KnowledgeOS
All docs · AFFiNE
All docs · AFFiNE
Payments Logger
Payments Logger
Inbox - [EMAIL] - Gmail
Inbox - [EMAIL] - Gmail
(25) Quora
(25) Quora
Location Logger
Location Logger
Finance Hub
Finance Hub
Finance Hub
Finance Hub
Close tab
Select: payments - db - Adminer
Select: payments - db - Adminer
Електронно банкиране ДСК Директ от Банка ДСК
Електронно банкиране ДСК Директ от Банка ДСК
Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE
Stop Losing Notes: Pick A Cross-Device App That Syncs | AFFiNE
VIVACOM
VIVACOM
Смартфони с Unlimited план до 120 € отстъпка | Vivacom
Смартфони с Unlimited план до 120 € отстъпка | Vivacom
VIVACOM
VIVACOM
Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom
Смартфон SAMSUNG GALAXY A57 5G 256GB | Vivacom
Claude Code | Claude Platform
Claude Code | Claude Platform
Claude
Claude
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
Finance Hub
Finance Hub
2
transaction
s
Payments
Payments
Upload CSV
Upload CSV
Display settings
Sign out
Upload DSK Bank CSV
Upload DSK Bank CSV
Import transactions from DSK Bank CSV exports. Multiple files are merged automatically. Internal transfers are skipped. Tags are auto-assigned based on payee and description.
Drop DSK Bank CSV files here
or click to select files — multiple files supported
Expected CSV format (DSK Bank export)
Дата, Вид на трансакцията, Основание, Дебит BGN, Кредит BGN, Наредител/Получател, Номер сметка...
Both UTF-8 and Windows-1251 encodings are supported. Tags are auto-applied based on payee and description keywords....
|
12779
|
NULL
|
NULL
|
NULL
|
|
11846
|
530
|
16
|
2026-05-09T07:04:58.483858+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-09/1778 /Users/lukas/.screenpipe/data/data/2026-05-09/1778310298483_m2.jpg...
|
Code
|
Design new payment-logge… — finance [SSH: nas]
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧ Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧G)
Run and Debug (⇧⌘D)
Remote Explorer
Extensions (⇧⌘X) - 2 require update
2
Claude Code
Containers
EXPLORER
EXPLORER
Explorer Section: finance [SSH: nas]
Explorer Section: finance [SSH: nas]
FINANCE [SSH: NAS]
auth
dsk-uploader
finance-hub
backend
frontend
.env
.env.example
.gitignore
docker-compose.yml
payments-logger
Outline Section
OUTLINE
OUTLINE
Timeline Section
TIMELINE
TIMELINE
docker-compose.yml, Editor Group 1
.env, Editor Group 1
# ── Database ───────────────────────────────────────────────────────────────────
[ENV_SECRET]
# ── Notifier service ──────────────────────────────────────────────────────────
NOTIFIER_URL=[URL_WITH_CREDENTIALS] @default(autoincrement())
rawMessage String @map("raw_message")
date DateTime?
type String?
card String?
recipient String?
amount Float?
currency String? @default("EUR")
balance Float?
source Source @default(INGEST)
status Status @default(UNPROCESSED)
tags Tag[]
notifiedAt DateTime? @map("notified_at")
notifyPhone String? @map("notify_phone")
debitBgn Float? @map("debit_bgn")
creditBgn Float? @map("credit_bgn")
transactionType String? @map("transaction_type")
payerAccount String? @map("payer_account")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("payments")
}
model Tag {
id Int @id @default(autoincrement())
name String @unique
color String @default("#6b7280")
payments Payment[]
@@map("tags")
}
enum Status { UNPROCESSED SENT SKIPPED }
enum Source { INGEST UPLOAD }
```
**Key decisions:**
- No `User` model — Authentik owns identity.
- `currency`: `EUR` for SMS ingest, `BGN` for CSV uploads.
- `debitBgn`, `creditBgn`, `transactionType`, `payerAccount`: nullable CSV-only columns; INGEST rows store nulls. Avoids a union query for the unified list view.
- `balance` is always null for CSV rows (DSK export does not include running balance).
- Fresh consolidated migration — no data migration from reference apps required.
---
## API Routes
| Method | Path | Auth | Description |
|--------|------|------|-------------|
| GET | /api/health | public | Health check |
| POST | /api/payments/ingest | public | SMS or structured ingest (source=INGEST) |
| GET | /api/payments | required | List with filters/sort/pagination (+ source filter) |
| GET | /api/payments/meta/tags | required | All tags |
| GET | /api/payments/meta/filters | required | Filter options incl. `sources` array |
| GET | /api/payments/:id | required | Single payment |
| PATCH | /api/payments/:id | required | Update status |
| DELETE | /api/payments/:id | required | Delete |
| POST | /api/payments/:id/send | required | Send notification |
| POST | /api/payments/:id/skip | required | Skip |
| POST | /api/payments/:id/tags | required | Add/upsert tag |
| DELETE | /api/payments/:id/tags/:tagId | required | Remove tag |
| POST | /api/upload/csv | required | DSK CSV file upload (source=UPLOAD) |
---
## Key Implementation Details
### auth.js (replaces entire old auth module)
```js
const PUBLIC_PATHS = new Set(['/api/health', '/api/payments/ingest']);
function authentikMiddleware(req, res, next) {
if (PUBLIC_PATHS.has(req.path)) return next();
const username = req.headers['x-authentik-username'];
if (!username) return res.status(401).json({ error: 'Unauthorized' });
req.user = {
username,
email: req.headers['x-authentik-email'] || null,
groups: (req.headers['x-authentik-groups'] || '').split(',').map(g => g.trim()).filter(Boolean),
};
next();
}
module.exports = { authentikMiddleware };
```
### csvParser.js (port of dskuploader.py)
- `iconv-lite` decodes buffer as cp1251 (DSK Bank export encoding), falls back to UTF-8
- `csv-parse` parses the decoded text with `columns: true`
- Columns: `Дата`, `Вид на трансакцията`, `Основание`, `Дебит BGN`, `Кредит BGN`, `Наредител/Получател`, `Номер сметка на наредителя / получателя`
- Card extraction: regex `/^\d{6}x{6}\d{4}$/` on first token of `Основание`
- Skips rows where `Вид на трансакцията === 'ТРАНСФЕР СОБСТВЕНИ СМЕТКИ'`
- Auto-tags via keyword rules (ЗАПЛАТА→Salary, LIDL→Groceries, NETFLIX→Subscriptions, etc.) — same logic as Python `generate_tags()`
- Returns `{ rows: PaymentData[], skipped: number, errors: string[] }`
### payments.js changes from payments-logger
1. Add `source: 'INGEST'` and `currency` to the `/ingest` create call
2. Add `source` to the `GET /` where clause filter
3. Add `sources` to `meta/filters` response
4. Currency-aware amount formatting in notification message
5. Remove all JWT/auth references (no `/auth/register`, `/auth/login`)
### upload.js (new)
- `multer` memory storage, max 10 files × 10 MB
- Calls `parseDskCsv(buffer)` per file
- Upserts tags via `prisma.tag.upsert` then connects
- Returns `{ imported, skipped, errors, payments[] }`
### Frontend changes
- **Delete**: `auth.js`, `AuthProvider.jsx`
- **main.jsx**: Remove `<AuthProvider>` wrapper
- **App.jsx**: Replace `authFetch` with plain `fetch` (Authentik session cookie travels automatically); logout → `window.location.href = '/outpost.goauthentik.io/sign_out'`; add "Payments" / "Upload CSV" tab toggle
- **FilterBar.jsx**: Add source `<select>` (All / SMS Ingest / CSV Upload); widen grid to 5 cols
- **PaymentTable.jsx**: Add `Source` column with `SMS` (indigo) / `CSV` (emerald) badge; show `${amount} ${currency}` in amount cell
- **UploadPanel.jsx** (new): Drag-and-drop zone + file list + import button + result summary with error accordion; calls `POST /api/upload/csv` with `FormData`
---
## Docker Compose
```yaml
services:
db:
image: postgres:16-alpine
environment: { POSTGRES_USER: finance, POSTGRES_PASSWORD: [PASSWORD] POSTGRES_DB: finance_hub }
volumes: [pgdata:/var/lib/postgresql/data]
healthcheck: { test: pg_isready -U finance -d finance_hub, interval: 5s }
backend:
build: ./backend
environment:
DATABASE_URL: [CONNECTION_STRING]
PORT: "3001"
NOTIFIER_URL: ${NOTIFIER_URL}
NOTIFIER_CHANNEL: ${NOTIFIER_CHANNEL:-viber}
NOTIFY_DEFAULT_PHONE: ${NOTIFY_DEFAULT_PHONE}
TZ: ${TZ:-Europe/Sofia}
ports: ["${BACKEND_PORT:-3001}:3001"]
depends_on: { db: { condition: service_healthy } }
frontend:
build: ./frontend
ports: ["${FRONTEND_PORT:-5175}:5173"]
depends_on: [backend]
volumes: { pgdata: }
```
**NPM setup:** Frontend port proxied through Authentik forward auth. Backend port exposed separately (unprotected) so the public `/api/payments/ingest` remains reachable by iOS Shortcuts / SMS gateways without login.
---
## Environment Variables (.env)
```bash
[ENV_SECRET]
NOTIFIER_URL=[URL_WITH_CREDENTIALS] @default(autoincrement())
rawMessage String @map("raw_message")
date DateTime?
type String?
card String?
recipient String?
amount Float?
currency String? @default("EUR")
balance Float?
source Source @default(INGEST)
status Status @default(UNPROCESSED)
tags Tag[]
notifiedAt DateTime? @map("notified_at")
notifyPhone String? @map("notify_phone")
debitBgn Float? @map("debit_bgn")
creditBgn Float? @map("credit_bgn")
transactionType String? @map("transaction_type")
payerAccount String? @map("payer_account")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("payments")
}
model Tag {
id Int @id @default(autoincrement())
name String @unique
color String @default("#6b7280")
payments Payment[]
@@map("tags")
}
enum Status {
UNPROCESSED
SENT
SKIPPED
}
enum Source {
INGEST
UPLOAD
}
Write
migration.sql
migration.sql
55 lines
-- CreateEnum
CREATE TYPE "Status" AS ENUM ('UNPROCESSED', 'SENT', 'SKIPPED');
CREATE TYPE "Source" AS ENUM ('INGEST', 'UPLOAD');
-- CreateTable
CREATE TABLE "payments" (
"id" SERIAL PRIMARY KEY,
"raw_message" TEXT NOT NULL,
"date" TIMESTAMP(3),
"type" TEXT,
"card" TEXT,
"recipient" TEXT,
"amount" DOUBLE PRECISION,
"currency" TEXT DEFAULT 'EUR',
"balance" DOUBLE PRECISION,
"source" "Source" NOT NULL DEFAULT 'INGEST',
"status" "Status" NOT NULL DEFAULT 'UNPROCESSED',
"notified_at" TIMESTAMP(3),
"notify_phone" TEXT,
"debit_bgn" DOUBLE PRECISION,
"credit_bgn" DOUBLE PRECISION,
"transaction_type" TEXT,
"payer_account" TEXT,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP
);
-- CreateTable
CREATE TABLE "tags" (
"id" SERIAL PRIMARY KEY,
"name" TEXT NOT NULL,
"color" TEXT NOT NULL DEFAULT '#6b7280'
);
-- CreateUniqueIndex
CREATE UNIQUE INDEX "tags_name_key" ON "tags"("name");
-- CreateTable (M2M join)
CREATE TABLE "_PaymentToTag" (
"A" INTEGER NOT NULL,
"B" INTEGER NOT NULL,
CONSTRAINT "_PaymentToTag_AB_pkey" PRIMARY KEY ("A", "B")
);
CREATE INDEX "_PaymentToTag_B_index" ON "_PaymentToTag"("B");
-- AddForeignKey
ALTER TABLE "_PaymentToTag"
ADD CONSTRAINT "_PaymentToTag_A_fkey"
FOREIGN KEY ("A") REFERENCES "payments"("id") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "_PaymentToTag"
ADD CONSTRAINT "_PaymentToTag_B_fkey"
FOREIGN KEY ("B") REFERENCES "tags"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Write
migration_lock.toml
migration_lock.toml
4 lines
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"
Update Todos
Create folder structure and root config files
Write backend Prisma schema and migration
Write backend package.json and Dockerfile
Write backend src files (auth, parser, csvParser, index)
Write backend routes (payments.js, upload.js)
Write frontend config files
Write frontend React components
Build and verify with docker compose
Write
package.json
package.json
26 lines
{
"name": "finance-hub-backend",
"version": "1.0.0",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js",
"dev": "nodemon src/index.js",
"prisma:generate": "prisma generate",
"prisma:migrate": "prisma migrate deploy"
},
"dependencies": {
"@prisma/client": "^5.22.0",
"cors": "^2.8.5",
"csv-parse": "^5.5.6",
"express": "^4.21.1",
"express-rate-limit": "^7.4.0",
"iconv-lite": "^0.6.3",
"morgan": "^1.10.0",
"multer": "^1.4.5-lts.1"
},
"devDependencies": {
"nodemon": "^3.1.7",
"prisma": "^5.22.0"
}
}
Write
Dockerfile
Dockerfile
18 lines
FROM node:20-alpine
RUN apk add --no-cache openssl
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install
COPY prisma ./prisma
RUN npx prisma generate
COPY src ./src
EXPOSE 3001
CMD ["sh", "-c", "npx prisma migrate deploy && node src/index.js"]
Update Todos
Create folder structure and root config files
Write backend Prisma schema and migration
Write backend package.json and Dockerfile
Write backend src files (auth, parser, csvParser, index)
Write backend routes (payments.js, upload.js)
Write frontend config files
Write frontend React components
Build and verify with docker compose
Write
auth.js
auth.js
27 lines
const PUBLIC_PATHS = new Set([
'/api/health',
'/api/payments/ingest',
]);
function authentikMiddleware(req, res, next) {
if (PUBLIC_PATHS.has(req.path)) return next();
const username = req.headers['x-authentik-username'];
if (!username) {
return res.status(401).json({ error: 'Unauthorized — missing Authentik session' });
}
req.user = {
username,
email: req.headers['x-authentik-email'] || null,
groups: (req.headers['x-authentik-groups'] || '')
.split(',')
.map(g => g.trim())
.filter(Boolean),
};
next();
}
module.exports = { authentikMiddleware };
Write
parser.js
parser.js
104 lines
/**
* Parses SMS payment messages from Bulgarian banks (DSK Bank, etc.)
*
* Supported formats:
*
* POS / INTERNET / ECOM / P2P payment:
* DSK Bank. Na DD/MM/YYYY v HH:MM sa plateni AMOUNT CURRENCY s karta CARD na POS s adres: RECIPIENT. Nalichni: BALANCE CURRENCY.
*
* ATM withdrawal:
* DSK Bank. Na DD/MM/YYYY v HH:MM sa iztegleni AMOUNT CURRENCY s karta CARD ot ATM s adres: RECIPIENT. Nalichni: BALANCE CURRENCY.
*
* ATM utility payment (amount may include fee as AMOUNT/FEE):
* DSK Bank. Na DD/MM/YYYY v HH:MM sa plateni AMOUNT CURRENCY/FEE CURRENCY s karta CARD na ATM s adres:RECIPIENT. Nalichni: BALANCE CURRENCY.
*/
const LOCAL_TZ = process.env.TZ || 'Europe/Sofia';
/**
* Convert a local-timezone date/time to a UTC Date object.
* Uses Intl to resolve the actual UTC offset (DST-aware).
*/
function localToUtc(year, month, day, hour, minute) {
const naive = new Date(Date.UTC(year, month - 1, day, hour, minute, 0));
const formatter = new Intl.DateTimeFormat('en-US', {
timeZone: LOCAL_TZ,
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit', second: '2-digit',
hour12: false,
});
const parts = {};
formatter.formatToParts(naive).forEach(p => { parts[p.type] = p.value; });
const localAtNaive = new Date(Date.UTC(
parseInt(parts.year), parseInt(parts.month) - 1, parseInt(parts.day),
parseInt(parts.hour) % 24, parseInt(parts.minute), parseInt(parts.second),
));
const offsetMs = localAtNaive.getTime() - naive.getTime();
return new Date(Date.UTC(year, month - 1, day, hour, minute, 0) - offsetMs);
}
function parsePaymentSms(message) {
const result = {
rawMessage: message,
date: null,
type: null,
card: null,
recipient: null,
amount: null,
balance: null,
};
// Date and time: "Na DD/MM/YYYY v HH:MM"
const dateMatch = message.match(/Na (\d{2})\/(\d{2})\/(\d{4}) v (\d{2}):(\d{2})/i);
if (dateMatch) {
const [, day, month, year, hour, minute] = dateMatch;
result.date = localToUtc(
parseInt(year), parseInt(month), parseInt(day),
parseInt(hour), parseInt(minute),
);
}
// Card mask: "s karta 400915***4447" or "s karta 483890***7162"
const cardMatch = message.match(/s karta\s+([\d*]+)/i);
if (cardMatch) {
result.card = cardMatch[1];
}
// Transaction type: supports both prepositions
// "na POS" / "na ATM" / "na INTERNET" etc. (payment)
// "ot ATM" (withdrawal)
const typeMatch = message.match(/(?:na|ot)\s+(POS|ATM|INTERNET|ECOM|P2P)\b/i);
if (typeMatch) {
result.type = typeMatch[1].toUpperCase();
}
// Recipient address: "s adres: MERCHANT" or "s adres:MERCHANT" (no space variant)
const recipientMatch = message.match(/s adres:\s*([^.]+)\./i);
if (recipientMatch) {
result.recipient = recipientMatch[1].trim();
}
// Amount: handles both verbs and the AMOUNT/FEE suffix format
// "sa plateni 7.78 EUR"
// "sa iztegleni 400.00 EUR"
// "sa plateni 0.50 EUR/0.50 EUR" → captures 0.50 (the charged amount, ignoring fee)
const amountMatch = message.match(/sa (?:plateni|iztegleni)\s+([\d.,]+)\s+[A-Z]{3}/i);
if (amountMatch) {
result.amount = parseFloat(amountMatch[1].replace(',', '.'));
}
// Balance: "Nalichni: 2583.07 EUR."
const balanceMatch = message.match(/Nalichni:\s*([\d.,]+)\s+[A-Z]{3}/i);
if (balanceMatch) {
result.balance = parseFloat(balanceMatch[1].replace(',', '.'));
}
return result;
}
module.exports = { parsePaymentSms };
Write
csvParser.js
csvParser.js
175 lines
/**
* DSK Bank CSV parser — Node.js port of dskuploader.py
*
* DSK Bank exports use Windows-1251 (cp1251) encoding.
* Each row maps to a Payment record with source=UPLOAD, currency=BGN.
*/
const { parse } = require('csv-parse');
const iconv = require('iconv-lite');
const SKIP_TYPE = 'ТРАНСФЕР СОБСТВЕНИ СМЕТКИ';
const CARD_REGEX = /^\d{6}x{6}\d{4}$/;
const POS_REGEX = /^\s*ПЛАЩАНЕ\s+НА\s+ПОС\s+\d{2}\.\d{2}\.\d{4}\s+\d{2}:\d{2}/;
const COL = {
DATE: 'Дата',
TYPE: 'Вид на трансакцията',
REASON: 'Основание',
DEBIT: 'Дебит BGN',
CREDIT: 'Кредит BGN',
PAYEE: 'Наредител/Получател',
ACCT: 'Номер сметка на наредителя / получателя',
};
const TAG_RULES = [
['reason', 'ЗАПЛАТА', 'Salary'],
['reason', 'ТЕГЛЕНЕ НА ATM', 'ATM'],
['reason', 'ПЛАЩАНЕ ПО ЗАЕМ', 'Home Credit'],
['reason', 'АВТ.ТАКСА ОБСЛУЖВАНЕ', 'Bills'],
['transactionType', 'КОМУНАЛНИ УСЛУГИ', 'Bills'],
['payee', 'VIVACOM', 'Subscriptions'],
['payee', 'Google', 'Subscriptions'],
['payee', 'SkyShowtime', 'Subscriptions'],
['payee', 'NETFLIX', 'Subscriptions'],
['payee', 'LUKOIL', 'Bills'],
['payee', 'CityGate', 'Bills'],
['payee', 'CBA', 'Groceries'],
['payee', 'FANTASTICO', 'Groceries'],
['payee', 'LIDL', 'Groceries'],
];
function parseNum(val) {
if (val == null || val === '') return null;
if (typeof val === 'number') return isNaN(val) ? null : val;
const s = String(val).trim().replace(/\xa0/g, '').replace(/ /g, '').replace(',', '.');
const n = parseFloat(s);
return isNaN(n) ? null : n;
}
function parseDate(val) {
if (!val) return null;
const s = String(val).trim();
const m = s.match(/^(\d{2})\.(\d{2})\.(\d{4})$/);
if (m) {
return new Date(Date.UTC(parseInt(m[3]), parseInt(m[2]) - 1, parseInt(m[1])));
}
return null;
}
function processReasonAndCard(reason) {
if (!reason || typeof reason !== 'string') return { reason: '', card: null };
const parts = reason.trim().split(' ');
let card = null;
let cleanReason = reason.trim();
if (parts[0] && CARD_REGEX.test(parts[0])) {
card = parts[0];
cleanReason = parts.slice(1).join(' ').trim();
}
if (POS_REGEX.test(cleanReason)) {
const posParts = cleanReason.split('<br/>');
try {
const dateTime = posParts[0].split('ПОС ')[1];
cleanReason = `POS PAYMENT ${dateTime}`;
} catch (_) { /* keep original */ }
}
return { reason: cleanReason.replace(/\s+/g, ' ').trim(), card };
}
function generateTags(fields) {
const tags = new Set();
for (const [field, keyword, tagName] of TAG_RULES) {
if ((fields[field] || '').includes(keyword)) {
tags.add(tagName);
}
}
return Array.from(tags);
}
function processRow(row) {
const transactionType = (row[COL.TYPE] || '').trim();
if (transactionType === SKIP_TYPE) return null;
const { reason, card } = processReasonAndCard(row[COL.REASON]);
const payee = (row[COL.PAYEE] || '').trim();
const payerAccount = (row[COL.ACCT] || '').trim();
const debitBgn = parseNum(row[COL.DEBIT]);
const creditBgn = parseNum(row[COL.CREDIT]);
const date = parseDate(row[COL.DATE]);
const autoTags = generateTags({ reason, transactionType, payee, debitBgn, creditBgn });
const amount = debitBgn ?? creditBgn ?? null;
const rawMessage = [
row[COL.DATE] && `Date: ${row[COL.DATE]}`,
transactionType && `Type: ${transactionType}`,
payee && `Payee: ${payee}`,
debitBgn != null && `Debit: ${debitBgn} BGN`,
creditBgn != null && `Credit: ${creditBgn} BGN`,
].filter(Boolean).join(' | ');
return {
rawMessage,
date,
type: null,
card,
recipient: payee || null,
amount,
currency: 'BGN',
balance: null,
source: 'UPLOAD',
debitBgn,
creditBgn,
transactionType: transactionType || null,
payerAccount: payerAccount || null,
autoTags,
};
}
/**
* Parse a Buffer containing a DSK Bank CSV (cp1251 or UTF-8).
* Returns { rows, skipped, errors }.
*/
async function parseDskCsv(buffer) {
// Try cp1251 first (DSK Bank export encoding), fall back to UTF-8
let text = iconv.decode(buffer, 'cp1251');
if (!text.includes(COL.DATE)) {
text = buffer.toString('utf-8');
}
return new Promise((resolve, reject) => {
const rows = [];
const errors = [];
let skipped = 0;
const parser = parse(text, {
columns: true,
skip_empty_lines: true,
trim: true,
relax_column_count: true,
});
parser.on('readable', () => {
let record;
while ((record = parser.read()) !== null) {
try {
const row = processRow(record);
if (row === null) { skipped++; } else { rows.push(row); }
} catch (err) {
errors.push(err.message);
}
}
});
parser.on('error', reject);
parser.on('end', () => resolve({ rows, skipped, errors }));
});
}
module.exports = { parseDskCsv };
Write
index.js
index.js
39 lines
const express = require('express');
const cors = require('cors');
const morgan = require('morgan');
const rateLimit = require('express-rate-limit');
const { authentikMiddleware } = require('./auth');
const paymentsRouter = require('./routes/payments');
const uploadRouter = require('./routes/upload');
const app = express();
const PORT = process.env.PORT || 3001;
app.use(cors());
app.use(express.json({ limit: '16kb' }));
app.use(morgan('combined'));
// Rate-limit the public ingest endpoint before auth middleware
const ingestLimiter = rateLimit({
windowMs: 60 * 1000,
max: 200,
standardHeaders: true,
legacyHeaders: false,
message: { error: 'Too many requests, slow down' },
});
app.use('/api/payments/ingest', ingestLimiter);
// Authentik header auth (skips /api/health and /api/payments/ingest)
app.use(authentikMiddleware);
app.get('/api/health', (_req, res) => {
res.json({ status: 'ok', timestamp: new Date().toISOString() });
});
app.use('/api/payments', paymentsRouter);
app.use('/api/upload', uploadRouter);
app.listen(PORT, '[IP_ADDRESS]', () => {
console.log(`Finance Hub API running on port ${PORT}`);
});
Update Todos
Create folder structure and root config files
Write backend Prisma schema and migration
Write backend package.json and Dockerfile
Write backend src files (auth, parser, csvParser, index)
Write backend routes (payments.js, upload.js)
Write frontend config files
Write frontend React components
Build and verify with docker compose
Write
payments.js
payments.js
399 lines
const express = require('express');
const { PrismaClient } = require('@prisma/client');
const { parsePaymentSms } = require('../pa...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Explorer (⇧⌘E)","depth":19,"bounds":{"left":0.0,"top":0.047885075,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":true},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.057462092,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Search (⇧⌘F)","depth":19,"bounds":{"left":0.0,"top":0.08619314,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.09577015,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Source Control (⌃⇧G)","depth":19,"bounds":{"left":0.0,"top":0.1245012,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.13407822,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Run and Debug (⇧⌘D)","depth":19,"bounds":{"left":0.0,"top":0.16280925,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.17238627,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Remote Explorer","depth":19,"bounds":{"left":0.0,"top":0.20111732,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.21069433,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Extensions (⇧⌘X) - 2 require update","depth":19,"bounds":{"left":0.0,"top":0.23942538,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.2490024,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":22,"bounds":{"left":0.009640957,"top":0.2601756,"width":0.0019946808,"height":0.008778931},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Claude Code","depth":19,"bounds":{"left":0.0,"top":0.27773345,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Containers","depth":19,"bounds":{"left":0.0,"top":0.3160415,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"EXPLORER","depth":17,"bounds":{"left":0.022606382,"top":0.047885075,"width":0.018949468,"height":0.02793296},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"EXPLORER","depth":18,"bounds":{"left":0.022606382,"top":0.056664005,"width":0.018949468,"height":0.0103751},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.022606382,"top":0.056664005,"width":0.0023271276,"height":0.0103751}},{"char_start":1,"char_count":7,"bounds":{"left":0.024933511,"top":0.056664005,"width":0.01662234,"height":0.0103751}}],"role_description":"text"},{"role":"AXButton","text":"Explorer Section: finance [SSH: nas]","depth":21,"bounds":{"left":0.015957447,"top":0.07581804,"width":0.09940159,"height":0.017557861},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"","depth":23,"bounds":{"left":0.01662234,"top":0.07821229,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"Explorer Section: finance [SSH: nas]","depth":22,"bounds":{"left":0.022606382,"top":0.07581804,"width":0.039228722,"height":0.017557861},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"FINANCE [SSH: NAS]","depth":23,"bounds":{"left":0.022606382,"top":0.079010375,"width":0.039228722,"height":0.0103751},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.022606382,"top":0.07980846,"width":0.0023271276,"height":0.0103751}},{"char_start":1,"char_count":17,"bounds":{"left":0.024933511,"top":0.07980846,"width":0.036901597,"height":0.0103751}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.09577015,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"auth","depth":27,"bounds":{"left":0.025930852,"top":0.09577015,"width":0.008976064,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.096568234,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":3,"bounds":{"left":0.02825798,"top":0.096568234,"width":0.0066489363,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.11332801,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"dsk-uploader","depth":27,"bounds":{"left":0.025930852,"top":0.11332801,"width":0.026928192,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.11412609,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":11,"bounds":{"left":0.028590426,"top":0.11412609,"width":0.024268618,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.13088587,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"finance-hub","depth":27,"bounds":{"left":0.025930852,"top":0.13088587,"width":0.024268618,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.13168396,"width":0.0016622341,"height":0.011971269}},{"char_start":1,"char_count":10,"bounds":{"left":0.027593086,"top":0.13168396,"width":0.022938829,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.14844373,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":27,"bounds":{"left":0.028590426,"top":0.14844373,"width":0.017287234,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.14924182,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":6,"bounds":{"left":0.03125,"top":0.14924182,"width":0.01462766,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.1660016,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":27,"bounds":{"left":0.028590426,"top":0.1660016,"width":0.017287234,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.16679968,"width":0.0016622341,"height":0.011971269}},{"char_start":1,"char_count":7,"bounds":{"left":0.03025266,"top":0.16679968,"width":0.015625,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.1819633,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".env","depth":27,"bounds":{"left":0.028590426,"top":0.18355946,"width":0.00831117,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.18435754,"width":0.0013297872,"height":0.011971269}},{"char_start":1,"char_count":3,"bounds":{"left":0.029920213,"top":0.18435754,"width":0.006981383,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.19952115,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".env.example","depth":27,"bounds":{"left":0.028590426,"top":0.20111732,"width":0.025930852,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.2019154,"width":0.0013297872,"height":0.011971269}},{"char_start":1,"char_count":11,"bounds":{"left":0.029920213,"top":0.2019154,"width":0.024933511,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.21707901,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".gitignore","depth":27,"bounds":{"left":0.028590426,"top":0.21867518,"width":0.018949468,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.21947326,"width":0.0013297872,"height":0.011971269}},{"char_start":1,"char_count":9,"bounds":{"left":0.029920213,"top":0.21947326,"width":0.017952127,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.23463687,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"docker-compose.yml","depth":27,"bounds":{"left":0.028590426,"top":0.23623304,"width":0.042220745,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.23703113,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":17,"bounds":{"left":0.03125,"top":0.23703113,"width":0.03956117,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.25379092,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"payments-logger","depth":27,"bounds":{"left":0.025930852,"top":0.25379092,"width":0.034574468,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.254589,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":14,"bounds":{"left":0.028590426,"top":0.254589,"width":0.031914894,"height":0.011971269}}],"role_description":"text"},{"role":"AXButton","text":"Outline Section","depth":21,"bounds":{"left":0.015957447,"top":0.9473264,"width":0.09940159,"height":0.017557861},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"bounds":{"left":0.01662234,"top":0.9497207,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"OUTLINE","depth":22,"bounds":{"left":0.022606382,"top":0.9473264,"width":0.01662234,"height":0.017557861},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"OUTLINE","depth":23,"bounds":{"left":0.022606382,"top":0.95131683,"width":0.01662234,"height":0.0103751},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.022606382,"top":0.95131683,"width":0.0029920214,"height":0.0103751}},{"char_start":1,"char_count":6,"bounds":{"left":0.025598405,"top":0.95131683,"width":0.013630319,"height":0.0103751}}],"role_description":"text"},{"role":"AXButton","text":"Timeline Section","depth":21,"bounds":{"left":0.015957447,"top":0.9648843,"width":0.09940159,"height":0.017557861},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"bounds":{"left":0.01662234,"top":0.96727854,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"TIMELINE","depth":22,"bounds":{"left":0.022606382,"top":0.9648843,"width":0.01761968,"height":0.017557861},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"TIMELINE","depth":23,"bounds":{"left":0.022606382,"top":0.9688747,"width":0.01761968,"height":0.0103751},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.022606382,"top":0.9688747,"width":0.0026595744,"height":0.0103751}},{"char_start":1,"char_count":7,"bounds":{"left":0.025265958,"top":0.9688747,"width":0.015292553,"height":0.0103751}}],"role_description":"text"},{"role":"AXRadioButton","text":"docker-compose.yml, Editor Group 1","depth":28,"bounds":{"left":0.11569149,"top":0.047885075,"width":0.0625,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":".env, Editor Group 1","depth":28,"bounds":{"left":0.17785904,"top":0.047885075,"width":0.040226065,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"","depth":29,"bounds":{"left":0.14527926,"top":0.07821229,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"# ── Database ───────────────────────────────────────────────────────────────────\nDB_PASSWORD=payments_secret\n\n# ── Notifier service ──────────────────────────────────────────────────────────\nNOTIFIER_URL=https://notifier.lakylak.xyz\nNOTIFIER_CHANNEL=viber\nNOTIFY_DEFAULT_PHONE=+359000000000\n\n# ── Timezone ─────────────────────────────────────────────────────────────────\nTZ=Europe/Sofia\n\n# ── Dev only — remove when NPM + Authentik is wired up ───────────────────────\nDEV_BYPASS_AUTH=true","depth":28,"bounds":{"left":0.13763298,"top":0.15083799,"width":0.19481383,"height":0.014365523},"on_screen":true,"value":"# ── Database ───────────────────────────────────────────────────────────────────\nDB_PASSWORD=payments_secret\n\n# ── Notifier service ──────────────────────────────────────────────────────────\nNOTIFIER_URL=https://notifier.lakylak.xyz\nNOTIFIER_CHANNEL=viber\nNOTIFY_DEFAULT_PHONE=+359000000000\n\n# ── Timezone ─────────────────────────────────────────────────────────────────\nTZ=Europe/Sofia\n\n# ── Dev only — remove when NPM + Authentik is wired up ───────────────────────\nDEV_BYPASS_AUTH=true","role_description":"editor","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"# ── Database ───────────────────────────────────────────────────────────────────\nDB_PASSWORD=payments_secret\n\n# ── Notifier service ──────────────────────────────────────────────────────────\nNOTIFIER_URL=https://notifier.lakylak.xyz\nNOTIFIER_CHANNEL=viber\nNOTIFY_DEFAULT_PHONE=+359000000000\n\n# ── Timezone ─────────────────────────────────────────────────────────────────\nTZ=Europe/Sofia\n\n# ── Dev only — remove when NPM + Authentik is wired up ───────────────────────\nDEV_BYPASS_AUTH=true","depth":29,"bounds":{"left":0.13763298,"top":0.15083799,"width":0.19481383,"height":0.014365523},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"remote SSH: nas","depth":16,"bounds":{"left":0.0006648936,"top":0.98244214,"width":0.028590426,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"bounds":{"left":0.0033244682,"top":0.9848364,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SSH: nas","depth":17,"bounds":{"left":0.008643617,"top":0.9856345,"width":0.017952127,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"No Problems","depth":16,"bounds":{"left":0.03025266,"top":0.98244214,"width":0.022606382,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"bounds":{"left":0.031914894,"top":0.9848364,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"bounds":{"left":0.03723404,"top":0.9856345,"width":0.004986702,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":17,"bounds":{"left":0.041888297,"top":0.9848364,"width":0.0056515955,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"bounds":{"left":0.04720745,"top":0.9856345,"width":0.0039893617,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"No Ports Forwarded","depth":16,"bounds":{"left":0.054521278,"top":0.98244214,"width":0.012632979,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"bounds":{"left":0.05618351,"top":0.9848364,"width":0.0056515955,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"bounds":{"left":0.061502658,"top":0.9856345,"width":0.0039893617,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Notifications","depth":16,"bounds":{"left":0.9886968,"top":0.98244214,"width":0.010638298,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sign In","depth":16,"bounds":{"left":0.9650931,"top":0.98244214,"width":0.022606382,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"bounds":{"left":0.96675533,"top":0.9848364,"width":0.0056515955,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sign In","depth":17,"bounds":{"left":0.97207445,"top":0.9856345,"width":0.013962766,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Info: Do you want to install the recommended 'Rainbow CSV' extension from mechatroner for report(1).csv?","depth":12,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Design new payment-logger and dsk-uploader hybrid app","depth":19,"bounds":{"left":0.55984044,"top":0.08060654,"width":0.099734046,"height":0.022346368},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Session history","depth":19,"bounds":{"left":0.9780585,"top":0.08060654,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"Session history","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New session","depth":19,"bounds":{"left":0.9886968,"top":0.08060654,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"New session","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Message actions","depth":24,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"payments.js","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"payments.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ets create a new app that should be combination of payment-logger and dsk-uploader. It should have authorization via authentik (auth folder). All three folders (payment-logger, dsk-uploader and auth) are just refference these will be removed later. Auth project is separated it lives on its own. First reveiw them and see how these should be combined. It will be whole new app (also the folder name). Think very carefully of whatr these two apps do and how cold they be combined. THerer should be common db and uploader should store data the same way the /ingest does. It should be properly marked in UI if it is upload or ingest or both. FIrst think of tech stack and plan carefully.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"I'll explore all three reference projects in parallel to understand their structure before planning.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore payment-logger app structure and functionality","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore the /volume2/docker/finance/payments-logger directory thoroughly. I need to understand:\n1. Tech stack (frontend framework, backend framework, database)\n2. What the app does - its core purpose and features\n3. Database schema - all tables, relationships\n4. API routes - all endpoints, their purpose and request/response shapes\n5. How data flows (ingest, storage, retrieval)\n6. Any auth/middleware setup\n7. Docker/deployment setup\n8. Key files and their roles\n\nReport with: directory structure, tech stack summary, database schema details, all API endpoints listed, UI features, and how data is ingested. Be thorough on the /ingest endpoint specifically.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore dsk-uploader app structure and functionality","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore the /volume2/docker/finance/dsk-uploader directory thoroughly. I need to understand:\n1. Tech stack (frontend framework, backend framework, database)\n2. What the app does - its core purpose and features\n3. Database schema - all tables, relationships\n4. API routes - all endpoints, their purpose and request/response shapes\n5. How file uploads work - what files, what format, how parsed\n6. Any auth/middleware setup\n7. Docker/deployment setup\n8. Key files and their roles\n\nReport with: directory structure, tech stack summary, database schema details, all API endpoints listed, UI features, how file upload parsing works, and what data is extracted from uploads. Be very thorough about the data model and what fields are stored.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore auth folder and authentik integration","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore the /volume2/docker/finance/auth directory thoroughly. I need to understand:\n1. What auth system is being used (Authentik)\n2. How authentication/authorization is implemented - OAuth2, OIDC, session tokens, JWT?\n3. Middleware - how is auth enforced on routes?\n4. Any frontend auth flow - login redirect, token handling, protected routes\n5. Environment variables related to auth\n6. Docker/deployment setup for the auth service itself\n7. Any example of how other apps integrate with this auth\n\nReport with: directory structure, auth flow description, middleware code, environment variable names, and integration patterns. This is a reference for building auth into a new combined app.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Message actions","depth":24,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"payments.js","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"payments.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"continue","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Launching parallel exploration of all three reference projects.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore payment-logger app structure","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore the /volume2/docker/finance/payments-logger directory thoroughly. I need to understand:\n1. Full directory structure (tree)\n2. Tech stack (frontend framework, backend framework, database, etc.)\n3. What the app does - its core functionality\n4. How data is ingested (look at /ingest route especially)\n5. Database schema (what tables/collections exist)\n6. API routes and their purposes\n7. Frontend pages and components\n8. Docker setup\n9. Any auth/session handling\n\nPlease read key files: package.json files, main entry points, route files, database schema files, docker-compose.yml, and any frontend components. Be thorough - I need a complete picture to plan a new combined app.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore dsk-uploader app structure","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore the /volume2/docker/finance/dsk-uploader directory thoroughly. I need to understand:\n1. Full directory structure (tree)\n2. Tech stack (frontend framework, backend framework, database, etc.)\n3. What the app does - its core functionality\n4. How file uploads work (what format, what processing happens)\n5. Database schema (what tables/collections exist)\n6. API routes and their purposes\n7. Frontend pages and components\n8. Docker setup\n9. Any auth/session handling\n\nPlease read key files: package.json files, main entry points, route files, database schema files, docker-compose.yml, and any frontend components. Be thorough - I need a complete picture to plan a new combined app.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore auth project structure","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore the /volume2/docker/finance/auth directory thoroughly. I need to understand:\n1. Full directory structure (tree)\n2. What authentication system is used (authentik integration details)\n3. How OAuth/OIDC flow works\n4. Any middleware or helper functions for protecting routes\n5. Session management approach\n6. How frontend handles auth state\n7. Any example of how other apps integrate with this auth system\n8. Docker setup and environment variables\n\nPlease read all files carefully - this auth system will be integrated into a new combined app. I need to understand exactly how to use it.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Now I have a complete picture of all three. Let me design the plan.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Design combined app architecture","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Design a detailed implementation plan for a new combined web app that merges two existing applications. Here is full context:\n\n---\n\n## App 1: payments-logger (Node.js)\n- **Purpose**: Ingest Bulgarian bank SMS → parse → store in PostgreSQL → review/tag/notify in React UI\n- **Stack**: Node.js 20 + Express + Prisma 5 + PostgreSQL 16 + React 18 + Vite + Tailwind CSS\n- **Auth**: Custom JWT (bcryptjs + jose), tokens in localStorage\n- **Ingest**: POST /api/payments/ingest (public) — SMS text OR structured JSON (Apple Wallet)\n- **Schema** (PostgreSQL via Prisma):\n - `payments` table: id, raw_message, date, type (POS/ATM/INTERNET/ECOM/P2P/WALLET), card, recipient, amount, balance, status (UNPROCESSED/SENT/SKIPPED), notifyPhone, notifiedAt, created_at, updated_at\n - `tags` table: id, name, color — M2M with payments via `_PaymentToTag`\n - `users` table: id, username, hashed_password (this will be REMOVED)\n- **UI**: Single-page React app — PaymentTable (sortable, filterable, taggable), FilterBar, status actions (send/skip), notification system\n- **Parser** (backend/src/parser.js): Regex parser for Bulgarian DSK Bank SMS, extracts date/time (DD/MM/YYYY HH:MM), card mask, transaction type, recipient, amount, balance\n\n## App 2: dsk-uploader (Python/Flask)\n- **Purpose**: Upload DSK bank CSV exports → parse/normalize → upload to Notion database\n- **Stack**: Python 3.11 + Flask + Pandas + Custom Notion SDK + Bootstrap 5\n- **Auth**: None (open)\n- **CSV format** (DSK Bank Bulgarian format, columns):\n - `Дата` (date, DD.MM.YYYY)\n - `Вид на трансакцията` (transaction type, Bulgarian)\n - `Основание` (reason/description — contains card number regex: `^\\d{6}x{6}\\d{4}$`)\n - `Дебит BGN` (debit amount, may be empty)\n - `Кредит BGN` (credit amount, may be empty)\n - `Наредител/Получател` (orderer/recipient name)\n - `Номер сметка на наредителя / получателя` (account number)\n- **Processing**: merge multiple CSVs, normalize dates, extract card numbers from reason via regex, auto-generate tags (keyword heuristics: ЗАПЛАТА→Salary, NETFLIX→Subscriptions, etc.), filter internal transfers\n- **Output**: Notion database pages (this will be REPLACED with local PostgreSQL)\n\n## App 3: auth (Authentik)\n- **Mode**: Proxy mode via NPM (forward auth)\n- **How it works**: NPM intercepts all requests, calls Authentik outpost's auth endpoint. On success, NPM injects headers into proxied request:\n - `X-authentik-username` \n - `X-authentik-email`\n - `X-authentik-groups`\n- **No code integration needed** in the app itself — just trust these headers from NPM\n- **Logout**: Redirect user to `/outpost.goauthentik.io/sign_out`\n\n---\n\n## What the New Combined App Must Do\n\n1. **Single PostgreSQL database** for all transactions\n2. **SMS Ingest** (public endpoint) — same as payments-logger /ingest, source=INGEST\n3. **CSV Upload** (authenticated) — parse DSK CSV files, store transactions with source=UPLOAD into the same DB schema\n4. **Unified UI** — show all payments in one table regardless of source\n5. **Source indicator** in UI — badge showing \"INGEST\", \"UPLOAD\", or \"BOTH\" (if duplicate detection added)\n6. **Source filter** in FilterBar — filter by All/Ingest/Upload\n7. **Authentik auth** — remove custom JWT entirely; trust X-authentik-* headers from NPM\n8. **All existing payments-logger features**: tagging, send notification, skip, status tracking, filters, sorting, pagination\n9. **Remove Notion dependency entirely** — all data stays in local PostgreSQL\n\n---\n\n## Technical Constraints\n\n- Keep Node.js backend (not Python) — extend payments-logger's stack\n- CSV parsing: use `csv-parse` npm package (handles encoding, streaming)\n- File upload: use `multer` npm middleware\n- Auth middleware: read X-authentik-username header, 401 if missing (but /api/payments/ingest stays public)\n- Add `source` enum field (INGEST/UPLOAD) to payments schema\n- Add `currency` field (EUR for SMS ingest, BGN for CSV uploads) — or just store as-is\n- Remove `users` table from schema\n\n---\n\n## Please Design\n\n1. Complete folder structure for the new app (suggest name: \"finance-hub\" or similar — note this is a placeholder, user will confirm)\n2. Prisma schema with new fields (`source`, `currency`)\n3. All backend API routes\n4. CSV parser design in Node.js (port of the Python logic)\n5. Authentik auth middleware\n6. Frontend component structure (React) — what's reused from payments-logger, what's new\n7. Docker Compose setup\n8. Environment variables needed\n9. Step-by-step implementation order\n10. Verification checklist\n\nBe specific about file paths and code structure. This will be used to write actual implementation code.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Good plan. Let me ask the one thing I need before writing the final plan.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AskUserQuestion","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"OUT","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"User has answered your questions: \"What should the new combined app be called? This will be the folder name under /volume2/docker/finance/ and the app branding.\"=\"finance-hub\". You can now continue with the user's answers in mind.","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Writing the final plan now.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"ets-create-a-new-generic-sun.md","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"ets-create-a-new-generic-sun.md","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"326 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"# finance-hub — Implementation Plan\n\n## Context\n\nTwo separate finance apps exist as references and will be retired:\n- **payments-logger** (Node.js/React): Ingests Bulgarian bank SMS notifications, stores payments in PostgreSQL, provides a review/tag/notify UI.\n- **dsk-uploader** (Python/Flask): Uploads DSK bank CSV exports, parses them, sends to Notion.\n\nThe new app **finance-hub** (`/volume2/docker/finance/finance-hub/`) replaces both with a single unified system: all transactions (SMS-ingested and CSV-uploaded) land in one PostgreSQL database and one React UI. Authentication is delegated entirely to Authentik (proxy mode via NPM — no custom JWT).\n\n---\n\n## Tech Stack\n\n| Layer | Choice | Rationale |\n|-------|--------|-----------|\n| Backend | Node.js 20 + Express + Prisma 5 | Extends payments-logger; no Python needed |\n| CSV parsing | `csv-parse` + `iconv-lite` | Handles Bulgarian cp1251 encoding, RFC4180 quoted fields |\n| File upload | `multer` (memory storage) | Bank CSVs are small (<500 KB), no disk cleanup needed |\n| Database | PostgreSQL 16 | Same as payments-logger |\n| Frontend | React 18 + Vite + Tailwind CSS + Lucide React | Same as payments-logger |\n| Auth | Authentik proxy via NPM headers | No custom JWT; removes users table entirely |\n| Container | Docker Compose | Same pattern as both reference apps |\n\n**Removed vs payments-logger:** `bcryptjs`, `jose`, `users` table, login form, JWT storage. \n**Removed vs dsk-uploader:** Python/Flask, Pandas, Notion SDK, all Notion references. \n**Added:** `csv-parse`, `iconv-lite`, `multer`, `source` + `currency` fields, `UploadPanel` component.\n\n---\n\n## Folder Structure\n\n```\n/volume2/docker/finance/finance-hub/\n├── docker-compose.yml\n├── .env\n├── .env.example\n├── .gitignore\n├── backend/\n│ ├── Dockerfile\n│ ├── package.json\n│ ├── prisma/\n│ │ ├── schema.prisma\n│ │ └── migrations/\n│ │ ├── migration_lock.toml\n│ │ └── 20260508_init/\n│ │ └── migration.sql\n│ └── src/\n│ ├── index.js ← entry point (Authentik middleware wired here)\n│ ├── auth.js ← Authentik header middleware (replaces JWT auth)\n│ ├── parser.js ← SMS parser (copy verbatim from payments-logger)\n│ ├── csvParser.js ← NEW: DSK CSV parser (port of Python dskuploader.py)\n│ └── routes/\n│ ├── payments.js ← existing routes + source/currency additions\n│ └── upload.js ← NEW: POST /api/upload/csv\n└── frontend/\n ├── Dockerfile\n ├── package.json\n ├── vite.config.js\n ├── tailwind.config.js\n ├── postcss.config.js\n ├── index.html\n └── src/\n ├── main.jsx ← remove AuthProvider wrapper\n ├── index.css\n ├── App.jsx ← remove auth state, add Upload tab toggle\n └── components/\n ├── FilterBar.jsx ← add source filter select\n ├── PaymentTable.jsx ← add Source badge column + currency display\n ├── PaymentCard.jsx ← minor source badge addition\n ├── PaymentList.jsx ← unchanged\n └── UploadPanel.jsx ← NEW: drag-and-drop CSV upload UI\n```\n\n---\n\n## Database Schema (Prisma)\n\nFile: `backend/prisma/schema.prisma`\n\n```prisma\ngenerator client {\n provider = \"prisma-client-js\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_URL\")\n}\n\nmodel Payment {\n id Int @id @default(autoincrement())\n rawMessage String @map(\"raw_message\")\n date DateTime?\n type String?\n card String?\n recipient String?\n amount Float?\n currency String? @default(\"EUR\")\n balance Float?\n source Source @default(INGEST)\n status Status @default(UNPROCESSED)\n tags Tag[]\n notifiedAt DateTime? @map(\"notified_at\")\n notifyPhone String? @map(\"notify_phone\")\n debitBgn Float? @map(\"debit_bgn\")\n creditBgn Float? @map(\"credit_bgn\")\n transactionType String? @map(\"transaction_type\")\n payerAccount String? @map(\"payer_account\")\n createdAt DateTime @default(now()) @map(\"created_at\")\n updatedAt DateTime @updatedAt @map(\"updated_at\")\n\n @@map(\"payments\")\n}\n\nmodel Tag {\n id Int @id @default(autoincrement())\n name String @unique\n color String @default(\"#6b7280\")\n payments Payment[]\n\n @@map(\"tags\")\n}\n\nenum Status { UNPROCESSED SENT SKIPPED }\nenum Source { INGEST UPLOAD }\n```\n\n**Key decisions:**\n- No `User` model — Authentik owns identity.\n- `currency`: `EUR` for SMS ingest, `BGN` for CSV uploads.\n- `debitBgn`, `creditBgn`, `transactionType`, `payerAccount`: nullable CSV-only columns; INGEST rows store nulls. Avoids a union query for the unified list view.\n- `balance` is always null for CSV rows (DSK export does not include running balance).\n- Fresh consolidated migration — no data migration from reference apps required.\n\n---\n\n## API Routes\n\n| Method | Path | Auth | Description |\n|--------|------|------|-------------|\n| GET | /api/health | public | Health check |\n| POST | /api/payments/ingest | public | SMS or structured ingest (source=INGEST) |\n| GET | /api/payments | required | List with filters/sort/pagination (+ source filter) |\n| GET | /api/payments/meta/tags | required | All tags |\n| GET | /api/payments/meta/filters | required | Filter options incl. `sources` array |\n| GET | /api/payments/:id | required | Single payment |\n| PATCH | /api/payments/:id | required | Update status |\n| DELETE | /api/payments/:id | required | Delete |\n| POST | /api/payments/:id/send | required | Send notification |\n| POST | /api/payments/:id/skip | required | Skip |\n| POST | /api/payments/:id/tags | required | Add/upsert tag |\n| DELETE | /api/payments/:id/tags/:tagId | required | Remove tag |\n| POST | /api/upload/csv | required | DSK CSV file upload (source=UPLOAD) |\n\n---\n\n## Key Implementation Details\n\n### auth.js (replaces entire old auth module)\n```js\nconst PUBLIC_PATHS = new Set(['/api/health', '/api/payments/ingest']);\n\nfunction authentikMiddleware(req, res, next) {\n if (PUBLIC_PATHS.has(req.path)) return next();\n const username = req.headers['x-authentik-username'];\n if (!username) return res.status(401).json({ error: 'Unauthorized' });\n req.user = {\n username,\n email: req.headers['x-authentik-email'] || null,\n groups: (req.headers['x-authentik-groups'] || '').split(',').map(g => g.trim()).filter(Boolean),\n };\n next();\n}\nmodule.exports = { authentikMiddleware };\n```\n\n### csvParser.js (port of dskuploader.py)\n- `iconv-lite` decodes buffer as cp1251 (DSK Bank export encoding), falls back to UTF-8\n- `csv-parse` parses the decoded text with `columns: true`\n- Columns: `Дата`, `Вид на трансакцията`, `Основание`, `Дебит BGN`, `Кредит BGN`, `Наредител/Получател`, `Номер сметка на наредителя / получателя`\n- Card extraction: regex `/^\\d{6}x{6}\\d{4}$/` on first token of `Основание`\n- Skips rows where `Вид на трансакцията === 'ТРАНСФЕР СОБСТВЕНИ СМЕТКИ'`\n- Auto-tags via keyword rules (ЗАПЛАТА→Salary, LIDL→Groceries, NETFLIX→Subscriptions, etc.) — same logic as Python `generate_tags()`\n- Returns `{ rows: PaymentData[], skipped: number, errors: string[] }`\n\n### payments.js changes from payments-logger\n1. Add `source: 'INGEST'` and `currency` to the `/ingest` create call\n2. Add `source` to the `GET /` where clause filter\n3. Add `sources` to `meta/filters` response\n4. Currency-aware amount formatting in notification message\n5. Remove all JWT/auth references (no `/auth/register`, `/auth/login`)\n\n### upload.js (new)\n- `multer` memory storage, max 10 files × 10 MB\n- Calls `parseDskCsv(buffer)` per file\n- Upserts tags via `prisma.tag.upsert` then connects\n- Returns `{ imported, skipped, errors, payments[] }`\n\n### Frontend changes\n- **Delete**: `auth.js`, `AuthProvider.jsx`\n- **main.jsx**: Remove `<AuthProvider>` wrapper\n- **App.jsx**: Replace `authFetch` with plain `fetch` (Authentik session cookie travels automatically); logout → `window.location.href = '/outpost.goauthentik.io/sign_out'`; add \"Payments\" / \"Upload CSV\" tab toggle\n- **FilterBar.jsx**: Add source `<select>` (All / SMS Ingest / CSV Upload); widen grid to 5 cols\n- **PaymentTable.jsx**: Add `Source` column with `SMS` (indigo) / `CSV` (emerald) badge; show `${amount} ${currency}` in amount cell\n- **UploadPanel.jsx** (new): Drag-and-drop zone + file list + import button + result summary with error accordion; calls `POST /api/upload/csv` with `FormData`\n\n---\n\n## Docker Compose\n\n```yaml\nservices:\n db:\n image: postgres:16-alpine\n environment: { POSTGRES_USER: finance, POSTGRES_PASSWORD: ${DB_PASSWORD}, POSTGRES_DB: finance_hub }\n volumes: [pgdata:/var/lib/postgresql/data]\n healthcheck: { test: pg_isready -U finance -d finance_hub, interval: 5s }\n\n backend:\n build: ./backend\n environment:\n DATABASE_URL: postgresql://finance:${DB_PASSWORD}@db:5432/finance_hub\n PORT: \"3001\"\n NOTIFIER_URL: ${NOTIFIER_URL}\n NOTIFIER_CHANNEL: ${NOTIFIER_CHANNEL:-viber}\n NOTIFY_DEFAULT_PHONE: ${NOTIFY_DEFAULT_PHONE}\n TZ: ${TZ:-Europe/Sofia}\n ports: [\"${BACKEND_PORT:-3001}:3001\"]\n depends_on: { db: { condition: service_healthy } }\n\n frontend:\n build: ./frontend\n ports: [\"${FRONTEND_PORT:-5175}:5173\"]\n depends_on: [backend]\n\nvolumes: { pgdata: }\n```\n\n**NPM setup:** Frontend port proxied through Authentik forward auth. Backend port exposed separately (unprotected) so the public `/api/payments/ingest` remains reachable by iOS Shortcuts / SMS gateways without login.\n\n---\n\n## Environment Variables (.env)\n\n```bash\nDB_PASSWORD=change_me\nNOTIFIER_URL=https://notifier.lakylak.xyz\nNOTIFIER_CHANNEL=viber\nNOTIFY_DEFAULT_PHONE=+359000000000\nTZ=Europe/Sofia\nBACKEND_PORT=3001\nFRONTEND_PORT=5175\n```\n\nRemoved vs payments-logger: `JWT_SECRET`, `JWT_EXPIRE_MINUTES`.\n\n---\n\n## Implementation Order\n\n1. Create folder structure and write `docker-compose.yml`, `.env.example`, `.gitignore`\n2. Write `backend/prisma/schema.prisma` and migration SQL\n3. Write `backend/package.json` (add `csv-parse`, `iconv-lite`, `multer`; remove `bcryptjs`, `jose`)\n4. Write `backend/Dockerfile`\n5. Write `backend/src/auth.js` (Authentik middleware)\n6. Copy `backend/src/parser.js` verbatim from payments-logger\n7. Write `backend/src/csvParser.js` (Python port)\n8. Write `backend/src/routes/upload.js`\n9. Write `backend/src/routes/payments.js` (from payments-logger + 5 changes listed above)\n10. Write `backend/src/index.js`\n11. Copy frontend base from payments-logger; delete `auth.js` + `AuthProvider.jsx`\n12. Update `main.jsx`, `App.jsx`, `FilterBar.jsx`, `PaymentTable.jsx`\n13. Write `frontend/src/components/UploadPanel.jsx`\n14. Update `frontend/vite.config.js`\n15. `docker compose build && docker compose up -d`\n16. Run verification checklist\n\n---\n\n## Verification\n\n**Schema**\n- `payments` table has `source`, `currency`, `debit_bgn`, `credit_bgn`, `transaction_type`, `payer_account`\n- No `users` table; `Source` enum exists\n\n**Auth**\n- `GET /api/payments` → 401 without `x-authentik-username` header\n- `POST /api/payments/ingest` → 201 without any header\n- `curl -H \"x-authentik-username: test\" localhost:3001/api/payments` → 200\n\n**SMS Ingest**\n- DSK POS SMS → `source=INGEST`, `currency=EUR`, correct amount/card/recipient\n- Apple Wallet structured body → `type=WALLET`, `source=INGEST`\n- Rate limiter → 429 after 200 req/min\n\n**CSV Upload**\n- Single DSK CSV → rows with `source=UPLOAD`, `currency=BGN`\n- Multiple CSVs in one request → all merged\n- `ТРАНСФЕР СОБСТВЕНИ СМЕТКИ` rows counted in `skipped`, not imported\n- Card regex match from `Основание` column\n- Auto-tags applied (ЗАПЛАТА→Salary, LIDL→Groceries)\n- cp1251 file imports correctly\n\n**UI**\n- Source badge visible in payment table (SMS indigo, CSV emerald)\n- Source dropdown in FilterBar filters correctly\n- Amount shows correct currency per row\n- Upload Panel: drag-and-drop works, result summary shows counts\n- Logout redirects to Authentik sign_out\n- No login form shown (Authentik handles it at NPM level)\n- Tags, send, skip, delete all still work\n\n## Reference Files\n\n- `/volume2/docker/finance/payments-logger/backend/src/routes/payments.js`\n- `/volume2/docker/finance/payments-logger/backend/src/parser.js`\n- `/volume2/docker/finance/payments-logger/backend/src/index.js`\n- `/volume2/docker/finance/payments-logger/backend/src/auth.js`\n- `/volume2/docker/finance/payments-logger/backend/prisma/schema.prisma`\n- `/volume2/docker/finance/payments-logger/frontend/src/App.jsx`\n- `/volume2/docker/finance/payments-logger/frontend/src/components/PaymentTable.jsx`\n- `/volume2/docker/finance/payments-logger/frontend/src/components/FilterBar.jsx`\n- `/volume2/docker/finance/dsk-uploader/dskuploader.py`\n- `/volume2/docker/finance/auth/docker-compose.yml`","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Claude’s Plan","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"ets-create-a-new-generic-sun.md","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"ets-create-a-new-generic-sun.md","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Stayed in plan mode","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Good question. Here's the full breakdown:","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Backend Tech Stack — Options","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Backend Tech Stack — Options","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Option A: Node.js + Express + Prisma (my recommendation)","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Option A: Node.js + Express + Prisma (my recommendation)","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Why:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"payments-logger is already Node.js/Express/Prisma. The new app is 80% payments-logger with CSV upload added on top. Keeping the same stack means:","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Copy","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"parser.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"verbatim, zero rewrite","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Copy the entire","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"routes/payments.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"with minimal edits","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Same Prisma schema workflow, same migrations, same Docker image","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The CSV parsing logic (the only Python-specific thing) ports cleanly to","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"csv-parse","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— it's just regex + string manipulation, nothing pandas-specific","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Trade-off:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Have to port the Python CSV parsing to JS. It's ~150 lines and mostly string manipulation — straightforward.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Option B: Python + FastAPI + SQLAlchemy","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Option B: Python + FastAPI + SQLAlchemy","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Rewrite everything in Python. dsk-uploader is Python, so CSV parsing is already done.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Pro:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Keep the dsk-uploader CSV logic as-is (no porting). Python has better data science libraries if you later add analytics.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Con:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Lose the entire payments-logger backend (routes, parser, Prisma schema) — full rewrite. FastAPI + SQLAlchemy is a different mental model than Express + Prisma. Frontend stays React anyway, so the stack split doesn't simplify anything.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Verdict:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"More work overall, gains almost nothing.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Option C: Hybrid microservices (Node.js backend + Python CSV service)","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Option C: Hybrid microservices (Node.js backend + Python CSV service)","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Keep Node.js as the main API, add a separate Python FastAPI service just for CSV parsing. They share the DB.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Pro:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Zero porting — Python CSV code used as-is.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Con:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Two backend services to maintain, deploy, and keep in sync. Inter-service HTTP calls. Two Dockerfiles. For ~150 lines of CSV logic, this is massively over-engineered.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Verdict:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Not worth it.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Option D: Python + Flask (exactly like dsk-uploader)","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Option D: Python + Flask (exactly like dsk-uploader)","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Extend dsk-uploader into a full payments app.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Pro:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Pandas for CSV, no porting.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Con:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Jinja2 templates instead of React (or add React separately). Would need to reimplement the entire payments-logger (SMS parser, notification system, tag management, pagination/filtering). Flask's Jinja templating is far less capable than the existing React UI. The React frontend is the stronger UI foundation.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Verdict:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Worst of all options — rebuild the harder parts (UI, SMS parser, notification) for no gain.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Summary","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Summary","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Option","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CSV porting effort","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"App rewrite effort","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Result quality","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"A (Node.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Medium (150 lines)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Minimal","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Best","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"B (Python FastAPI)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"None","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"High (full backend)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Worse","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"C (Hybrid)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"None","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Low + infra overhead","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Overkill","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"D (Python Flask)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"None","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Very high","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Worst","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Option","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"A (Node.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"B (Python FastAPI)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"C (Hybrid)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"D (Python Flask)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CSV porting effort","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Medium (150 lines)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"None","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"None","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"None","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"App rewrite effort","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Minimal","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"High (full backend)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Low + infra overhead","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Very high","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Result quality","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Best","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Worse","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Overkill","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Worst","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Option","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CSV porting effort","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"App rewrite effort","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Result quality","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The CSV parser port (the only cost of Option A) is a one-time ~150 line exercise. Everything else in the plan reuses payments-logger code directly. That's why Node.js is the clear winner here.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Want to adjust the stack, or shall I proceed with Option A?","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Message actions","depth":24,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"ok sounds good. Implement all you suggested","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Starting implementation. Let me first read all the reference files I'll need to copy from.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"parser.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"parser.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"payments.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"payments.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":",","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"index.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"index.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"App.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"App.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"FilterBar.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"FilterBar.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"PaymentTable.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"PaymentTable.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Now let me read the remaining frontend files and the Dockerfile from payments-logger.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"main.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"main.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"index.css","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"index.css","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"package.json","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"package.json","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Dockerfile","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Dockerfile","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Dockerfile","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Dockerfile","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"vite.config.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"vite.config.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"tailwind.config.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"tailwind.config.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"postcss.config.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"postcss.config.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"index.html","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"index.html","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"dskuploader.py","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"dskuploader.py","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Let me also grab the remaining frontend components.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"PaymentCard.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"PaymentCard.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"PaymentList.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"PaymentList.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"schema.prisma","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"schema.prisma","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Good, I have everything I need. Let me set up the todo list and start building.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Bash","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create finance-hub directory structure","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"mkdir -p /volume2/docker/finance/finance-hub/backend/src/routes \\\n /volume2/docker/finance/finance-hub/backend/prisma/migrations/20260508_init \\\n /volume2/docker/finance/finance-hub/frontend/src/components && echo \"done\"","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy code to clipboard","depth":24,"on_screen":false,"help_text":"Copy code","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"OUT","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"done","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"docker-compose.yml","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"docker-compose.yml","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"45 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"version: '3.8'\n\nservices:\n db:\n image: postgres:16-alpine\n restart: unless-stopped\n environment:\n POSTGRES_USER: finance\n POSTGRES_PASSWORD: ${DB_PASSWORD}\n POSTGRES_DB: finance_hub\n volumes:\n - pgdata:/var/lib/postgresql/data\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -U finance -d finance_hub\"]\n interval: 5s\n timeout: 5s\n retries: 5\n\n backend:\n build: ./backend\n restart: unless-stopped\n environment:\n DATABASE_URL: postgresql://finance:${DB_PASSWORD}@db:5432/finance_hub\n PORT: \"3001\"\n NOTIFIER_URL: ${NOTIFIER_URL}\n NOTIFIER_CHANNEL: ${NOTIFIER_CHANNEL:-viber}\n NOTIFY_DEFAULT_PHONE: ${NOTIFY_DEFAULT_PHONE}\n TZ: ${TZ:-Europe/Sofia}\n ports:\n - \"${BACKEND_PORT:-3001}:3001\"\n depends_on:\n db:\n condition: service_healthy\n\n frontend:\n build: ./frontend\n restart: unless-stopped\n ports:\n - \"${FRONTEND_PORT:-5175}:5173\"\n depends_on:\n - backend\n\nvolumes:\n pgdata:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":".env.example","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":".env.example","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"15 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"# Database\nDB_PASSWORD=change_me_strong_password\n\n# Notifier service (for SMS payment notifications)\nNOTIFIER_URL=https://notifier.lakylak.xyz\nNOTIFIER_CHANNEL=viber\nNOTIFY_DEFAULT_PHONE=+359000000000\n\n# Timezone (used by SMS parser for Bulgarian bank timestamps)\nTZ=Europe/Sofia\n\n# Ports (optional — defaults shown)\nBACKEND_PORT=3001\nFRONTEND_PORT=5175","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":".gitignore","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":".gitignore","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"5 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".env\nnode_modules/\ndist/\n*.log","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"schema.prisma","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"schema.prisma","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"54 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"generator client {\n provider = \"prisma-client-js\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_URL\")\n}\n\nmodel Payment {\n id Int @id @default(autoincrement())\n rawMessage String @map(\"raw_message\")\n date DateTime?\n type String?\n card String?\n recipient String?\n amount Float?\n currency String? @default(\"EUR\")\n balance Float?\n source Source @default(INGEST)\n status Status @default(UNPROCESSED)\n tags Tag[]\n notifiedAt DateTime? @map(\"notified_at\")\n notifyPhone String? @map(\"notify_phone\")\n debitBgn Float? @map(\"debit_bgn\")\n creditBgn Float? @map(\"credit_bgn\")\n transactionType String? @map(\"transaction_type\")\n payerAccount String? @map(\"payer_account\")\n createdAt DateTime @default(now()) @map(\"created_at\")\n updatedAt DateTime @updatedAt @map(\"updated_at\")\n\n @@map(\"payments\")\n}\n\nmodel Tag {\n id Int @id @default(autoincrement())\n name String @unique\n color String @default(\"#6b7280\")\n payments Payment[]\n\n @@map(\"tags\")\n}\n\nenum Status {\n UNPROCESSED\n SENT\n SKIPPED\n}\n\nenum Source {\n INGEST\n UPLOAD\n}","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"migration.sql","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"migration.sql","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"55 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"-- CreateEnum\nCREATE TYPE \"Status\" AS ENUM ('UNPROCESSED', 'SENT', 'SKIPPED');\nCREATE TYPE \"Source\" AS ENUM ('INGEST', 'UPLOAD');\n\n-- CreateTable\nCREATE TABLE \"payments\" (\n \"id\" SERIAL PRIMARY KEY,\n \"raw_message\" TEXT NOT NULL,\n \"date\" TIMESTAMP(3),\n \"type\" TEXT,\n \"card\" TEXT,\n \"recipient\" TEXT,\n \"amount\" DOUBLE PRECISION,\n \"currency\" TEXT DEFAULT 'EUR',\n \"balance\" DOUBLE PRECISION,\n \"source\" \"Source\" NOT NULL DEFAULT 'INGEST',\n \"status\" \"Status\" NOT NULL DEFAULT 'UNPROCESSED',\n \"notified_at\" TIMESTAMP(3),\n \"notify_phone\" TEXT,\n \"debit_bgn\" DOUBLE PRECISION,\n \"credit_bgn\" DOUBLE PRECISION,\n \"transaction_type\" TEXT,\n \"payer_account\" TEXT,\n \"created_at\" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,\n \"updated_at\" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP\n);\n\n-- CreateTable\nCREATE TABLE \"tags\" (\n \"id\" SERIAL PRIMARY KEY,\n \"name\" TEXT NOT NULL,\n \"color\" TEXT NOT NULL DEFAULT '#6b7280'\n);\n\n-- CreateUniqueIndex\nCREATE UNIQUE INDEX \"tags_name_key\" ON \"tags\"(\"name\");\n\n-- CreateTable (M2M join)\nCREATE TABLE \"_PaymentToTag\" (\n \"A\" INTEGER NOT NULL,\n \"B\" INTEGER NOT NULL,\n CONSTRAINT \"_PaymentToTag_AB_pkey\" PRIMARY KEY (\"A\", \"B\")\n);\n\nCREATE INDEX \"_PaymentToTag_B_index\" ON \"_PaymentToTag\"(\"B\");\n\n-- AddForeignKey\nALTER TABLE \"_PaymentToTag\"\n ADD CONSTRAINT \"_PaymentToTag_A_fkey\"\n FOREIGN KEY (\"A\") REFERENCES \"payments\"(\"id\") ON DELETE CASCADE ON UPDATE CASCADE;\n\nALTER TABLE \"_PaymentToTag\"\n ADD CONSTRAINT \"_PaymentToTag_B_fkey\"\n FOREIGN KEY (\"B\") REFERENCES \"tags\"(\"id\") ON DELETE CASCADE ON UPDATE CASCADE;","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"migration_lock.toml","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"migration_lock.toml","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"4 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"# Please do not edit this file manually\n# It should be added in your version-control system (e.g., Git)\nprovider = \"postgresql\"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"package.json","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"package.json","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"26 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"{\n \"name\": \"finance-hub-backend\",\n \"version\": \"1.0.0\",\n \"main\": \"src/index.js\",\n \"scripts\": {\n \"start\": \"node src/index.js\",\n \"dev\": \"nodemon src/index.js\",\n \"prisma:generate\": \"prisma generate\",\n \"prisma:migrate\": \"prisma migrate deploy\"\n },\n \"dependencies\": {\n \"@prisma/client\": \"^5.22.0\",\n \"cors\": \"^2.8.5\",\n \"csv-parse\": \"^5.5.6\",\n \"express\": \"^4.21.1\",\n \"express-rate-limit\": \"^7.4.0\",\n \"iconv-lite\": \"^0.6.3\",\n \"morgan\": \"^1.10.0\",\n \"multer\": \"^1.4.5-lts.1\"\n },\n \"devDependencies\": {\n \"nodemon\": \"^3.1.7\",\n \"prisma\": \"^5.22.0\"\n }\n}","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Dockerfile","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Dockerfile","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"18 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FROM node:20-alpine\n\nRUN apk add --no-cache openssl\n\nWORKDIR /app\n\nCOPY package.json package-lock.json* ./\nRUN npm install\n\nCOPY prisma ./prisma\nRUN npx prisma generate\n\nCOPY src ./src\n\nEXPOSE 3001\n\nCMD [\"sh\", \"-c\", \"npx prisma migrate deploy && node src/index.js\"]","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"auth.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"auth.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"27 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"const PUBLIC_PATHS = new Set([\n '/api/health',\n '/api/payments/ingest',\n]);\n\nfunction authentikMiddleware(req, res, next) {\n if (PUBLIC_PATHS.has(req.path)) return next();\n\n const username = req.headers['x-authentik-username'];\n if (!username) {\n return res.status(401).json({ error: 'Unauthorized — missing Authentik session' });\n }\n\n req.user = {\n username,\n email: req.headers['x-authentik-email'] || null,\n groups: (req.headers['x-authentik-groups'] || '')\n .split(',')\n .map(g => g.trim())\n .filter(Boolean),\n };\n\n next();\n}\n\nmodule.exports = { authentikMiddleware };","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"parser.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"parser.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"104 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/**\n * Parses SMS payment messages from Bulgarian banks (DSK Bank, etc.)\n *\n * Supported formats:\n *\n * POS / INTERNET / ECOM / P2P payment:\n * DSK Bank. Na DD/MM/YYYY v HH:MM sa plateni AMOUNT CURRENCY s karta CARD na POS s adres: RECIPIENT. Nalichni: BALANCE CURRENCY.\n *\n * ATM withdrawal:\n * DSK Bank. Na DD/MM/YYYY v HH:MM sa iztegleni AMOUNT CURRENCY s karta CARD ot ATM s adres: RECIPIENT. Nalichni: BALANCE CURRENCY.\n *\n * ATM utility payment (amount may include fee as AMOUNT/FEE):\n * DSK Bank. Na DD/MM/YYYY v HH:MM sa plateni AMOUNT CURRENCY/FEE CURRENCY s karta CARD na ATM s adres:RECIPIENT. Nalichni: BALANCE CURRENCY.\n */\n\nconst LOCAL_TZ = process.env.TZ || 'Europe/Sofia';\n\n/**\n * Convert a local-timezone date/time to a UTC Date object.\n * Uses Intl to resolve the actual UTC offset (DST-aware).\n */\nfunction localToUtc(year, month, day, hour, minute) {\n const naive = new Date(Date.UTC(year, month - 1, day, hour, minute, 0));\n\n const formatter = new Intl.DateTimeFormat('en-US', {\n timeZone: LOCAL_TZ,\n year: 'numeric', month: '2-digit', day: '2-digit',\n hour: '2-digit', minute: '2-digit', second: '2-digit',\n hour12: false,\n });\n\n const parts = {};\n formatter.formatToParts(naive).forEach(p => { parts[p.type] = p.value; });\n\n const localAtNaive = new Date(Date.UTC(\n parseInt(parts.year), parseInt(parts.month) - 1, parseInt(parts.day),\n parseInt(parts.hour) % 24, parseInt(parts.minute), parseInt(parts.second),\n ));\n\n const offsetMs = localAtNaive.getTime() - naive.getTime();\n return new Date(Date.UTC(year, month - 1, day, hour, minute, 0) - offsetMs);\n}\n\nfunction parsePaymentSms(message) {\n const result = {\n rawMessage: message,\n date: null,\n type: null,\n card: null,\n recipient: null,\n amount: null,\n balance: null,\n };\n\n // Date and time: \"Na DD/MM/YYYY v HH:MM\"\n const dateMatch = message.match(/Na (\\d{2})\\/(\\d{2})\\/(\\d{4}) v (\\d{2}):(\\d{2})/i);\n if (dateMatch) {\n const [, day, month, year, hour, minute] = dateMatch;\n result.date = localToUtc(\n parseInt(year), parseInt(month), parseInt(day),\n parseInt(hour), parseInt(minute),\n );\n }\n\n // Card mask: \"s karta 400915***4447\" or \"s karta 483890***7162\"\n const cardMatch = message.match(/s karta\\s+([\\d*]+)/i);\n if (cardMatch) {\n result.card = cardMatch[1];\n }\n\n // Transaction type: supports both prepositions\n // \"na POS\" / \"na ATM\" / \"na INTERNET\" etc. (payment)\n // \"ot ATM\" (withdrawal)\n const typeMatch = message.match(/(?:na|ot)\\s+(POS|ATM|INTERNET|ECOM|P2P)\\b/i);\n if (typeMatch) {\n result.type = typeMatch[1].toUpperCase();\n }\n\n // Recipient address: \"s adres: MERCHANT\" or \"s adres:MERCHANT\" (no space variant)\n const recipientMatch = message.match(/s adres:\\s*([^.]+)\\./i);\n if (recipientMatch) {\n result.recipient = recipientMatch[1].trim();\n }\n\n // Amount: handles both verbs and the AMOUNT/FEE suffix format\n // \"sa plateni 7.78 EUR\"\n // \"sa iztegleni 400.00 EUR\"\n // \"sa plateni 0.50 EUR/0.50 EUR\" → captures 0.50 (the charged amount, ignoring fee)\n const amountMatch = message.match(/sa (?:plateni|iztegleni)\\s+([\\d.,]+)\\s+[A-Z]{3}/i);\n if (amountMatch) {\n result.amount = parseFloat(amountMatch[1].replace(',', '.'));\n }\n\n // Balance: \"Nalichni: 2583.07 EUR.\"\n const balanceMatch = message.match(/Nalichni:\\s*([\\d.,]+)\\s+[A-Z]{3}/i);\n if (balanceMatch) {\n result.balance = parseFloat(balanceMatch[1].replace(',', '.'));\n }\n\n return result;\n}\n\nmodule.exports = { parsePaymentSms };","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"csvParser.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"csvParser.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"175 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/**\n * DSK Bank CSV parser — Node.js port of dskuploader.py\n *\n * DSK Bank exports use Windows-1251 (cp1251) encoding.\n * Each row maps to a Payment record with source=UPLOAD, currency=BGN.\n */\n\nconst { parse } = require('csv-parse');\nconst iconv = require('iconv-lite');\n\nconst SKIP_TYPE = 'ТРАНСФЕР СОБСТВЕНИ СМЕТКИ';\nconst CARD_REGEX = /^\\d{6}x{6}\\d{4}$/;\nconst POS_REGEX = /^\\s*ПЛАЩАНЕ\\s+НА\\s+ПОС\\s+\\d{2}\\.\\d{2}\\.\\d{4}\\s+\\d{2}:\\d{2}/;\n\nconst COL = {\n DATE: 'Дата',\n TYPE: 'Вид на трансакцията',\n REASON: 'Основание',\n DEBIT: 'Дебит BGN',\n CREDIT: 'Кредит BGN',\n PAYEE: 'Наредител/Получател',\n ACCT: 'Номер сметка на наредителя / получателя',\n};\n\nconst TAG_RULES = [\n ['reason', 'ЗАПЛАТА', 'Salary'],\n ['reason', 'ТЕГЛЕНЕ НА ATM', 'ATM'],\n ['reason', 'ПЛАЩАНЕ ПО ЗАЕМ', 'Home Credit'],\n ['reason', 'АВТ.ТАКСА ОБСЛУЖВАНЕ', 'Bills'],\n ['transactionType', 'КОМУНАЛНИ УСЛУГИ', 'Bills'],\n ['payee', 'VIVACOM', 'Subscriptions'],\n ['payee', 'Google', 'Subscriptions'],\n ['payee', 'SkyShowtime', 'Subscriptions'],\n ['payee', 'NETFLIX', 'Subscriptions'],\n ['payee', 'LUKOIL', 'Bills'],\n ['payee', 'CityGate', 'Bills'],\n ['payee', 'CBA', 'Groceries'],\n ['payee', 'FANTASTICO', 'Groceries'],\n ['payee', 'LIDL', 'Groceries'],\n];\n\nfunction parseNum(val) {\n if (val == null || val === '') return null;\n if (typeof val === 'number') return isNaN(val) ? null : val;\n const s = String(val).trim().replace(/\\xa0/g, '').replace(/ /g, '').replace(',', '.');\n const n = parseFloat(s);\n return isNaN(n) ? null : n;\n}\n\nfunction parseDate(val) {\n if (!val) return null;\n const s = String(val).trim();\n const m = s.match(/^(\\d{2})\\.(\\d{2})\\.(\\d{4})$/);\n if (m) {\n return new Date(Date.UTC(parseInt(m[3]), parseInt(m[2]) - 1, parseInt(m[1])));\n }\n return null;\n}\n\nfunction processReasonAndCard(reason) {\n if (!reason || typeof reason !== 'string') return { reason: '', card: null };\n\n const parts = reason.trim().split(' ');\n let card = null;\n let cleanReason = reason.trim();\n\n if (parts[0] && CARD_REGEX.test(parts[0])) {\n card = parts[0];\n cleanReason = parts.slice(1).join(' ').trim();\n }\n\n if (POS_REGEX.test(cleanReason)) {\n const posParts = cleanReason.split('<br/>');\n try {\n const dateTime = posParts[0].split('ПОС ')[1];\n cleanReason = `POS PAYMENT ${dateTime}`;\n } catch (_) { /* keep original */ }\n }\n\n return { reason: cleanReason.replace(/\\s+/g, ' ').trim(), card };\n}\n\nfunction generateTags(fields) {\n const tags = new Set();\n for (const [field, keyword, tagName] of TAG_RULES) {\n if ((fields[field] || '').includes(keyword)) {\n tags.add(tagName);\n }\n }\n return Array.from(tags);\n}\n\nfunction processRow(row) {\n const transactionType = (row[COL.TYPE] || '').trim();\n if (transactionType === SKIP_TYPE) return null;\n\n const { reason, card } = processReasonAndCard(row[COL.REASON]);\n const payee = (row[COL.PAYEE] || '').trim();\n const payerAccount = (row[COL.ACCT] || '').trim();\n const debitBgn = parseNum(row[COL.DEBIT]);\n const creditBgn = parseNum(row[COL.CREDIT]);\n const date = parseDate(row[COL.DATE]);\n\n const autoTags = generateTags({ reason, transactionType, payee, debitBgn, creditBgn });\n\n const amount = debitBgn ?? creditBgn ?? null;\n\n const rawMessage = [\n row[COL.DATE] && `Date: ${row[COL.DATE]}`,\n transactionType && `Type: ${transactionType}`,\n payee && `Payee: ${payee}`,\n debitBgn != null && `Debit: ${debitBgn} BGN`,\n creditBgn != null && `Credit: ${creditBgn} BGN`,\n ].filter(Boolean).join(' | ');\n\n return {\n rawMessage,\n date,\n type: null,\n card,\n recipient: payee || null,\n amount,\n currency: 'BGN',\n balance: null,\n source: 'UPLOAD',\n debitBgn,\n creditBgn,\n transactionType: transactionType || null,\n payerAccount: payerAccount || null,\n autoTags,\n };\n}\n\n/**\n * Parse a Buffer containing a DSK Bank CSV (cp1251 or UTF-8).\n * Returns { rows, skipped, errors }.\n */\nasync function parseDskCsv(buffer) {\n // Try cp1251 first (DSK Bank export encoding), fall back to UTF-8\n let text = iconv.decode(buffer, 'cp1251');\n if (!text.includes(COL.DATE)) {\n text = buffer.toString('utf-8');\n }\n\n return new Promise((resolve, reject) => {\n const rows = [];\n const errors = [];\n let skipped = 0;\n\n const parser = parse(text, {\n columns: true,\n skip_empty_lines: true,\n trim: true,\n relax_column_count: true,\n });\n\n parser.on('readable', () => {\n let record;\n while ((record = parser.read()) !== null) {\n try {\n const row = processRow(record);\n if (row === null) { skipped++; } else { rows.push(row); }\n } catch (err) {\n errors.push(err.message);\n }\n }\n });\n\n parser.on('error', reject);\n parser.on('end', () => resolve({ rows, skipped, errors }));\n });\n}\n\nmodule.exports = { parseDskCsv };","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"index.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"index.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"39 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"const express = require('express');\nconst cors = require('cors');\nconst morgan = require('morgan');\nconst rateLimit = require('express-rate-limit');\nconst { authentikMiddleware } = require('./auth');\nconst paymentsRouter = require('./routes/payments');\nconst uploadRouter = require('./routes/upload');\n\nconst app = express();\nconst PORT = process.env.PORT || 3001;\n\napp.use(cors());\napp.use(express.json({ limit: '16kb' }));\napp.use(morgan('combined'));\n\n// Rate-limit the public ingest endpoint before auth middleware\nconst ingestLimiter = rateLimit({\n windowMs: 60 * 1000,\n max: 200,\n standardHeaders: true,\n legacyHeaders: false,\n message: { error: 'Too many requests, slow down' },\n});\napp.use('/api/payments/ingest', ingestLimiter);\n\n// Authentik header auth (skips /api/health and /api/payments/ingest)\napp.use(authentikMiddleware);\n\napp.get('/api/health', (_req, res) => {\n res.json({ status: 'ok', timestamp: new Date().toISOString() });\n});\n\napp.use('/api/payments', paymentsRouter);\napp.use('/api/upload', uploadRouter);\n\napp.listen(PORT, '0.0.0.0', () => {\n console.log(`Finance Hub API running on port ${PORT}`);\n});","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"payments.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"payments.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"399 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"const express = require('express');\nconst { PrismaClient } = require('@prisma/client');\nconst { parsePaymentSms } = require('../parser');\n\nconst router = express.Router();\nconst prisma = new PrismaClient();\n\nconst NOTIFIER_URL = process.env.NOTIFIER_URL;\nconst NOTIFIER_CHANNEL = process.env.NOTIFIER_CHANNEL || 'viber';\nconst DEFAULT_PHONE = process.env.NOTIFY_DEFAULT_PHONE;\n\n// ── Helpers ───────────────────────────────────────────────────────────────────\n\nfunction parseId(raw) {\n const id = parseInt(raw, 10);\n return Number.isFinite(id) ? id : null;\n}\n\nfunction formatNotifyMessage(payment) {\n const currency = payment.currency || 'EUR';\n const parts = [];\n if (payment.amount != null) parts.push(`Amount: ${payment.amount.toFixed(2)} ${currency}`);\n if (payment.recipient) parts.push(`At: ${payment.recipient}`);\n if (payment.balance != null) parts.push(`Balance: ${payment.balance.toFixed(2)} ${currency}`);\n if (payment.date) parts.push(`Date: ${new Date(payment.date).toLocaleString('en-GB')}`);\n return parts.join('\\n');\n}\n\nasync function sendNotification(payment) {\n if (!NOTIFIER_URL) {\n console.warn('[NOTIFY] NOTIFIER_URL not set — skipping notification');\n return;\n }\n\n const phone = payment.notifyPhone || DEFAULT_PHONE;\n if (!phone) {\n console.warn('[NOTIFY] No phone number for payment #' + payment.id + ' and NOTIFY_DEFAULT_PHONE not set');\n return;\n }\n\n const body = {\n phone,\n notification: NOTIFIER_CHANNEL,\n message: formatNotifyMessage(payment),\n };\n\n const res = await fetch(NOTIFIER_URL, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n });\n\n if (!res.ok) {\n const text = await res.text().catch(() => '');\n throw new Error(`Notifier responded ${res.status}: ${text}`);\n }\n}\n\n// ── Ingest a payment (public — no auth) ──────────────────────────────────────\n//\n// Two modes:\n//\n// SMS mode (default):\n// { \"message\": \"<raw SMS text>\", \"notifyPhone\": \"...\" }\n//\n// Structured mode (Apple Wallet / manual):\n// { \"ingestMode\": \"apple_wallet\", \"amount\": 7.78, \"recipient\": \"Apple Store\",\n// \"type\": \"WALLET\", \"card\": \"••••4447\", \"date\": \"2026-02-22T10:30:00Z\" }\n//\nrouter.post('/ingest', async (req, res) => {\n try {\n const { message, notifyPhone, ingestMode } = req.body;\n\n let data;\n\n if (ingestMode === 'apple_wallet' || (!message && req.body.amount != null)) {\n // ── Structured / Apple Wallet mode ──────────────────────────────────────\n const { amount, recipient, type, card, date, balance } = req.body;\n if (amount == null || !recipient) {\n return res.status(400).json({ error: 'amount and recipient are required for structured ingest' });\n }\n\n const rawMessage = [\n `Source: ${ingestMode || 'structured'}`,\n `Amount: ${amount}`,\n recipient && `Recipient: ${recipient}`,\n type && `Type: ${type}`,\n card && `Card: ${card}`,\n ].filter(Boolean).join(' | ');\n\n data = {\n rawMessage,\n date: date ? new Date(date) : new Date(),\n type: type || 'WALLET',\n card: card || null,\n recipient,\n amount: parseFloat(amount),\n currency: 'EUR',\n balance: balance != null ? parseFloat(balance) : null,\n source: 'INGEST',\n notifyPhone: notifyPhone || null,\n };\n\n } else {\n // ── SMS mode ─────────────────────────────────────────────────────────────\n if (!message) {\n return res.status(400).json({ error: 'message is required' });\n }\n if (typeof message !== 'string' || message.length > 2000) {\n return res.status(400).json({ error: 'message must be a string under 2000 characters' });\n }\n\n const parsed = parsePaymentSms(message);\n data = {\n rawMessage: parsed.rawMessage,\n date: parsed.date,\n type: parsed.type,\n card: parsed.card,\n recipient: parsed.recipient,\n amount: parsed.amount,\n currency: 'EUR',\n balance: parsed.balance,\n source: 'INGEST',\n notifyPhone: notifyPhone || null,\n };\n }\n\n const payment = await prisma.payment.create({\n data,\n include: { tags: true },\n });\n\n res.status(201).json(payment);\n } catch (err) {\n console.error('Ingest error:', err);\n res.status(500).json({ error: 'Failed to ingest payment' });\n }\n});\n\n// ── List payments with filtering ──────────────────────────────────────────────\nrouter.get('/', async (req, res) => {\n try {\n const {\n status,\n type,\n tag,\n source,\n recipient,\n dateFrom,\n dateTo,\n search,\n sortBy = 'createdAt',\n sortDir = 'desc',\n page = 1,\n } = req.query;\n\n const limit = Math.min(parseInt(req.query.limit, 10) || 50, 200);\n\n const where = {};\n\n if (status) where.status = status;\n if (type) where.type = type;\n if (source) where.source = source;\n if (recipient) where.recipient = { contains: recipient, mode: 'insensitive' };\n if (tag) where.tags = { some: { name: tag } };\n if (search) {\n where.OR = [\n { rawMessage: { contains: search, mode: 'insensitive' } },\n { recipient: { contains: search, mode: 'insensitive' } },\n ];\n }\n if (dateFrom || dateTo) {\n where.date = {};\n if (dateFrom) where.date.gte = new Date(dateFrom);\n if (dateTo) where.date.lte = new Date(dateTo);\n }\n\n const allowedSortFields = ['date', 'amount', 'balance', 'recipient', 'type', 'source', 'createdAt', 'status'];\n const orderField = allowedSortFields.includes(sortBy) ? sortBy : 'createdAt';\n const orderDir = sortDir === 'asc' ? 'asc' : 'desc';\n\n const skip = (parseInt(page, 10) - 1) * limit;\n\n const [payments, total] = await Promise.all([\n prisma.payment.findMany({\n where,\n include: { tags: true },\n orderBy: { [orderField]: orderDir },\n skip,\n take: limit,\n }),\n prisma.payment.count({ where }),\n ]);\n\n res.json({ payments, total, page: parseInt(page, 10), limit });\n } catch (err) {\n console.error('List error:', err);\n res.status(500).json({ error: 'Failed to list payments' });\n }\n});\n\n// ── Get filter options ────────────────────────────────────────────────────────\nrouter.get('/meta/filters', async (_req, res) => {\n try {\n const [types, recipients, tags, sources] = await Promise.all([\n prisma.payment.findMany({ distinct: ['type'], select: { type: true }, where: { type: { not: null } } }),\n prisma.payment.findMany({ distinct: ['recipient'], select: { recipient: true }, where: { recipient: { not: null } } }),\n prisma.tag.findMany({ orderBy: { name: 'asc' } }),\n prisma.payment.findMany({ distinct: ['source'], select: { source: true } }),\n ]);\n\n res.json({\n types: types.map(t => t.type),\n recipients: recipients.map(r => r.recipient),\n tags,\n sources: sources.map(s => s.source),\n });\n } catch (err) {\n res.status(500).json({ error: 'Failed to get filters' });\n }\n});\n\n// ── Get all tags ──────────────────────────────────────────────────────────────\nrouter.get('/meta/tags', async (_req, res) => {\n try {\n const tags = await prisma.tag.findMany({ orderBy: { name: 'asc' } });\n res.json(tags);\n } catch (err) {\n res.status(500).json({ error: 'Failed to list tags' });\n }\n});\n\n// ── Get single payment ────────────────────────────────────────────────────────\nrouter.get('/:id', async (req, res) => {\n const id = parseId(req.params.id);\n if (id === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n const payment = await prisma.payment.findUnique({\n where: { id },\n include: { tags: true },\n });\n if (!payment) return res.status(404).json({ error: 'Not found' });\n res.json(payment);\n } catch (err) {\n console.error('Get error:', err);\n res.status(500).json({ error: 'Failed to get payment' });\n }\n});\n\n// ── Update payment metadata (status) ─────────────────────────────────────────\nrouter.patch('/:id', async (req, res) => {\n const id = parseId(req.params.id);\n if (id === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n const { status } = req.body;\n const data = {};\n\n if (status) {\n const validStatuses = ['UNPROCESSED', 'SENT', 'SKIPPED'];\n if (!validStatuses.includes(status)) {\n return res.status(400).json({ error: `Invalid status. Must be one of: ${validStatuses.join(', ')}` });\n }\n data.status = status;\n }\n\n if (Object.keys(data).length === 0) {\n return res.status(400).json({ error: 'No valid fields to update' });\n }\n\n const updated = await prisma.payment.update({\n where: { id },\n data,\n include: { tags: true },\n });\n res.json(updated);\n } catch (err) {\n if (err.code === 'P2025') return res.status(404).json({ error: 'Not found' });\n console.error('Update error:', err);\n res.status(500).json({ error: 'Failed to update payment' });\n }\n});\n\n// ── Delete payment ───────────────────────────────────────────────────────────\nrouter.delete('/:id', async (req, res) => {\n const id = parseId(req.params.id);\n if (id === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n await prisma.payment.delete({ where: { id } });\n res.json({ success: true });\n } catch (err) {\n if (err.code === 'P2025') return res.status(404).json({ error: 'Not found' });\n console.error('Delete error:', err);\n res.status(500).json({ error: 'Failed to delete payment' });\n }\n});\n\n// ── Send notification (mark as SENT + call notifier service) ─────────────────\nrouter.post('/:id/send', async (req, res) => {\n const id = parseId(req.params.id);\n if (id === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n const payment = await prisma.payment.findUnique({ where: { id } });\n if (!payment) return res.status(404).json({ error: 'Not found' });\n if (payment.status !== 'UNPROCESSED') {\n return res.status(409).json({ error: `Payment is already ${payment.status.toLowerCase()}` });\n }\n\n await sendNotification(payment);\n\n const updated = await prisma.payment.update({\n where: { id },\n data: { status: 'SENT', notifiedAt: new Date() },\n include: { tags: true },\n });\n\n res.json(updated);\n } catch (err) {\n console.error('Send error:', err);\n res.status(500).json({ error: 'Failed to send notification' });\n }\n});\n\n// ── Skip notification (mark as SKIPPED) ──────────────────────────────────────\nrouter.post('/:id/skip', async (req, res) => {\n const id = parseId(req.params.id);\n if (id === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n const payment = await prisma.payment.findUnique({ where: { id } });\n if (!payment) return res.status(404).json({ error: 'Not found' });\n if (payment.status !== 'UNPROCESSED') {\n return res.status(409).json({ error: `Payment is already ${payment.status.toLowerCase()}` });\n }\n\n const updated = await prisma.payment.update({\n where: { id },\n data: { status: 'SKIPPED' },\n include: { tags: true },\n });\n res.json(updated);\n } catch (err) {\n console.error('Skip error:', err);\n res.status(500).json({ error: 'Failed to skip payment' });\n }\n});\n\n// ── Add tag to payment ────────────────────────────────────────────────────────\nrouter.post('/:id/tags', async (req, res) => {\n const id = parseId(req.params.id);\n if (id === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n const { name, color } = req.body;\n if (!name) return res.status(400).json({ error: 'tag name is required' });\n\n const tag = await prisma.tag.upsert({\n where: { name },\n update: {},\n create: { name, color: color || '#6b7280' },\n });\n\n const updated = await prisma.payment.update({\n where: { id },\n data: { tags: { connect: { id: tag.id } } },\n include: { tags: true },\n });\n\n res.json(updated);\n } catch (err) {\n console.error('Tag error:', err);\n res.status(500).json({ error: 'Failed to add tag' });\n }\n});\n\n// ── Remove tag from payment ───────────────────────────────────────────────────\nrouter.delete('/:id/tags/:tagId', async (req, res) => {\n const id = parseId(req.params.id);\n const tagId = parseId(req.params.tagId);\n if (id === null || tagId === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n const updated = await prisma.payment.update({\n where: { id },\n data: { tags: { disconnect: { id: tagId } } },\n include: { tags: true },\n });\n res.json(updated);\n } catch (err) {\n console.error('Remove tag error:', err);\n res.status(500).json({ error: 'Failed to remove tag' });\n }\n});\n\nmodule.exports = router;","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"upload.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"upload.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"89 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"const express = require('express');\nconst multer = require('multer');\nconst { PrismaClient } = require('@prisma/client');\nconst { parseDskCsv } = require('../csvParser');\n\nconst router = express.Router();\nconst prisma = new PrismaClient();\n\nconst upload = multer({\n storage: multer.memoryStorage(),\n limits: { fileSize: 10 * 1024 * 1024, files: 10 },\n fileFilter: (_req, file, cb) => {\n if (file.mimetype === 'text/csv' || file.originalname.toLowerCase().endsWith('.csv')) {\n cb(null, true);\n } else {\n cb(new Error('Only CSV files are accepted'));\n }\n },\n});\n\n// POST /api/upload/csv\n// Accepts 1-10 CSV files, parses them, stores to DB with source=UPLOAD.\n// Returns { imported, skipped, errors, payments[] }\nrouter.post('/csv', upload.array('files', 10), async (req, res) => {\n if (!req.files || req.files.length === 0) {\n return res.status(400).json({ error: 'No files uploaded' });\n }\n\n const allRows = [];\n const allErrors = [];\n let totalSkipped = 0;\n\n for (const file of req.files) {\n try {\n const { rows, skipped, errors } = await parseDskCsv(file.buffer);\n allRows.push(...rows);\n totalSkipped += skipped;\n allErrors.push(...errors.map(e => `${file.originalname}: ${e}`));\n } catch (err) {\n allErrors.push(`${file.originalname}: ${err.message}`);\n }\n }\n\n if (allRows.length === 0) {\n return res.status(422).json({\n error: 'No importable rows found',\n skipped: totalSkipped,\n errors: allErrors,\n });\n }\n\n const created = [];\n\n for (const row of allRows) {\n const { autoTags, ...paymentData } = row;\n try {\n const tagConnects = [];\n for (const tagName of autoTags) {\n const tag = await prisma.tag.upsert({\n where: { name: tagName },\n update: {},\n create: { name: tagName, color: '#6b7280' },\n });\n tagConnects.push({ id: tag.id });\n }\n\n const payment = await prisma.payment.create({\n data: {\n ...paymentData,\n ...(tagConnects.length ? { tags: { connect: tagConnects } } : {}),\n },\n include: { tags: true },\n });\n created.push(payment);\n } catch (err) {\n allErrors.push(`Row insert failed: ${err.message}`);\n }\n }\n\n res.status(201).json({\n imported: created.length,\n skipped: totalSkipped,\n errors: allErrors,\n payments: created,\n });\n});\n\nmodule.exports = router;","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Now writing all frontend config files:","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"package.json","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"package.json","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"24 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"{\n \"name\": \"finance-hub-frontend\",\n \"version\": \"1.0.0\",\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"vite\",\n \"build\": \"vite build\",\n \"preview\": \"vite preview\"\n },\n \"dependencies\": {\n \"lucide-react\": \"^0.460.0\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\"\n },\n \"devDependencies\": {\n \"@types/react\": \"^18.3.12\",\n \"@vitejs/plugin-react\": \"^4.3.4\",\n \"autoprefixer\": \"^10.4.20\",\n \"postcss\": \"^8.4.49\",\n \"tailwindcss\": \"^3.4.15\",\n \"vite\": \"^6.0.1\"\n }\n}","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Dockerfile","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Dockerfile","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"13 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FROM node:20-alpine\n\nWORKDIR /app\n\nCOPY package.json package-lock.json* ./\nRUN npm install\n\nCOPY . .\n\nEXPOSE 5173\n\nCMD [\"npm\", \"run\", \"dev\"]","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"vite.config.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"vite.config.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"18 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"import { defineConfig } from 'vite';\nimport react from '@vitejs/plugin-react';\n\nexport default defineConfig({\n plugins: [react()],\n server: {\n host: '0.0.0.0',\n port: 5173,\n allowedHosts: ['finance-hub.lakylak.xyz'],\n proxy: {\n '/api': {\n target: 'http://backend:3001',\n changeOrigin: true,\n },\n },\n },\n});","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"tailwind.config.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"tailwind.config.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"12 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/** @type {import('tailwindcss').Config} */\nexport default {\n content: [\n \"./index.html\",\n \"./src/**/*.{js,ts,jsx,tsx}\",\n ],\n theme: {\n extend: {},\n },\n plugins: [],\n};","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"postcss.config.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"postcss.config.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"7 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"export default {\n plugins: {\n tailwindcss: {},\n autoprefixer: {},\n },\n};","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"index.html","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"index.html","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"14 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>Finance Hub</title>\n <link rel=\"icon\" type=\"image/svg+xml\" href=\"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>💰</text></svg>\" />\n </head>\n <body class=\"bg-gray-50 min-h-screen\">\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.jsx\"></script>\n </body>\n</html>","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"index.css","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"index.css","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"4 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"@tailwind base;\n@tailwind components;\n@tailwind utilities;","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"}]...
|
-8042896772090803814
|
6808971250940275611
|
click
|
accessibility
|
NULL
|
Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧ Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧G)
Run and Debug (⇧⌘D)
Remote Explorer
Extensions (⇧⌘X) - 2 require update
2
Claude Code
Containers
EXPLORER
EXPLORER
Explorer Section: finance [SSH: nas]
Explorer Section: finance [SSH: nas]
FINANCE [SSH: NAS]
auth
dsk-uploader
finance-hub
backend
frontend
.env
.env.example
.gitignore
docker-compose.yml
payments-logger
Outline Section
OUTLINE
OUTLINE
Timeline Section
TIMELINE
TIMELINE
docker-compose.yml, Editor Group 1
.env, Editor Group 1
# ── Database ───────────────────────────────────────────────────────────────────
[ENV_SECRET]
# ── Notifier service ──────────────────────────────────────────────────────────
NOTIFIER_URL=[URL_WITH_CREDENTIALS] @default(autoincrement())
rawMessage String @map("raw_message")
date DateTime?
type String?
card String?
recipient String?
amount Float?
currency String? @default("EUR")
balance Float?
source Source @default(INGEST)
status Status @default(UNPROCESSED)
tags Tag[]
notifiedAt DateTime? @map("notified_at")
notifyPhone String? @map("notify_phone")
debitBgn Float? @map("debit_bgn")
creditBgn Float? @map("credit_bgn")
transactionType String? @map("transaction_type")
payerAccount String? @map("payer_account")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("payments")
}
model Tag {
id Int @id @default(autoincrement())
name String @unique
color String @default("#6b7280")
payments Payment[]
@@map("tags")
}
enum Status { UNPROCESSED SENT SKIPPED }
enum Source { INGEST UPLOAD }
```
**Key decisions:**
- No `User` model — Authentik owns identity.
- `currency`: `EUR` for SMS ingest, `BGN` for CSV uploads.
- `debitBgn`, `creditBgn`, `transactionType`, `payerAccount`: nullable CSV-only columns; INGEST rows store nulls. Avoids a union query for the unified list view.
- `balance` is always null for CSV rows (DSK export does not include running balance).
- Fresh consolidated migration — no data migration from reference apps required.
---
## API Routes
| Method | Path | Auth | Description |
|--------|------|------|-------------|
| GET | /api/health | public | Health check |
| POST | /api/payments/ingest | public | SMS or structured ingest (source=INGEST) |
| GET | /api/payments | required | List with filters/sort/pagination (+ source filter) |
| GET | /api/payments/meta/tags | required | All tags |
| GET | /api/payments/meta/filters | required | Filter options incl. `sources` array |
| GET | /api/payments/:id | required | Single payment |
| PATCH | /api/payments/:id | required | Update status |
| DELETE | /api/payments/:id | required | Delete |
| POST | /api/payments/:id/send | required | Send notification |
| POST | /api/payments/:id/skip | required | Skip |
| POST | /api/payments/:id/tags | required | Add/upsert tag |
| DELETE | /api/payments/:id/tags/:tagId | required | Remove tag |
| POST | /api/upload/csv | required | DSK CSV file upload (source=UPLOAD) |
---
## Key Implementation Details
### auth.js (replaces entire old auth module)
```js
const PUBLIC_PATHS = new Set(['/api/health', '/api/payments/ingest']);
function authentikMiddleware(req, res, next) {
if (PUBLIC_PATHS.has(req.path)) return next();
const username = req.headers['x-authentik-username'];
if (!username) return res.status(401).json({ error: 'Unauthorized' });
req.user = {
username,
email: req.headers['x-authentik-email'] || null,
groups: (req.headers['x-authentik-groups'] || '').split(',').map(g => g.trim()).filter(Boolean),
};
next();
}
module.exports = { authentikMiddleware };
```
### csvParser.js (port of dskuploader.py)
- `iconv-lite` decodes buffer as cp1251 (DSK Bank export encoding), falls back to UTF-8
- `csv-parse` parses the decoded text with `columns: true`
- Columns: `Дата`, `Вид на трансакцията`, `Основание`, `Дебит BGN`, `Кредит BGN`, `Наредител/Получател`, `Номер сметка на наредителя / получателя`
- Card extraction: regex `/^\d{6}x{6}\d{4}$/` on first token of `Основание`
- Skips rows where `Вид на трансакцията === 'ТРАНСФЕР СОБСТВЕНИ СМЕТКИ'`
- Auto-tags via keyword rules (ЗАПЛАТА→Salary, LIDL→Groceries, NETFLIX→Subscriptions, etc.) — same logic as Python `generate_tags()`
- Returns `{ rows: PaymentData[], skipped: number, errors: string[] }`
### payments.js changes from payments-logger
1. Add `source: 'INGEST'` and `currency` to the `/ingest` create call
2. Add `source` to the `GET /` where clause filter
3. Add `sources` to `meta/filters` response
4. Currency-aware amount formatting in notification message
5. Remove all JWT/auth references (no `/auth/register`, `/auth/login`)
### upload.js (new)
- `multer` memory storage, max 10 files × 10 MB
- Calls `parseDskCsv(buffer)` per file
- Upserts tags via `prisma.tag.upsert` then connects
- Returns `{ imported, skipped, errors, payments[] }`
### Frontend changes
- **Delete**: `auth.js`, `AuthProvider.jsx`
- **main.jsx**: Remove `<AuthProvider>` wrapper
- **App.jsx**: Replace `authFetch` with plain `fetch` (Authentik session cookie travels automatically); logout → `window.location.href = '/outpost.goauthentik.io/sign_out'`; add "Payments" / "Upload CSV" tab toggle
- **FilterBar.jsx**: Add source `<select>` (All / SMS Ingest / CSV Upload); widen grid to 5 cols
- **PaymentTable.jsx**: Add `Source` column with `SMS` (indigo) / `CSV` (emerald) badge; show `${amount} ${currency}` in amount cell
- **UploadPanel.jsx** (new): Drag-and-drop zone + file list + import button + result summary with error accordion; calls `POST /api/upload/csv` with `FormData`
---
## Docker Compose
```yaml
services:
db:
image: postgres:16-alpine
environment: { POSTGRES_USER: finance, POSTGRES_PASSWORD: [PASSWORD] POSTGRES_DB: finance_hub }
volumes: [pgdata:/var/lib/postgresql/data]
healthcheck: { test: pg_isready -U finance -d finance_hub, interval: 5s }
backend:
build: ./backend
environment:
DATABASE_URL: [CONNECTION_STRING]
PORT: "3001"
NOTIFIER_URL: ${NOTIFIER_URL}
NOTIFIER_CHANNEL: ${NOTIFIER_CHANNEL:-viber}
NOTIFY_DEFAULT_PHONE: ${NOTIFY_DEFAULT_PHONE}
TZ: ${TZ:-Europe/Sofia}
ports: ["${BACKEND_PORT:-3001}:3001"]
depends_on: { db: { condition: service_healthy } }
frontend:
build: ./frontend
ports: ["${FRONTEND_PORT:-5175}:5173"]
depends_on: [backend]
volumes: { pgdata: }
```
**NPM setup:** Frontend port proxied through Authentik forward auth. Backend port exposed separately (unprotected) so the public `/api/payments/ingest` remains reachable by iOS Shortcuts / SMS gateways without login.
---
## Environment Variables (.env)
```bash
[ENV_SECRET]
NOTIFIER_URL=[URL_WITH_CREDENTIALS] @default(autoincrement())
rawMessage String @map("raw_message")
date DateTime?
type String?
card String?
recipient String?
amount Float?
currency String? @default("EUR")
balance Float?
source Source @default(INGEST)
status Status @default(UNPROCESSED)
tags Tag[]
notifiedAt DateTime? @map("notified_at")
notifyPhone String? @map("notify_phone")
debitBgn Float? @map("debit_bgn")
creditBgn Float? @map("credit_bgn")
transactionType String? @map("transaction_type")
payerAccount String? @map("payer_account")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("payments")
}
model Tag {
id Int @id @default(autoincrement())
name String @unique
color String @default("#6b7280")
payments Payment[]
@@map("tags")
}
enum Status {
UNPROCESSED
SENT
SKIPPED
}
enum Source {
INGEST
UPLOAD
}
Write
migration.sql
migration.sql
55 lines
-- CreateEnum
CREATE TYPE "Status" AS ENUM ('UNPROCESSED', 'SENT', 'SKIPPED');
CREATE TYPE "Source" AS ENUM ('INGEST', 'UPLOAD');
-- CreateTable
CREATE TABLE "payments" (
"id" SERIAL PRIMARY KEY,
"raw_message" TEXT NOT NULL,
"date" TIMESTAMP(3),
"type" TEXT,
"card" TEXT,
"recipient" TEXT,
"amount" DOUBLE PRECISION,
"currency" TEXT DEFAULT 'EUR',
"balance" DOUBLE PRECISION,
"source" "Source" NOT NULL DEFAULT 'INGEST',
"status" "Status" NOT NULL DEFAULT 'UNPROCESSED',
"notified_at" TIMESTAMP(3),
"notify_phone" TEXT,
"debit_bgn" DOUBLE PRECISION,
"credit_bgn" DOUBLE PRECISION,
"transaction_type" TEXT,
"payer_account" TEXT,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP
);
-- CreateTable
CREATE TABLE "tags" (
"id" SERIAL PRIMARY KEY,
"name" TEXT NOT NULL,
"color" TEXT NOT NULL DEFAULT '#6b7280'
);
-- CreateUniqueIndex
CREATE UNIQUE INDEX "tags_name_key" ON "tags"("name");
-- CreateTable (M2M join)
CREATE TABLE "_PaymentToTag" (
"A" INTEGER NOT NULL,
"B" INTEGER NOT NULL,
CONSTRAINT "_PaymentToTag_AB_pkey" PRIMARY KEY ("A", "B")
);
CREATE INDEX "_PaymentToTag_B_index" ON "_PaymentToTag"("B");
-- AddForeignKey
ALTER TABLE "_PaymentToTag"
ADD CONSTRAINT "_PaymentToTag_A_fkey"
FOREIGN KEY ("A") REFERENCES "payments"("id") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "_PaymentToTag"
ADD CONSTRAINT "_PaymentToTag_B_fkey"
FOREIGN KEY ("B") REFERENCES "tags"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Write
migration_lock.toml
migration_lock.toml
4 lines
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"
Update Todos
Create folder structure and root config files
Write backend Prisma schema and migration
Write backend package.json and Dockerfile
Write backend src files (auth, parser, csvParser, index)
Write backend routes (payments.js, upload.js)
Write frontend config files
Write frontend React components
Build and verify with docker compose
Write
package.json
package.json
26 lines
{
"name": "finance-hub-backend",
"version": "1.0.0",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js",
"dev": "nodemon src/index.js",
"prisma:generate": "prisma generate",
"prisma:migrate": "prisma migrate deploy"
},
"dependencies": {
"@prisma/client": "^5.22.0",
"cors": "^2.8.5",
"csv-parse": "^5.5.6",
"express": "^4.21.1",
"express-rate-limit": "^7.4.0",
"iconv-lite": "^0.6.3",
"morgan": "^1.10.0",
"multer": "^1.4.5-lts.1"
},
"devDependencies": {
"nodemon": "^3.1.7",
"prisma": "^5.22.0"
}
}
Write
Dockerfile
Dockerfile
18 lines
FROM node:20-alpine
RUN apk add --no-cache openssl
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install
COPY prisma ./prisma
RUN npx prisma generate
COPY src ./src
EXPOSE 3001
CMD ["sh", "-c", "npx prisma migrate deploy && node src/index.js"]
Update Todos
Create folder structure and root config files
Write backend Prisma schema and migration
Write backend package.json and Dockerfile
Write backend src files (auth, parser, csvParser, index)
Write backend routes (payments.js, upload.js)
Write frontend config files
Write frontend React components
Build and verify with docker compose
Write
auth.js
auth.js
27 lines
const PUBLIC_PATHS = new Set([
'/api/health',
'/api/payments/ingest',
]);
function authentikMiddleware(req, res, next) {
if (PUBLIC_PATHS.has(req.path)) return next();
const username = req.headers['x-authentik-username'];
if (!username) {
return res.status(401).json({ error: 'Unauthorized — missing Authentik session' });
}
req.user = {
username,
email: req.headers['x-authentik-email'] || null,
groups: (req.headers['x-authentik-groups'] || '')
.split(',')
.map(g => g.trim())
.filter(Boolean),
};
next();
}
module.exports = { authentikMiddleware };
Write
parser.js
parser.js
104 lines
/**
* Parses SMS payment messages from Bulgarian banks (DSK Bank, etc.)
*
* Supported formats:
*
* POS / INTERNET / ECOM / P2P payment:
* DSK Bank. Na DD/MM/YYYY v HH:MM sa plateni AMOUNT CURRENCY s karta CARD na POS s adres: RECIPIENT. Nalichni: BALANCE CURRENCY.
*
* ATM withdrawal:
* DSK Bank. Na DD/MM/YYYY v HH:MM sa iztegleni AMOUNT CURRENCY s karta CARD ot ATM s adres: RECIPIENT. Nalichni: BALANCE CURRENCY.
*
* ATM utility payment (amount may include fee as AMOUNT/FEE):
* DSK Bank. Na DD/MM/YYYY v HH:MM sa plateni AMOUNT CURRENCY/FEE CURRENCY s karta CARD na ATM s adres:RECIPIENT. Nalichni: BALANCE CURRENCY.
*/
const LOCAL_TZ = process.env.TZ || 'Europe/Sofia';
/**
* Convert a local-timezone date/time to a UTC Date object.
* Uses Intl to resolve the actual UTC offset (DST-aware).
*/
function localToUtc(year, month, day, hour, minute) {
const naive = new Date(Date.UTC(year, month - 1, day, hour, minute, 0));
const formatter = new Intl.DateTimeFormat('en-US', {
timeZone: LOCAL_TZ,
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit', second: '2-digit',
hour12: false,
});
const parts = {};
formatter.formatToParts(naive).forEach(p => { parts[p.type] = p.value; });
const localAtNaive = new Date(Date.UTC(
parseInt(parts.year), parseInt(parts.month) - 1, parseInt(parts.day),
parseInt(parts.hour) % 24, parseInt(parts.minute), parseInt(parts.second),
));
const offsetMs = localAtNaive.getTime() - naive.getTime();
return new Date(Date.UTC(year, month - 1, day, hour, minute, 0) - offsetMs);
}
function parsePaymentSms(message) {
const result = {
rawMessage: message,
date: null,
type: null,
card: null,
recipient: null,
amount: null,
balance: null,
};
// Date and time: "Na DD/MM/YYYY v HH:MM"
const dateMatch = message.match(/Na (\d{2})\/(\d{2})\/(\d{4}) v (\d{2}):(\d{2})/i);
if (dateMatch) {
const [, day, month, year, hour, minute] = dateMatch;
result.date = localToUtc(
parseInt(year), parseInt(month), parseInt(day),
parseInt(hour), parseInt(minute),
);
}
// Card mask: "s karta 400915***4447" or "s karta 483890***7162"
const cardMatch = message.match(/s karta\s+([\d*]+)/i);
if (cardMatch) {
result.card = cardMatch[1];
}
// Transaction type: supports both prepositions
// "na POS" / "na ATM" / "na INTERNET" etc. (payment)
// "ot ATM" (withdrawal)
const typeMatch = message.match(/(?:na|ot)\s+(POS|ATM|INTERNET|ECOM|P2P)\b/i);
if (typeMatch) {
result.type = typeMatch[1].toUpperCase();
}
// Recipient address: "s adres: MERCHANT" or "s adres:MERCHANT" (no space variant)
const recipientMatch = message.match(/s adres:\s*([^.]+)\./i);
if (recipientMatch) {
result.recipient = recipientMatch[1].trim();
}
// Amount: handles both verbs and the AMOUNT/FEE suffix format
// "sa plateni 7.78 EUR"
// "sa iztegleni 400.00 EUR"
// "sa plateni 0.50 EUR/0.50 EUR" → captures 0.50 (the charged amount, ignoring fee)
const amountMatch = message.match(/sa (?:plateni|iztegleni)\s+([\d.,]+)\s+[A-Z]{3}/i);
if (amountMatch) {
result.amount = parseFloat(amountMatch[1].replace(',', '.'));
}
// Balance: "Nalichni: 2583.07 EUR."
const balanceMatch = message.match(/Nalichni:\s*([\d.,]+)\s+[A-Z]{3}/i);
if (balanceMatch) {
result.balance = parseFloat(balanceMatch[1].replace(',', '.'));
}
return result;
}
module.exports = { parsePaymentSms };
Write
csvParser.js
csvParser.js
175 lines
/**
* DSK Bank CSV parser — Node.js port of dskuploader.py
*
* DSK Bank exports use Windows-1251 (cp1251) encoding.
* Each row maps to a Payment record with source=UPLOAD, currency=BGN.
*/
const { parse } = require('csv-parse');
const iconv = require('iconv-lite');
const SKIP_TYPE = 'ТРАНСФЕР СОБСТВЕНИ СМЕТКИ';
const CARD_REGEX = /^\d{6}x{6}\d{4}$/;
const POS_REGEX = /^\s*ПЛАЩАНЕ\s+НА\s+ПОС\s+\d{2}\.\d{2}\.\d{4}\s+\d{2}:\d{2}/;
const COL = {
DATE: 'Дата',
TYPE: 'Вид на трансакцията',
REASON: 'Основание',
DEBIT: 'Дебит BGN',
CREDIT: 'Кредит BGN',
PAYEE: 'Наредител/Получател',
ACCT: 'Номер сметка на наредителя / получателя',
};
const TAG_RULES = [
['reason', 'ЗАПЛАТА', 'Salary'],
['reason', 'ТЕГЛЕНЕ НА ATM', 'ATM'],
['reason', 'ПЛАЩАНЕ ПО ЗАЕМ', 'Home Credit'],
['reason', 'АВТ.ТАКСА ОБСЛУЖВАНЕ', 'Bills'],
['transactionType', 'КОМУНАЛНИ УСЛУГИ', 'Bills'],
['payee', 'VIVACOM', 'Subscriptions'],
['payee', 'Google', 'Subscriptions'],
['payee', 'SkyShowtime', 'Subscriptions'],
['payee', 'NETFLIX', 'Subscriptions'],
['payee', 'LUKOIL', 'Bills'],
['payee', 'CityGate', 'Bills'],
['payee', 'CBA', 'Groceries'],
['payee', 'FANTASTICO', 'Groceries'],
['payee', 'LIDL', 'Groceries'],
];
function parseNum(val) {
if (val == null || val === '') return null;
if (typeof val === 'number') return isNaN(val) ? null : val;
const s = String(val).trim().replace(/\xa0/g, '').replace(/ /g, '').replace(',', '.');
const n = parseFloat(s);
return isNaN(n) ? null : n;
}
function parseDate(val) {
if (!val) return null;
const s = String(val).trim();
const m = s.match(/^(\d{2})\.(\d{2})\.(\d{4})$/);
if (m) {
return new Date(Date.UTC(parseInt(m[3]), parseInt(m[2]) - 1, parseInt(m[1])));
}
return null;
}
function processReasonAndCard(reason) {
if (!reason || typeof reason !== 'string') return { reason: '', card: null };
const parts = reason.trim().split(' ');
let card = null;
let cleanReason = reason.trim();
if (parts[0] && CARD_REGEX.test(parts[0])) {
card = parts[0];
cleanReason = parts.slice(1).join(' ').trim();
}
if (POS_REGEX.test(cleanReason)) {
const posParts = cleanReason.split('<br/>');
try {
const dateTime = posParts[0].split('ПОС ')[1];
cleanReason = `POS PAYMENT ${dateTime}`;
} catch (_) { /* keep original */ }
}
return { reason: cleanReason.replace(/\s+/g, ' ').trim(), card };
}
function generateTags(fields) {
const tags = new Set();
for (const [field, keyword, tagName] of TAG_RULES) {
if ((fields[field] || '').includes(keyword)) {
tags.add(tagName);
}
}
return Array.from(tags);
}
function processRow(row) {
const transactionType = (row[COL.TYPE] || '').trim();
if (transactionType === SKIP_TYPE) return null;
const { reason, card } = processReasonAndCard(row[COL.REASON]);
const payee = (row[COL.PAYEE] || '').trim();
const payerAccount = (row[COL.ACCT] || '').trim();
const debitBgn = parseNum(row[COL.DEBIT]);
const creditBgn = parseNum(row[COL.CREDIT]);
const date = parseDate(row[COL.DATE]);
const autoTags = generateTags({ reason, transactionType, payee, debitBgn, creditBgn });
const amount = debitBgn ?? creditBgn ?? null;
const rawMessage = [
row[COL.DATE] && `Date: ${row[COL.DATE]}`,
transactionType && `Type: ${transactionType}`,
payee && `Payee: ${payee}`,
debitBgn != null && `Debit: ${debitBgn} BGN`,
creditBgn != null && `Credit: ${creditBgn} BGN`,
].filter(Boolean).join(' | ');
return {
rawMessage,
date,
type: null,
card,
recipient: payee || null,
amount,
currency: 'BGN',
balance: null,
source: 'UPLOAD',
debitBgn,
creditBgn,
transactionType: transactionType || null,
payerAccount: payerAccount || null,
autoTags,
};
}
/**
* Parse a Buffer containing a DSK Bank CSV (cp1251 or UTF-8).
* Returns { rows, skipped, errors }.
*/
async function parseDskCsv(buffer) {
// Try cp1251 first (DSK Bank export encoding), fall back to UTF-8
let text = iconv.decode(buffer, 'cp1251');
if (!text.includes(COL.DATE)) {
text = buffer.toString('utf-8');
}
return new Promise((resolve, reject) => {
const rows = [];
const errors = [];
let skipped = 0;
const parser = parse(text, {
columns: true,
skip_empty_lines: true,
trim: true,
relax_column_count: true,
});
parser.on('readable', () => {
let record;
while ((record = parser.read()) !== null) {
try {
const row = processRow(record);
if (row === null) { skipped++; } else { rows.push(row); }
} catch (err) {
errors.push(err.message);
}
}
});
parser.on('error', reject);
parser.on('end', () => resolve({ rows, skipped, errors }));
});
}
module.exports = { parseDskCsv };
Write
index.js
index.js
39 lines
const express = require('express');
const cors = require('cors');
const morgan = require('morgan');
const rateLimit = require('express-rate-limit');
const { authentikMiddleware } = require('./auth');
const paymentsRouter = require('./routes/payments');
const uploadRouter = require('./routes/upload');
const app = express();
const PORT = process.env.PORT || 3001;
app.use(cors());
app.use(express.json({ limit: '16kb' }));
app.use(morgan('combined'));
// Rate-limit the public ingest endpoint before auth middleware
const ingestLimiter = rateLimit({
windowMs: 60 * 1000,
max: 200,
standardHeaders: true,
legacyHeaders: false,
message: { error: 'Too many requests, slow down' },
});
app.use('/api/payments/ingest', ingestLimiter);
// Authentik header auth (skips /api/health and /api/payments/ingest)
app.use(authentikMiddleware);
app.get('/api/health', (_req, res) => {
res.json({ status: 'ok', timestamp: new Date().toISOString() });
});
app.use('/api/payments', paymentsRouter);
app.use('/api/upload', uploadRouter);
app.listen(PORT, '[IP_ADDRESS]', () => {
console.log(`Finance Hub API running on port ${PORT}`);
});
Update Todos
Create folder structure and root config files
Write backend Prisma schema and migration
Write backend package.json and Dockerfile
Write backend src files (auth, parser, csvParser, index)
Write backend routes (payments.js, upload.js)
Write frontend config files
Write frontend React components
Build and verify with docker compose
Write
payments.js
payments.js
399 lines
const express = require('express');
const { PrismaClient } = require('@prisma/client');
const { parsePaymentSms } = require('../pa...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
11847
|
529
|
12
|
2026-05-09T07:04:58.483873+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-09/1778 /Users/lukas/.screenpipe/data/data/2026-05-09/1778310298483_m1.jpg...
|
Code
|
Design new payment-logge… — finance [SSH: nas]
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧ Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧G)
Run and Debug (⇧⌘D)
Remote Explorer
Extensions (⇧⌘X) - 2 require update
2
Claude Code
Containers
EXPLORER
EXPLORER
Explorer Section: finance [SSH: nas]
Explorer Section: finance [SSH: nas]
FINANCE [SSH: NAS]
auth
dsk-uploader
finance-hub
backend
frontend
.env
.env.example
.gitignore
docker-compose.yml
payments-logger
Outline Section
OUTLINE
OUTLINE
Timeline Section
TIMELINE
TIMELINE
docker-compose.yml, Editor Group 1
.env, Editor Group 1
# ── Database ───────────────────────────────────────────────────────────────────
[ENV_SECRET]
# ── Notifier service ──────────────────────────────────────────────────────────
NOTIFIER_URL=[URL_WITH_CREDENTIALS] @default(autoincrement())
rawMessage String @map("raw_message")
date DateTime?
type String?
card String?
recipient String?
amount Float?
currency String? @default("EUR")
balance Float?
source Source @default(INGEST)
status Status @default(UNPROCESSED)
tags Tag[]
notifiedAt DateTime? @map("notified_at")
notifyPhone String? @map("notify_phone")
debitBgn Float? @map("debit_bgn")
creditBgn Float? @map("credit_bgn")
transactionType String? @map("transaction_type")
payerAccount String? @map("payer_account")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("payments")
}
model Tag {
id Int @id @default(autoincrement())
name String @unique
color String @default("#6b7280")
payments Payment[]
@@map("tags")
}
enum Status { UNPROCESSED SENT SKIPPED }
enum Source { INGEST UPLOAD }
```
**Key decisions:**
- No `User` model — Authentik owns identity.
- `currency`: `EUR` for SMS ingest, `BGN` for CSV uploads.
- `debitBgn`, `creditBgn`, `transactionType`, `payerAccount`: nullable CSV-only columns; INGEST rows store nulls. Avoids a union query for the unified list view.
- `balance` is always null for CSV rows (DSK export does not include running balance).
- Fresh consolidated migration — no data migration from reference apps required.
---
## API Routes
| Method | Path | Auth | Description |
|--------|------|------|-------------|
| GET | /api/health | public | Health check |
| POST | /api/payments/ingest | public | SMS or structured ingest (source=INGEST) |
| GET | /api/payments | required | List with filters/sort/pagination (+ source filter) |
| GET | /api/payments/meta/tags | required | All tags |
| GET | /api/payments/meta/filters | required | Filter options incl. `sources` array |
| GET | /api/payments/:id | required | Single payment |
| PATCH | /api/payments/:id | required | Update status |
| DELETE | /api/payments/:id | required | Delete |
| POST | /api/payments/:id/send | required | Send notification |
| POST | /api/payments/:id/skip | required | Skip |
| POST | /api/payments/:id/tags | required | Add/upsert tag |
| DELETE | /api/payments/:id/tags/:tagId | required | Remove tag |
| POST | /api/upload/csv | required | DSK CSV file upload (source=UPLOAD) |
---
## Key Implementation Details
### auth.js (replaces entire old auth module)
```js
const PUBLIC_PATHS = new Set(['/api/health', '/api/payments/ingest']);
function authentikMiddleware(req, res, next) {
if (PUBLIC_PATHS.has(req.path)) return next();
const username = req.headers['x-authentik-username'];
if (!username) return res.status(401).json({ error: 'Unauthorized' });
req.user = {
username,
email: req.headers['x-authentik-email'] || null,
groups: (req.headers['x-authentik-groups'] || '').split(',').map(g => g.trim()).filter(Boolean),
};
next();
}
module.exports = { authentikMiddleware };
```
### csvParser.js (port of dskuploader.py)
- `iconv-lite` decodes buffer as cp1251 (DSK Bank export encoding), falls back to UTF-8
- `csv-parse` parses the decoded text with `columns: true`
- Columns: `Дата`, `Вид на трансакцията`, `Основание`, `Дебит BGN`, `Кредит BGN`, `Наредител/Получател`, `Номер сметка на наредителя / получателя`
- Card extraction: regex `/^\d{6}x{6}\d{4}$/` on first token of `Основание`
- Skips rows where `Вид на трансакцията === 'ТРАНСФЕР СОБСТВЕНИ СМЕТКИ'`
- Auto-tags via keyword rules (ЗАПЛАТА→Salary, LIDL→Groceries, NETFLIX→Subscriptions, etc.) — same logic as Python `generate_tags()`
- Returns `{ rows: PaymentData[], skipped: number, errors: string[] }`
### payments.js changes from payments-logger
1. Add `source: 'INGEST'` and `currency` to the `/ingest` create call
2. Add `source` to the `GET /` where clause filter
3. Add `sources` to `meta/filters` response
4. Currency-aware amount formatting in notification message
5. Remove all JWT/auth references (no `/auth/register`, `/auth/login`)
### upload.js (new)
- `multer` memory storage, max 10 files × 10 MB
- Calls `parseDskCsv(buffer)` per file
- Upserts tags via `prisma.tag.upsert` then connects
- Returns `{ imported, skipped, errors, payments[] }`
### Frontend changes
- **Delete**: `auth.js`, `AuthProvider.jsx`
- **main.jsx**: Remove `<AuthProvider>` wrapper
- **App.jsx**: Replace `authFetch` with plain `fetch` (Authentik session cookie travels automatically); logout → `window.location.href = '/outpost.goauthentik.io/sign_out'`; add "Payments" / "Upload CSV" tab toggle
- **FilterBar.jsx**: Add source `<select>` (All / SMS Ingest / CSV Upload); widen grid to 5 cols
- **PaymentTable.jsx**: Add `Source` column with `SMS` (indigo) / `CSV` (emerald) badge; show `${amount} ${currency}` in amount cell
- **UploadPanel.jsx** (new): Drag-and-drop zone + file list + import button + result summary with error accordion; calls `POST /api/upload/csv` with `FormData`
---
## Docker Compose
```yaml
services:
db:
image: postgres:16-alpine
environment: { POSTGRES_USER: finance, POSTGRES_PASSWORD: [PASSWORD] POSTGRES_DB: finance_hub }
volumes: [pgdata:/var/lib/postgresql/data]
healthcheck: { test: pg_isready -U finance -d finance_hub, interval: 5s }
backend:
build: ./backend
environment:
DATABASE_URL: [CONNECTION_STRING]
PORT: "3001"
NOTIFIER_URL: ${NOTIFIER_URL}
NOTIFIER_CHANNEL: ${NOTIFIER_CHANNEL:-viber}
NOTIFY_DEFAULT_PHONE: ${NOTIFY_DEFAULT_PHONE}
TZ: ${TZ:-Europe/Sofia}
ports: ["${BACKEND_PORT:-3001}:3001"]
depends_on: { db: { condition: service_healthy } }
frontend:
build: ./frontend
ports: ["${FRONTEND_PORT:-5175}:5173"]
depends_on: [backend]
volumes: { pgdata: }
```
**NPM setup:** Frontend port proxied through Authentik forward auth. Backend port exposed separately (unprotected) so the public `/api/payments/ingest` remains reachable by iOS Shortcuts / SMS gateways without login.
---
## Environment Variables (.env)
```bash
[ENV_SECRET]
NOTIFIER_URL=[URL_WITH_CREDENTIALS] @default(autoincrement())
rawMessage String @map("raw_message")
date DateTime?
type String?
card String?
recipient String?
amount Float?
currency String? @default("EUR")
balance Float?
source Source @default(INGEST)
status Status @default(UNPROCESSED)
tags Tag[]
notifiedAt DateTime? @map("notified_at")
notifyPhone String? @map("notify_phone")
debitBgn Float? @map("debit_bgn")
creditBgn Float? @map("credit_bgn")
transactionType String? @map("transaction_type")
payerAccount String? @map("payer_account")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("payments")
}
model Tag {
id Int @id @default(autoincrement())
name String @unique
color String @default("#6b7280")
payments Payment[]
@@map("tags")
}
enum Status {
UNPROCESSED
SENT
SKIPPED
}
enum Source {
INGEST
UPLOAD
}
Write
migration.sql
migration.sql
55 lines
-- CreateEnum
CREATE TYPE "Status" AS ENUM ('UNPROCESSED', 'SENT', 'SKIPPED');
CREATE TYPE "Source" AS ENUM ('INGEST', 'UPLOAD');
-- CreateTable
CREATE TABLE "payments" (
"id" SERIAL PRIMARY KEY,
"raw_message" TEXT NOT NULL,
"date" TIMESTAMP(3),
"type" TEXT,
"card" TEXT,
"recipient" TEXT,
"amount" DOUBLE PRECISION,
"currency" TEXT DEFAULT 'EUR',
"balance" DOUBLE PRECISION,
"source" "Source" NOT NULL DEFAULT 'INGEST',
"status" "Status" NOT NULL DEFAULT 'UNPROCESSED',
"notified_at" TIMESTAMP(3),
"notify_phone" TEXT,
"debit_bgn" DOUBLE PRECISION,
"credit_bgn" DOUBLE PRECISION,
"transaction_type" TEXT,
"payer_account" TEXT,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP
);
-- CreateTable
CREATE TABLE "tags" (
"id" SERIAL PRIMARY KEY,
"name" TEXT NOT NULL,
"color" TEXT NOT NULL DEFAULT '#6b7280'
);
-- CreateUniqueIndex
CREATE UNIQUE INDEX "tags_name_key" ON "tags"("name");
-- CreateTable (M2M join)
CREATE TABLE "_PaymentToTag" (
"A" INTEGER NOT NULL,
"B" INTEGER NOT NULL,
CONSTRAINT "_PaymentToTag_AB_pkey" PRIMARY KEY ("A", "B")
);
CREATE INDEX "_PaymentToTag_B_index" ON "_PaymentToTag"("B");
-- AddForeignKey
ALTER TABLE "_PaymentToTag"
ADD CONSTRAINT "_PaymentToTag_A_fkey"
FOREIGN KEY ("A") REFERENCES "payments"("id") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "_PaymentToTag"
ADD CONSTRAINT "_PaymentToTag_B_fkey"
FOREIGN KEY ("B") REFERENCES "tags"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Write
migration_lock.toml
migration_lock.toml
4 lines
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"
Update Todos
Create folder structure and root config files
Write backend Prisma schema and migration
Write backend package.json and Dockerfile
Write backend src files (auth, parser, csvParser, index)
Write backend routes (payments.js, upload.js)
Write frontend config files
Write frontend React components
Build and verify with docker compose
Write
package.json
package.json
26 lines
{
"name": "finance-hub-backend",
"version": "1.0.0",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js",
"dev": "nodemon src/index.js",
"prisma:generate": "prisma generate",
"prisma:migrate": "prisma migrate deploy"
},
"dependencies": {
"@prisma/client": "^5.22.0",
"cors": "^2.8.5",
"csv-parse": "^5.5.6",
"express": "^4.21.1",
"express-rate-limit": "^7.4.0",
"iconv-lite": "^0.6.3",
"morgan": "^1.10.0",
"multer": "^1.4.5-lts.1"
},
"devDependencies": {
"nodemon": "^3.1.7",
"prisma": "^5.22.0"
}
}
Write
Dockerfile
Dockerfile
18 lines
FROM node:20-alpine
RUN apk add --no-cache openssl
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install
COPY prisma ./prisma
RUN npx prisma generate
COPY src ./src
EXPOSE 3001
CMD ["sh", "-c", "npx prisma migrate deploy && node src/index.js"]
Update Todos
Create folder structure and root config files
Write backend Prisma schema and migration
Write backend package.json and Dockerfile
Write backend src files (auth, parser, csvParser, index)
Write backend routes (payments.js, upload.js)
Write frontend config files
Write frontend React components
Build and verify with docker compose
Write
auth.js
auth.js
27 lines
const PUBLIC_PATHS = new Set([
'/api/health',
'/api/payments/ingest',
]);
function authentikMiddleware(req, res, next) {
if (PUBLIC_PATHS.has(req.path)) return next();
const username = req.headers['x-authentik-username'];
if (!username) {
return res.status(401).json({ error: 'Unauthorized — missing Authentik session' });
}
req.user = {
username,
email: req.headers['x-authentik-email'] || null,
groups: (req.headers['x-authentik-groups'] || '')
.split(',')
.map(g => g.trim())
.filter(Boolean),
};
next();
}
module.exports = { authentikMiddleware };
Write
parser.js
parser.js
104 lines
/**
* Parses SMS payment messages from Bulgarian banks (DSK Bank, etc.)
*
* Supported formats:
*
* POS / INTERNET / ECOM / P2P payment:
* DSK Bank. Na DD/MM/YYYY v HH:MM sa plateni AMOUNT CURRENCY s karta CARD na POS s adres: RECIPIENT. Nalichni: BALANCE CURRENCY.
*
* ATM withdrawal:
* DSK Bank. Na DD/MM/YYYY v HH:MM sa iztegleni AMOUNT CURRENCY s karta CARD ot ATM s adres: RECIPIENT. Nalichni: BALANCE CURRENCY.
*
* ATM utility payment (amount may include fee as AMOUNT/FEE):
* DSK Bank. Na DD/MM/YYYY v HH:MM sa plateni AMOUNT CURRENCY/FEE CURRENCY s karta CARD na ATM s adres:RECIPIENT. Nalichni: BALANCE CURRENCY.
*/
const LOCAL_TZ = process.env.TZ || 'Europe/Sofia';
/**
* Convert a local-timezone date/time to a UTC Date object.
* Uses Intl to resolve the actual UTC offset (DST-aware).
*/
function localToUtc(year, month, day, hour, minute) {
const naive = new Date(Date.UTC(year, month - 1, day, hour, minute, 0));
const formatter = new Intl.DateTimeFormat('en-US', {
timeZone: LOCAL_TZ,
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit', second: '2-digit',
hour12: false,
});
const parts = {};
formatter.formatToParts(naive).forEach(p => { parts[p.type] = p.value; });
const localAtNaive = new Date(Date.UTC(
parseInt(parts.year), parseInt(parts.month) - 1, parseInt(parts.day),
parseInt(parts.hour) % 24, parseInt(parts.minute), parseInt(parts.second),
));
const offsetMs = localAtNaive.getTime() - naive.getTime();
return new Date(Date.UTC(year, month - 1, day, hour, minute, 0) - offsetMs);
}
function parsePaymentSms(message) {
const result = {
rawMessage: message,
date: null,
type: null,
card: null,
recipient: null,
amount: null,
balance: null,
};
// Date and time: "Na DD/MM/YYYY v HH:MM"
const dateMatch = message.match(/Na (\d{2})\/(\d{2})\/(\d{4}) v (\d{2}):(\d{2})/i);
if (dateMatch) {
const [, day, month, year, hour, minute] = dateMatch;
result.date = localToUtc(
parseInt(year), parseInt(month), parseInt(day),
parseInt(hour), parseInt(minute),
);
}
// Card mask: "s karta 400915***4447" or "s karta 483890***7162"
const cardMatch = message.match(/s karta\s+([\d*]+)/i);
if (cardMatch) {
result.card = cardMatch[1];
}
// Transaction type: supports both prepositions
// "na POS" / "na ATM" / "na INTERNET" etc. (payment)
// "ot ATM" (withdrawal)
const typeMatch = message.match(/(?:na|ot)\s+(POS|ATM|INTERNET|ECOM|P2P)\b/i);
if (typeMatch) {
result.type = typeMatch[1].toUpperCase();
}
// Recipient address: "s adres: MERCHANT" or "s adres:MERCHANT" (no space variant)
const recipientMatch = message.match(/s adres:\s*([^.]+)\./i);
if (recipientMatch) {
result.recipient = recipientMatch[1].trim();
}
// Amount: handles both verbs and the AMOUNT/FEE suffix format
// "sa plateni 7.78 EUR"
// "sa iztegleni 400.00 EUR"
// "sa plateni 0.50 EUR/0.50 EUR" → captures 0.50 (the charged amount, ignoring fee)
const amountMatch = message.match(/sa (?:plateni|iztegleni)\s+([\d.,]+)\s+[A-Z]{3}/i);
if (amountMatch) {
result.amount = parseFloat(amountMatch[1].replace(',', '.'));
}
// Balance: "Nalichni: 2583.07 EUR."
const balanceMatch = message.match(/Nalichni:\s*([\d.,]+)\s+[A-Z]{3}/i);
if (balanceMatch) {
result.balance = parseFloat(balanceMatch[1].replace(',', '.'));
}
return result;
}
module.exports = { parsePaymentSms };
Write
csvParser.js
csvParser.js
175 lines
/**
* DSK Bank CSV parser — Node.js port of dskuploader.py
*
* DSK Bank exports use Windows-1251 (cp1251) encoding.
* Each row maps to a Payment record with source=UPLOAD, currency=BGN.
*/
const { parse } = require('csv-parse');
const iconv = require('iconv-lite');
const SKIP_TYPE = 'ТРАНСФЕР СОБСТВЕНИ СМЕТКИ';
const CARD_REGEX = /^\d{6}x{6}\d{4}$/;
const POS_REGEX = /^\s*ПЛАЩАНЕ\s+НА\s+ПОС\s+\d{2}\.\d{2}\.\d{4}\s+\d{2}:\d{2}/;
const COL = {
DATE: 'Дата',
TYPE: 'Вид на трансакцията',
REASON: 'Основание',
DEBIT: 'Дебит BGN',
CREDIT: 'Кредит BGN',
PAYEE: 'Наредител/Получател',
ACCT: 'Номер сметка на наредителя / получателя',
};
const TAG_RULES = [
['reason', 'ЗАПЛАТА', 'Salary'],
['reason', 'ТЕГЛЕНЕ НА ATM', 'ATM'],
['reason', 'ПЛАЩАНЕ ПО ЗАЕМ', 'Home Credit'],
['reason', 'АВТ.ТАКСА ОБСЛУЖВАНЕ', 'Bills'],
['transactionType', 'КОМУНАЛНИ УСЛУГИ', 'Bills'],
['payee', 'VIVACOM', 'Subscriptions'],
['payee', 'Google', 'Subscriptions'],
['payee', 'SkyShowtime', 'Subscriptions'],
['payee', 'NETFLIX', 'Subscriptions'],
['payee', 'LUKOIL', 'Bills'],
['payee', 'CityGate', 'Bills'],
['payee', 'CBA', 'Groceries'],
['payee', 'FANTASTICO', 'Groceries'],
['payee', 'LIDL', 'Groceries'],
];
function parseNum(val) {
if (val == null || val === '') return null;
if (typeof val === 'number') return isNaN(val) ? null : val;
const s = String(val).trim().replace(/\xa0/g, '').replace(/ /g, '').replace(',', '.');
const n = parseFloat(s);
return isNaN(n) ? null : n;
}
function parseDate(val) {
if (!val) return null;
const s = String(val).trim();
const m = s.match(/^(\d{2})\.(\d{2})\.(\d{4})$/);
if (m) {
return new Date(Date.UTC(parseInt(m[3]), parseInt(m[2]) - 1, parseInt(m[1])));
}
return null;
}
function processReasonAndCard(reason) {
if (!reason || typeof reason !== 'string') return { reason: '', card: null };
const parts = reason.trim().split(' ');
let card = null;
let cleanReason = reason.trim();
if (parts[0] && CARD_REGEX.test(parts[0])) {
card = parts[0];
cleanReason = parts.slice(1).join(' ').trim();
}
if (POS_REGEX.test(cleanReason)) {
const posParts = cleanReason.split('<br/>');
try {
const dateTime = posParts[0].split('ПОС ')[1];
cleanReason = `POS PAYMENT ${dateTime}`;
} catch (_) { /* keep original */ }
}
return { reason: cleanReason.replace(/\s+/g, ' ').trim(), card };
}
function generateTags(fields) {
const tags = new Set();
for (const [field, keyword, tagName] of TAG_RULES) {
if ((fields[field] || '').includes(keyword)) {
tags.add(tagName);
}
}
return Array.from(tags);
}
function processRow(row) {
const transactionType = (row[COL.TYPE] || '').trim();
if (transactionType === SKIP_TYPE) return null;
const { reason, card } = processReasonAndCard(row[COL.REASON]);
const payee = (row[COL.PAYEE] || '').trim();
const payerAccount = (row[COL.ACCT] || '').trim();
const debitBgn = parseNum(row[COL.DEBIT]);
const creditBgn = parseNum(row[COL.CREDIT]);
const date = parseDate(row[COL.DATE]);
const autoTags = generateTags({ reason, transactionType, payee, debitBgn, creditBgn });
const amount = debitBgn ?? creditBgn ?? null;
const rawMessage = [
row[COL.DATE] && `Date: ${row[COL.DATE]}`,
transactionType && `Type: ${transactionType}`,
payee && `Payee: ${payee}`,
debitBgn != null && `Debit: ${debitBgn} BGN`,
creditBgn != null && `Credit: ${creditBgn} BGN`,
].filter(Boolean).join(' | ');
return {
rawMessage,
date,
type: null,
card,
recipient: payee || null,
amount,
currency: 'BGN',
balance: null,
source: 'UPLOAD',
debitBgn,
creditBgn,
transactionType: transactionType || null,
payerAccount: payerAccount || null,
autoTags,
};
}
/**
* Parse a Buffer containing a DSK Bank CSV (cp1251 or UTF-8).
* Returns { rows, skipped, errors }.
*/
async function parseDskCsv(buffer) {
// Try cp1251 first (DSK Bank export encoding), fall back to UTF-8
let text = iconv.decode(buffer, 'cp1251');
if (!text.includes(COL.DATE)) {
text = buffer.toString('utf-8');
}
return new Promise((resolve, reject) => {
const rows = [];
const errors = [];
let skipped = 0;
const parser = parse(text, {
columns: true,
skip_empty_lines: true,
trim: true,
relax_column_count: true,
});
parser.on('readable', () => {
let record;
while ((record = parser.read()) !== null) {
try {
const row = processRow(record);
if (row === null) { skipped++; } else { rows.push(row); }
} catch (err) {
errors.push(err.message);
}
}
});
parser.on('error', reject);
parser.on('end', () => resolve({ rows, skipped, errors }));
});
}
module.exports = { parseDskCsv };
Write
index.js
index.js
39 lines
const express = require('express');
const cors = require('cors');
const morgan = require('morgan');
const rateLimit = require('express-rate-limit');
const { authentikMiddleware } = require('./auth');
const paymentsRouter = require('./routes/payments');
const uploadRouter = require('./routes/upload');
const app = express();
const PORT = process.env.PORT || 3001;
app.use(cors());
app.use(express.json({ limit: '16kb' }));
app.use(morgan('combined'));
// Rate-limit the public ingest endpoint before auth middleware
const ingestLimiter = rateLimit({
windowMs: 60 * 1000,
max: 200,
standardHeaders: true,
legacyHeaders: false,
message: { error: 'Too many requests, slow down' },
});
app.use('/api/payments/ingest', ingestLimiter);
// Authentik header auth (skips /api/health and /api/payments/ingest)
app.use(authentikMiddleware);
app.get('/api/health', (_req, res) => {
res.json({ status: 'ok', timestamp: new Date().toISOString() });
});
app.use('/api/payments', paymentsRouter);
app.use('/api/upload', uploadRouter);
app.listen(PORT, '[IP_ADDRESS]', () => {
console.log(`Finance Hub API running on port ${PORT}`);
});
Update Todos
Create folder structure and root config files
Write backend Prisma schema and migration
Write backend package.json and Dockerfile
Write backend src files (auth, parser, csvParser, index)
Write backend routes (payments.js, upload.js)
Write frontend config files
Write frontend React components
Build and verify with docker compose
Write
payments.js
payments.js
399 lines
const express = require('express');
const { PrismaClient } = require('@prisma/client');
const { parsePaymentSms } = require('../pa...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Explorer (⇧⌘E)","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":true},{"role":"AXStaticText","text":"","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Search (⇧⌘F)","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Source Control (⌃⇧G)","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Run and Debug (⇧⌘D)","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Remote Explorer","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Extensions (⇧⌘X) - 2 require update","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Claude Code","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Containers","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"EXPLORER","depth":17,"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"EXPLORER","depth":18,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Explorer Section: finance [SSH: nas]","depth":21,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"Explorer Section: finance [SSH: nas]","depth":22,"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"FINANCE [SSH: NAS]","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"auth","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"dsk-uploader","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"finance-hub","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".env","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".env.example","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".gitignore","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"docker-compose.yml","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"payments-logger","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Outline Section","depth":21,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"OUTLINE","depth":22,"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"OUTLINE","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Timeline Section","depth":21,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"TIMELINE","depth":22,"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"TIMELINE","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"docker-compose.yml, Editor Group 1","depth":28,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":".env, Editor Group 1","depth":28,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"","depth":29,"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"# ── Database ───────────────────────────────────────────────────────────────────\nDB_PASSWORD=payments_secret\n\n# ── Notifier service ──────────────────────────────────────────────────────────\nNOTIFIER_URL=https://notifier.lakylak.xyz\nNOTIFIER_CHANNEL=viber\nNOTIFY_DEFAULT_PHONE=+359000000000\n\n# ── Timezone ─────────────────────────────────────────────────────────────────\nTZ=Europe/Sofia\n\n# ── Dev only — remove when NPM + Authentik is wired up ───────────────────────\nDEV_BYPASS_AUTH=true","depth":28,"on_screen":true,"value":"# ── Database ───────────────────────────────────────────────────────────────────\nDB_PASSWORD=payments_secret\n\n# ── Notifier service ──────────────────────────────────────────────────────────\nNOTIFIER_URL=https://notifier.lakylak.xyz\nNOTIFIER_CHANNEL=viber\nNOTIFY_DEFAULT_PHONE=+359000000000\n\n# ── Timezone ─────────────────────────────────────────────────────────────────\nTZ=Europe/Sofia\n\n# ── Dev only — remove when NPM + Authentik is wired up ───────────────────────\nDEV_BYPASS_AUTH=true","role_description":"editor","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"# ── Database ───────────────────────────────────────────────────────────────────\nDB_PASSWORD=payments_secret\n\n# ── Notifier service ──────────────────────────────────────────────────────────\nNOTIFIER_URL=https://notifier.lakylak.xyz\nNOTIFIER_CHANNEL=viber\nNOTIFY_DEFAULT_PHONE=+359000000000\n\n# ── Timezone ─────────────────────────────────────────────────────────────────\nTZ=Europe/Sofia\n\n# ── Dev only — remove when NPM + Authentik is wired up ───────────────────────\nDEV_BYPASS_AUTH=true","depth":29,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"remote SSH: nas","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SSH: nas","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"No Problems","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"No Ports Forwarded","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Notifications","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sign In","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sign In","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Info: Do you want to install the recommended 'Rainbow CSV' extension from mechatroner for report(1).csv?","depth":12,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Design new payment-logger and dsk-uploader hybrid app","depth":19,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Session history","depth":19,"on_screen":true,"help_text":"Session history","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New session","depth":19,"on_screen":true,"help_text":"New session","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Message actions","depth":24,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"payments.js","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"payments.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ets create a new app that should be combination of payment-logger and dsk-uploader. It should have authorization via authentik (auth folder). All three folders (payment-logger, dsk-uploader and auth) are just refference these will be removed later. Auth project is separated it lives on its own. First reveiw them and see how these should be combined. It will be whole new app (also the folder name). Think very carefully of whatr these two apps do and how cold they be combined. THerer should be common db and uploader should store data the same way the /ingest does. It should be properly marked in UI if it is upload or ingest or both. FIrst think of tech stack and plan carefully.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"I'll explore all three reference projects in parallel to understand their structure before planning.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore payment-logger app structure and functionality","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore the /volume2/docker/finance/payments-logger directory thoroughly. I need to understand:\n1. Tech stack (frontend framework, backend framework, database)\n2. What the app does - its core purpose and features\n3. Database schema - all tables, relationships\n4. API routes - all endpoints, their purpose and request/response shapes\n5. How data flows (ingest, storage, retrieval)\n6. Any auth/middleware setup\n7. Docker/deployment setup\n8. Key files and their roles\n\nReport with: directory structure, tech stack summary, database schema details, all API endpoints listed, UI features, and how data is ingested. Be thorough on the /ingest endpoint specifically.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore dsk-uploader app structure and functionality","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore the /volume2/docker/finance/dsk-uploader directory thoroughly. I need to understand:\n1. Tech stack (frontend framework, backend framework, database)\n2. What the app does - its core purpose and features\n3. Database schema - all tables, relationships\n4. API routes - all endpoints, their purpose and request/response shapes\n5. How file uploads work - what files, what format, how parsed\n6. Any auth/middleware setup\n7. Docker/deployment setup\n8. Key files and their roles\n\nReport with: directory structure, tech stack summary, database schema details, all API endpoints listed, UI features, how file upload parsing works, and what data is extracted from uploads. Be very thorough about the data model and what fields are stored.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore auth folder and authentik integration","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore the /volume2/docker/finance/auth directory thoroughly. I need to understand:\n1. What auth system is being used (Authentik)\n2. How authentication/authorization is implemented - OAuth2, OIDC, session tokens, JWT?\n3. Middleware - how is auth enforced on routes?\n4. Any frontend auth flow - login redirect, token handling, protected routes\n5. Environment variables related to auth\n6. Docker/deployment setup for the auth service itself\n7. Any example of how other apps integrate with this auth\n\nReport with: directory structure, auth flow description, middleware code, environment variable names, and integration patterns. This is a reference for building auth into a new combined app.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Message actions","depth":24,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"payments.js","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"payments.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"continue","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Launching parallel exploration of all three reference projects.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore payment-logger app structure","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore the /volume2/docker/finance/payments-logger directory thoroughly. I need to understand:\n1. Full directory structure (tree)\n2. Tech stack (frontend framework, backend framework, database, etc.)\n3. What the app does - its core functionality\n4. How data is ingested (look at /ingest route especially)\n5. Database schema (what tables/collections exist)\n6. API routes and their purposes\n7. Frontend pages and components\n8. Docker setup\n9. Any auth/session handling\n\nPlease read key files: package.json files, main entry points, route files, database schema files, docker-compose.yml, and any frontend components. Be thorough - I need a complete picture to plan a new combined app.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore dsk-uploader app structure","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore the /volume2/docker/finance/dsk-uploader directory thoroughly. I need to understand:\n1. Full directory structure (tree)\n2. Tech stack (frontend framework, backend framework, database, etc.)\n3. What the app does - its core functionality\n4. How file uploads work (what format, what processing happens)\n5. Database schema (what tables/collections exist)\n6. API routes and their purposes\n7. Frontend pages and components\n8. Docker setup\n9. Any auth/session handling\n\nPlease read key files: package.json files, main entry points, route files, database schema files, docker-compose.yml, and any frontend components. Be thorough - I need a complete picture to plan a new combined app.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore auth project structure","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Explore the /volume2/docker/finance/auth directory thoroughly. I need to understand:\n1. Full directory structure (tree)\n2. What authentication system is used (authentik integration details)\n3. How OAuth/OIDC flow works\n4. Any middleware or helper functions for protecting routes\n5. Session management approach\n6. How frontend handles auth state\n7. Any example of how other apps integrate with this auth system\n8. Docker setup and environment variables\n\nPlease read all files carefully - this auth system will be integrated into a new combined app. I need to understand exactly how to use it.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Now I have a complete picture of all three. Let me design the plan.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Agent:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Design combined app architecture","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Design a detailed implementation plan for a new combined web app that merges two existing applications. Here is full context:\n\n---\n\n## App 1: payments-logger (Node.js)\n- **Purpose**: Ingest Bulgarian bank SMS → parse → store in PostgreSQL → review/tag/notify in React UI\n- **Stack**: Node.js 20 + Express + Prisma 5 + PostgreSQL 16 + React 18 + Vite + Tailwind CSS\n- **Auth**: Custom JWT (bcryptjs + jose), tokens in localStorage\n- **Ingest**: POST /api/payments/ingest (public) — SMS text OR structured JSON (Apple Wallet)\n- **Schema** (PostgreSQL via Prisma):\n - `payments` table: id, raw_message, date, type (POS/ATM/INTERNET/ECOM/P2P/WALLET), card, recipient, amount, balance, status (UNPROCESSED/SENT/SKIPPED), notifyPhone, notifiedAt, created_at, updated_at\n - `tags` table: id, name, color — M2M with payments via `_PaymentToTag`\n - `users` table: id, username, hashed_password (this will be REMOVED)\n- **UI**: Single-page React app — PaymentTable (sortable, filterable, taggable), FilterBar, status actions (send/skip), notification system\n- **Parser** (backend/src/parser.js): Regex parser for Bulgarian DSK Bank SMS, extracts date/time (DD/MM/YYYY HH:MM), card mask, transaction type, recipient, amount, balance\n\n## App 2: dsk-uploader (Python/Flask)\n- **Purpose**: Upload DSK bank CSV exports → parse/normalize → upload to Notion database\n- **Stack**: Python 3.11 + Flask + Pandas + Custom Notion SDK + Bootstrap 5\n- **Auth**: None (open)\n- **CSV format** (DSK Bank Bulgarian format, columns):\n - `Дата` (date, DD.MM.YYYY)\n - `Вид на трансакцията` (transaction type, Bulgarian)\n - `Основание` (reason/description — contains card number regex: `^\\d{6}x{6}\\d{4}$`)\n - `Дебит BGN` (debit amount, may be empty)\n - `Кредит BGN` (credit amount, may be empty)\n - `Наредител/Получател` (orderer/recipient name)\n - `Номер сметка на наредителя / получателя` (account number)\n- **Processing**: merge multiple CSVs, normalize dates, extract card numbers from reason via regex, auto-generate tags (keyword heuristics: ЗАПЛАТА→Salary, NETFLIX→Subscriptions, etc.), filter internal transfers\n- **Output**: Notion database pages (this will be REPLACED with local PostgreSQL)\n\n## App 3: auth (Authentik)\n- **Mode**: Proxy mode via NPM (forward auth)\n- **How it works**: NPM intercepts all requests, calls Authentik outpost's auth endpoint. On success, NPM injects headers into proxied request:\n - `X-authentik-username` \n - `X-authentik-email`\n - `X-authentik-groups`\n- **No code integration needed** in the app itself — just trust these headers from NPM\n- **Logout**: Redirect user to `/outpost.goauthentik.io/sign_out`\n\n---\n\n## What the New Combined App Must Do\n\n1. **Single PostgreSQL database** for all transactions\n2. **SMS Ingest** (public endpoint) — same as payments-logger /ingest, source=INGEST\n3. **CSV Upload** (authenticated) — parse DSK CSV files, store transactions with source=UPLOAD into the same DB schema\n4. **Unified UI** — show all payments in one table regardless of source\n5. **Source indicator** in UI — badge showing \"INGEST\", \"UPLOAD\", or \"BOTH\" (if duplicate detection added)\n6. **Source filter** in FilterBar — filter by All/Ingest/Upload\n7. **Authentik auth** — remove custom JWT entirely; trust X-authentik-* headers from NPM\n8. **All existing payments-logger features**: tagging, send notification, skip, status tracking, filters, sorting, pagination\n9. **Remove Notion dependency entirely** — all data stays in local PostgreSQL\n\n---\n\n## Technical Constraints\n\n- Keep Node.js backend (not Python) — extend payments-logger's stack\n- CSV parsing: use `csv-parse` npm package (handles encoding, streaming)\n- File upload: use `multer` npm middleware\n- Auth middleware: read X-authentik-username header, 401 if missing (but /api/payments/ingest stays public)\n- Add `source` enum field (INGEST/UPLOAD) to payments schema\n- Add `currency` field (EUR for SMS ingest, BGN for CSV uploads) — or just store as-is\n- Remove `users` table from schema\n\n---\n\n## Please Design\n\n1. Complete folder structure for the new app (suggest name: \"finance-hub\" or similar — note this is a placeholder, user will confirm)\n2. Prisma schema with new fields (`source`, `currency`)\n3. All backend API routes\n4. CSV parser design in Node.js (port of the Python logic)\n5. Authentik auth middleware\n6. Frontend component structure (React) — what's reused from payments-logger, what's new\n7. Docker Compose setup\n8. Environment variables needed\n9. Step-by-step implementation order\n10. Verification checklist\n\nBe specific about file paths and code structure. This will be used to write actual implementation code.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Good plan. Let me ask the one thing I need before writing the final plan.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AskUserQuestion","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"OUT","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"User has answered your questions: \"What should the new combined app be called? This will be the folder name under /volume2/docker/finance/ and the app branding.\"=\"finance-hub\". You can now continue with the user's answers in mind.","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Writing the final plan now.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"ets-create-a-new-generic-sun.md","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"ets-create-a-new-generic-sun.md","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"326 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"# finance-hub — Implementation Plan\n\n## Context\n\nTwo separate finance apps exist as references and will be retired:\n- **payments-logger** (Node.js/React): Ingests Bulgarian bank SMS notifications, stores payments in PostgreSQL, provides a review/tag/notify UI.\n- **dsk-uploader** (Python/Flask): Uploads DSK bank CSV exports, parses them, sends to Notion.\n\nThe new app **finance-hub** (`/volume2/docker/finance/finance-hub/`) replaces both with a single unified system: all transactions (SMS-ingested and CSV-uploaded) land in one PostgreSQL database and one React UI. Authentication is delegated entirely to Authentik (proxy mode via NPM — no custom JWT).\n\n---\n\n## Tech Stack\n\n| Layer | Choice | Rationale |\n|-------|--------|-----------|\n| Backend | Node.js 20 + Express + Prisma 5 | Extends payments-logger; no Python needed |\n| CSV parsing | `csv-parse` + `iconv-lite` | Handles Bulgarian cp1251 encoding, RFC4180 quoted fields |\n| File upload | `multer` (memory storage) | Bank CSVs are small (<500 KB), no disk cleanup needed |\n| Database | PostgreSQL 16 | Same as payments-logger |\n| Frontend | React 18 + Vite + Tailwind CSS + Lucide React | Same as payments-logger |\n| Auth | Authentik proxy via NPM headers | No custom JWT; removes users table entirely |\n| Container | Docker Compose | Same pattern as both reference apps |\n\n**Removed vs payments-logger:** `bcryptjs`, `jose`, `users` table, login form, JWT storage. \n**Removed vs dsk-uploader:** Python/Flask, Pandas, Notion SDK, all Notion references. \n**Added:** `csv-parse`, `iconv-lite`, `multer`, `source` + `currency` fields, `UploadPanel` component.\n\n---\n\n## Folder Structure\n\n```\n/volume2/docker/finance/finance-hub/\n├── docker-compose.yml\n├── .env\n├── .env.example\n├── .gitignore\n├── backend/\n│ ├── Dockerfile\n│ ├── package.json\n│ ├── prisma/\n│ │ ├── schema.prisma\n│ │ └── migrations/\n│ │ ├── migration_lock.toml\n│ │ └── 20260508_init/\n│ │ └── migration.sql\n│ └── src/\n│ ├── index.js ← entry point (Authentik middleware wired here)\n│ ├── auth.js ← Authentik header middleware (replaces JWT auth)\n│ ├── parser.js ← SMS parser (copy verbatim from payments-logger)\n│ ├── csvParser.js ← NEW: DSK CSV parser (port of Python dskuploader.py)\n│ └── routes/\n│ ├── payments.js ← existing routes + source/currency additions\n│ └── upload.js ← NEW: POST /api/upload/csv\n└── frontend/\n ├── Dockerfile\n ├── package.json\n ├── vite.config.js\n ├── tailwind.config.js\n ├── postcss.config.js\n ├── index.html\n └── src/\n ├── main.jsx ← remove AuthProvider wrapper\n ├── index.css\n ├── App.jsx ← remove auth state, add Upload tab toggle\n └── components/\n ├── FilterBar.jsx ← add source filter select\n ├── PaymentTable.jsx ← add Source badge column + currency display\n ├── PaymentCard.jsx ← minor source badge addition\n ├── PaymentList.jsx ← unchanged\n └── UploadPanel.jsx ← NEW: drag-and-drop CSV upload UI\n```\n\n---\n\n## Database Schema (Prisma)\n\nFile: `backend/prisma/schema.prisma`\n\n```prisma\ngenerator client {\n provider = \"prisma-client-js\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_URL\")\n}\n\nmodel Payment {\n id Int @id @default(autoincrement())\n rawMessage String @map(\"raw_message\")\n date DateTime?\n type String?\n card String?\n recipient String?\n amount Float?\n currency String? @default(\"EUR\")\n balance Float?\n source Source @default(INGEST)\n status Status @default(UNPROCESSED)\n tags Tag[]\n notifiedAt DateTime? @map(\"notified_at\")\n notifyPhone String? @map(\"notify_phone\")\n debitBgn Float? @map(\"debit_bgn\")\n creditBgn Float? @map(\"credit_bgn\")\n transactionType String? @map(\"transaction_type\")\n payerAccount String? @map(\"payer_account\")\n createdAt DateTime @default(now()) @map(\"created_at\")\n updatedAt DateTime @updatedAt @map(\"updated_at\")\n\n @@map(\"payments\")\n}\n\nmodel Tag {\n id Int @id @default(autoincrement())\n name String @unique\n color String @default(\"#6b7280\")\n payments Payment[]\n\n @@map(\"tags\")\n}\n\nenum Status { UNPROCESSED SENT SKIPPED }\nenum Source { INGEST UPLOAD }\n```\n\n**Key decisions:**\n- No `User` model — Authentik owns identity.\n- `currency`: `EUR` for SMS ingest, `BGN` for CSV uploads.\n- `debitBgn`, `creditBgn`, `transactionType`, `payerAccount`: nullable CSV-only columns; INGEST rows store nulls. Avoids a union query for the unified list view.\n- `balance` is always null for CSV rows (DSK export does not include running balance).\n- Fresh consolidated migration — no data migration from reference apps required.\n\n---\n\n## API Routes\n\n| Method | Path | Auth | Description |\n|--------|------|------|-------------|\n| GET | /api/health | public | Health check |\n| POST | /api/payments/ingest | public | SMS or structured ingest (source=INGEST) |\n| GET | /api/payments | required | List with filters/sort/pagination (+ source filter) |\n| GET | /api/payments/meta/tags | required | All tags |\n| GET | /api/payments/meta/filters | required | Filter options incl. `sources` array |\n| GET | /api/payments/:id | required | Single payment |\n| PATCH | /api/payments/:id | required | Update status |\n| DELETE | /api/payments/:id | required | Delete |\n| POST | /api/payments/:id/send | required | Send notification |\n| POST | /api/payments/:id/skip | required | Skip |\n| POST | /api/payments/:id/tags | required | Add/upsert tag |\n| DELETE | /api/payments/:id/tags/:tagId | required | Remove tag |\n| POST | /api/upload/csv | required | DSK CSV file upload (source=UPLOAD) |\n\n---\n\n## Key Implementation Details\n\n### auth.js (replaces entire old auth module)\n```js\nconst PUBLIC_PATHS = new Set(['/api/health', '/api/payments/ingest']);\n\nfunction authentikMiddleware(req, res, next) {\n if (PUBLIC_PATHS.has(req.path)) return next();\n const username = req.headers['x-authentik-username'];\n if (!username) return res.status(401).json({ error: 'Unauthorized' });\n req.user = {\n username,\n email: req.headers['x-authentik-email'] || null,\n groups: (req.headers['x-authentik-groups'] || '').split(',').map(g => g.trim()).filter(Boolean),\n };\n next();\n}\nmodule.exports = { authentikMiddleware };\n```\n\n### csvParser.js (port of dskuploader.py)\n- `iconv-lite` decodes buffer as cp1251 (DSK Bank export encoding), falls back to UTF-8\n- `csv-parse` parses the decoded text with `columns: true`\n- Columns: `Дата`, `Вид на трансакцията`, `Основание`, `Дебит BGN`, `Кредит BGN`, `Наредител/Получател`, `Номер сметка на наредителя / получателя`\n- Card extraction: regex `/^\\d{6}x{6}\\d{4}$/` on first token of `Основание`\n- Skips rows where `Вид на трансакцията === 'ТРАНСФЕР СОБСТВЕНИ СМЕТКИ'`\n- Auto-tags via keyword rules (ЗАПЛАТА→Salary, LIDL→Groceries, NETFLIX→Subscriptions, etc.) — same logic as Python `generate_tags()`\n- Returns `{ rows: PaymentData[], skipped: number, errors: string[] }`\n\n### payments.js changes from payments-logger\n1. Add `source: 'INGEST'` and `currency` to the `/ingest` create call\n2. Add `source` to the `GET /` where clause filter\n3. Add `sources` to `meta/filters` response\n4. Currency-aware amount formatting in notification message\n5. Remove all JWT/auth references (no `/auth/register`, `/auth/login`)\n\n### upload.js (new)\n- `multer` memory storage, max 10 files × 10 MB\n- Calls `parseDskCsv(buffer)` per file\n- Upserts tags via `prisma.tag.upsert` then connects\n- Returns `{ imported, skipped, errors, payments[] }`\n\n### Frontend changes\n- **Delete**: `auth.js`, `AuthProvider.jsx`\n- **main.jsx**: Remove `<AuthProvider>` wrapper\n- **App.jsx**: Replace `authFetch` with plain `fetch` (Authentik session cookie travels automatically); logout → `window.location.href = '/outpost.goauthentik.io/sign_out'`; add \"Payments\" / \"Upload CSV\" tab toggle\n- **FilterBar.jsx**: Add source `<select>` (All / SMS Ingest / CSV Upload); widen grid to 5 cols\n- **PaymentTable.jsx**: Add `Source` column with `SMS` (indigo) / `CSV` (emerald) badge; show `${amount} ${currency}` in amount cell\n- **UploadPanel.jsx** (new): Drag-and-drop zone + file list + import button + result summary with error accordion; calls `POST /api/upload/csv` with `FormData`\n\n---\n\n## Docker Compose\n\n```yaml\nservices:\n db:\n image: postgres:16-alpine\n environment: { POSTGRES_USER: finance, POSTGRES_PASSWORD: ${DB_PASSWORD}, POSTGRES_DB: finance_hub }\n volumes: [pgdata:/var/lib/postgresql/data]\n healthcheck: { test: pg_isready -U finance -d finance_hub, interval: 5s }\n\n backend:\n build: ./backend\n environment:\n DATABASE_URL: postgresql://finance:${DB_PASSWORD}@db:5432/finance_hub\n PORT: \"3001\"\n NOTIFIER_URL: ${NOTIFIER_URL}\n NOTIFIER_CHANNEL: ${NOTIFIER_CHANNEL:-viber}\n NOTIFY_DEFAULT_PHONE: ${NOTIFY_DEFAULT_PHONE}\n TZ: ${TZ:-Europe/Sofia}\n ports: [\"${BACKEND_PORT:-3001}:3001\"]\n depends_on: { db: { condition: service_healthy } }\n\n frontend:\n build: ./frontend\n ports: [\"${FRONTEND_PORT:-5175}:5173\"]\n depends_on: [backend]\n\nvolumes: { pgdata: }\n```\n\n**NPM setup:** Frontend port proxied through Authentik forward auth. Backend port exposed separately (unprotected) so the public `/api/payments/ingest` remains reachable by iOS Shortcuts / SMS gateways without login.\n\n---\n\n## Environment Variables (.env)\n\n```bash\nDB_PASSWORD=change_me\nNOTIFIER_URL=https://notifier.lakylak.xyz\nNOTIFIER_CHANNEL=viber\nNOTIFY_DEFAULT_PHONE=+359000000000\nTZ=Europe/Sofia\nBACKEND_PORT=3001\nFRONTEND_PORT=5175\n```\n\nRemoved vs payments-logger: `JWT_SECRET`, `JWT_EXPIRE_MINUTES`.\n\n---\n\n## Implementation Order\n\n1. Create folder structure and write `docker-compose.yml`, `.env.example`, `.gitignore`\n2. Write `backend/prisma/schema.prisma` and migration SQL\n3. Write `backend/package.json` (add `csv-parse`, `iconv-lite`, `multer`; remove `bcryptjs`, `jose`)\n4. Write `backend/Dockerfile`\n5. Write `backend/src/auth.js` (Authentik middleware)\n6. Copy `backend/src/parser.js` verbatim from payments-logger\n7. Write `backend/src/csvParser.js` (Python port)\n8. Write `backend/src/routes/upload.js`\n9. Write `backend/src/routes/payments.js` (from payments-logger + 5 changes listed above)\n10. Write `backend/src/index.js`\n11. Copy frontend base from payments-logger; delete `auth.js` + `AuthProvider.jsx`\n12. Update `main.jsx`, `App.jsx`, `FilterBar.jsx`, `PaymentTable.jsx`\n13. Write `frontend/src/components/UploadPanel.jsx`\n14. Update `frontend/vite.config.js`\n15. `docker compose build && docker compose up -d`\n16. Run verification checklist\n\n---\n\n## Verification\n\n**Schema**\n- `payments` table has `source`, `currency`, `debit_bgn`, `credit_bgn`, `transaction_type`, `payer_account`\n- No `users` table; `Source` enum exists\n\n**Auth**\n- `GET /api/payments` → 401 without `x-authentik-username` header\n- `POST /api/payments/ingest` → 201 without any header\n- `curl -H \"x-authentik-username: test\" localhost:3001/api/payments` → 200\n\n**SMS Ingest**\n- DSK POS SMS → `source=INGEST`, `currency=EUR`, correct amount/card/recipient\n- Apple Wallet structured body → `type=WALLET`, `source=INGEST`\n- Rate limiter → 429 after 200 req/min\n\n**CSV Upload**\n- Single DSK CSV → rows with `source=UPLOAD`, `currency=BGN`\n- Multiple CSVs in one request → all merged\n- `ТРАНСФЕР СОБСТВЕНИ СМЕТКИ` rows counted in `skipped`, not imported\n- Card regex match from `Основание` column\n- Auto-tags applied (ЗАПЛАТА→Salary, LIDL→Groceries)\n- cp1251 file imports correctly\n\n**UI**\n- Source badge visible in payment table (SMS indigo, CSV emerald)\n- Source dropdown in FilterBar filters correctly\n- Amount shows correct currency per row\n- Upload Panel: drag-and-drop works, result summary shows counts\n- Logout redirects to Authentik sign_out\n- No login form shown (Authentik handles it at NPM level)\n- Tags, send, skip, delete all still work\n\n## Reference Files\n\n- `/volume2/docker/finance/payments-logger/backend/src/routes/payments.js`\n- `/volume2/docker/finance/payments-logger/backend/src/parser.js`\n- `/volume2/docker/finance/payments-logger/backend/src/index.js`\n- `/volume2/docker/finance/payments-logger/backend/src/auth.js`\n- `/volume2/docker/finance/payments-logger/backend/prisma/schema.prisma`\n- `/volume2/docker/finance/payments-logger/frontend/src/App.jsx`\n- `/volume2/docker/finance/payments-logger/frontend/src/components/PaymentTable.jsx`\n- `/volume2/docker/finance/payments-logger/frontend/src/components/FilterBar.jsx`\n- `/volume2/docker/finance/dsk-uploader/dskuploader.py`\n- `/volume2/docker/finance/auth/docker-compose.yml`","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Claude’s Plan","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"ets-create-a-new-generic-sun.md","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"ets-create-a-new-generic-sun.md","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Stayed in plan mode","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Good question. Here's the full breakdown:","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Backend Tech Stack — Options","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Backend Tech Stack — Options","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Option A: Node.js + Express + Prisma (my recommendation)","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Option A: Node.js + Express + Prisma (my recommendation)","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Why:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"payments-logger is already Node.js/Express/Prisma. The new app is 80% payments-logger with CSV upload added on top. Keeping the same stack means:","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Copy","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"parser.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"verbatim, zero rewrite","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Copy the entire","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"routes/payments.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"with minimal edits","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Same Prisma schema workflow, same migrations, same Docker image","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The CSV parsing logic (the only Python-specific thing) ports cleanly to","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"csv-parse","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— it's just regex + string manipulation, nothing pandas-specific","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Trade-off:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Have to port the Python CSV parsing to JS. It's ~150 lines and mostly string manipulation — straightforward.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Option B: Python + FastAPI + SQLAlchemy","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Option B: Python + FastAPI + SQLAlchemy","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Rewrite everything in Python. dsk-uploader is Python, so CSV parsing is already done.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Pro:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Keep the dsk-uploader CSV logic as-is (no porting). Python has better data science libraries if you later add analytics.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Con:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Lose the entire payments-logger backend (routes, parser, Prisma schema) — full rewrite. FastAPI + SQLAlchemy is a different mental model than Express + Prisma. Frontend stays React anyway, so the stack split doesn't simplify anything.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Verdict:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"More work overall, gains almost nothing.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Option C: Hybrid microservices (Node.js backend + Python CSV service)","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Option C: Hybrid microservices (Node.js backend + Python CSV service)","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Keep Node.js as the main API, add a separate Python FastAPI service just for CSV parsing. They share the DB.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Pro:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Zero porting — Python CSV code used as-is.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Con:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Two backend services to maintain, deploy, and keep in sync. Inter-service HTTP calls. Two Dockerfiles. For ~150 lines of CSV logic, this is massively over-engineered.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Verdict:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Not worth it.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Option D: Python + Flask (exactly like dsk-uploader)","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Option D: Python + Flask (exactly like dsk-uploader)","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Extend dsk-uploader into a full payments app.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Pro:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Pandas for CSV, no porting.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Con:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Jinja2 templates instead of React (or add React separately). Would need to reimplement the entire payments-logger (SMS parser, notification system, tag management, pagination/filtering). Flask's Jinja templating is far less capable than the existing React UI. The React frontend is the stronger UI foundation.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Verdict:","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Worst of all options — rebuild the harder parts (UI, SMS parser, notification) for no gain.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"Summary","depth":22,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Summary","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Option","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CSV porting effort","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"App rewrite effort","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Result quality","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"A (Node.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Medium (150 lines)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Minimal","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Best","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"B (Python FastAPI)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"None","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"High (full backend)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Worse","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"C (Hybrid)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"None","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Low + infra overhead","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Overkill","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"D (Python Flask)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"None","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Very high","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Worst","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Option","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"A (Node.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"B (Python FastAPI)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"C (Hybrid)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"D (Python Flask)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CSV porting effort","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Medium (150 lines)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"None","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"None","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"None","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"App rewrite effort","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Minimal","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"High (full backend)","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Low + infra overhead","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Very high","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Result quality","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Best","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Worse","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Overkill","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Worst","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Option","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CSV porting effort","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"App rewrite effort","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Result quality","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The CSV parser port (the only cost of Option A) is a one-time ~150 line exercise. Everything else in the plan reuses payments-logger code directly. That's why Node.js is the clear winner here.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Want to adjust the stack, or shall I proceed with Option A?","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Message actions","depth":24,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"ok sounds good. Implement all you suggested","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Starting implementation. Let me first read all the reference files I'll need to copy from.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"parser.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"parser.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"payments.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"payments.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":",","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"index.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"index.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"App.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"App.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"FilterBar.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"FilterBar.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"PaymentTable.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"PaymentTable.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Now let me read the remaining frontend files and the Dockerfile from payments-logger.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"main.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"main.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"index.css","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"index.css","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"package.json","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"package.json","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Dockerfile","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Dockerfile","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Dockerfile","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Dockerfile","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"vite.config.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"vite.config.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"tailwind.config.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"tailwind.config.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"postcss.config.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"postcss.config.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"index.html","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"index.html","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"dskuploader.py","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"dskuploader.py","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Let me also grab the remaining frontend components.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"PaymentCard.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"PaymentCard.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"PaymentList.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"PaymentList.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"schema.prisma","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"schema.prisma","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Good, I have everything I need. Let me set up the todo list and start building.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Bash","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create finance-hub directory structure","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"mkdir -p /volume2/docker/finance/finance-hub/backend/src/routes \\\n /volume2/docker/finance/finance-hub/backend/prisma/migrations/20260508_init \\\n /volume2/docker/finance/finance-hub/frontend/src/components && echo \"done\"","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy code to clipboard","depth":24,"on_screen":false,"help_text":"Copy code","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"OUT","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"done","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"docker-compose.yml","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"docker-compose.yml","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"45 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"version: '3.8'\n\nservices:\n db:\n image: postgres:16-alpine\n restart: unless-stopped\n environment:\n POSTGRES_USER: finance\n POSTGRES_PASSWORD: ${DB_PASSWORD}\n POSTGRES_DB: finance_hub\n volumes:\n - pgdata:/var/lib/postgresql/data\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -U finance -d finance_hub\"]\n interval: 5s\n timeout: 5s\n retries: 5\n\n backend:\n build: ./backend\n restart: unless-stopped\n environment:\n DATABASE_URL: postgresql://finance:${DB_PASSWORD}@db:5432/finance_hub\n PORT: \"3001\"\n NOTIFIER_URL: ${NOTIFIER_URL}\n NOTIFIER_CHANNEL: ${NOTIFIER_CHANNEL:-viber}\n NOTIFY_DEFAULT_PHONE: ${NOTIFY_DEFAULT_PHONE}\n TZ: ${TZ:-Europe/Sofia}\n ports:\n - \"${BACKEND_PORT:-3001}:3001\"\n depends_on:\n db:\n condition: service_healthy\n\n frontend:\n build: ./frontend\n restart: unless-stopped\n ports:\n - \"${FRONTEND_PORT:-5175}:5173\"\n depends_on:\n - backend\n\nvolumes:\n pgdata:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":".env.example","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":".env.example","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"15 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"# Database\nDB_PASSWORD=change_me_strong_password\n\n# Notifier service (for SMS payment notifications)\nNOTIFIER_URL=https://notifier.lakylak.xyz\nNOTIFIER_CHANNEL=viber\nNOTIFY_DEFAULT_PHONE=+359000000000\n\n# Timezone (used by SMS parser for Bulgarian bank timestamps)\nTZ=Europe/Sofia\n\n# Ports (optional — defaults shown)\nBACKEND_PORT=3001\nFRONTEND_PORT=5175","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":".gitignore","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":".gitignore","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"5 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".env\nnode_modules/\ndist/\n*.log","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"schema.prisma","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"schema.prisma","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"54 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"generator client {\n provider = \"prisma-client-js\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_URL\")\n}\n\nmodel Payment {\n id Int @id @default(autoincrement())\n rawMessage String @map(\"raw_message\")\n date DateTime?\n type String?\n card String?\n recipient String?\n amount Float?\n currency String? @default(\"EUR\")\n balance Float?\n source Source @default(INGEST)\n status Status @default(UNPROCESSED)\n tags Tag[]\n notifiedAt DateTime? @map(\"notified_at\")\n notifyPhone String? @map(\"notify_phone\")\n debitBgn Float? @map(\"debit_bgn\")\n creditBgn Float? @map(\"credit_bgn\")\n transactionType String? @map(\"transaction_type\")\n payerAccount String? @map(\"payer_account\")\n createdAt DateTime @default(now()) @map(\"created_at\")\n updatedAt DateTime @updatedAt @map(\"updated_at\")\n\n @@map(\"payments\")\n}\n\nmodel Tag {\n id Int @id @default(autoincrement())\n name String @unique\n color String @default(\"#6b7280\")\n payments Payment[]\n\n @@map(\"tags\")\n}\n\nenum Status {\n UNPROCESSED\n SENT\n SKIPPED\n}\n\nenum Source {\n INGEST\n UPLOAD\n}","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"migration.sql","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"migration.sql","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"55 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"-- CreateEnum\nCREATE TYPE \"Status\" AS ENUM ('UNPROCESSED', 'SENT', 'SKIPPED');\nCREATE TYPE \"Source\" AS ENUM ('INGEST', 'UPLOAD');\n\n-- CreateTable\nCREATE TABLE \"payments\" (\n \"id\" SERIAL PRIMARY KEY,\n \"raw_message\" TEXT NOT NULL,\n \"date\" TIMESTAMP(3),\n \"type\" TEXT,\n \"card\" TEXT,\n \"recipient\" TEXT,\n \"amount\" DOUBLE PRECISION,\n \"currency\" TEXT DEFAULT 'EUR',\n \"balance\" DOUBLE PRECISION,\n \"source\" \"Source\" NOT NULL DEFAULT 'INGEST',\n \"status\" \"Status\" NOT NULL DEFAULT 'UNPROCESSED',\n \"notified_at\" TIMESTAMP(3),\n \"notify_phone\" TEXT,\n \"debit_bgn\" DOUBLE PRECISION,\n \"credit_bgn\" DOUBLE PRECISION,\n \"transaction_type\" TEXT,\n \"payer_account\" TEXT,\n \"created_at\" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,\n \"updated_at\" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP\n);\n\n-- CreateTable\nCREATE TABLE \"tags\" (\n \"id\" SERIAL PRIMARY KEY,\n \"name\" TEXT NOT NULL,\n \"color\" TEXT NOT NULL DEFAULT '#6b7280'\n);\n\n-- CreateUniqueIndex\nCREATE UNIQUE INDEX \"tags_name_key\" ON \"tags\"(\"name\");\n\n-- CreateTable (M2M join)\nCREATE TABLE \"_PaymentToTag\" (\n \"A\" INTEGER NOT NULL,\n \"B\" INTEGER NOT NULL,\n CONSTRAINT \"_PaymentToTag_AB_pkey\" PRIMARY KEY (\"A\", \"B\")\n);\n\nCREATE INDEX \"_PaymentToTag_B_index\" ON \"_PaymentToTag\"(\"B\");\n\n-- AddForeignKey\nALTER TABLE \"_PaymentToTag\"\n ADD CONSTRAINT \"_PaymentToTag_A_fkey\"\n FOREIGN KEY (\"A\") REFERENCES \"payments\"(\"id\") ON DELETE CASCADE ON UPDATE CASCADE;\n\nALTER TABLE \"_PaymentToTag\"\n ADD CONSTRAINT \"_PaymentToTag_B_fkey\"\n FOREIGN KEY (\"B\") REFERENCES \"tags\"(\"id\") ON DELETE CASCADE ON UPDATE CASCADE;","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"migration_lock.toml","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"migration_lock.toml","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"4 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"# Please do not edit this file manually\n# It should be added in your version-control system (e.g., Git)\nprovider = \"postgresql\"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"package.json","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"package.json","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"26 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"{\n \"name\": \"finance-hub-backend\",\n \"version\": \"1.0.0\",\n \"main\": \"src/index.js\",\n \"scripts\": {\n \"start\": \"node src/index.js\",\n \"dev\": \"nodemon src/index.js\",\n \"prisma:generate\": \"prisma generate\",\n \"prisma:migrate\": \"prisma migrate deploy\"\n },\n \"dependencies\": {\n \"@prisma/client\": \"^5.22.0\",\n \"cors\": \"^2.8.5\",\n \"csv-parse\": \"^5.5.6\",\n \"express\": \"^4.21.1\",\n \"express-rate-limit\": \"^7.4.0\",\n \"iconv-lite\": \"^0.6.3\",\n \"morgan\": \"^1.10.0\",\n \"multer\": \"^1.4.5-lts.1\"\n },\n \"devDependencies\": {\n \"nodemon\": \"^3.1.7\",\n \"prisma\": \"^5.22.0\"\n }\n}","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Dockerfile","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Dockerfile","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"18 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FROM node:20-alpine\n\nRUN apk add --no-cache openssl\n\nWORKDIR /app\n\nCOPY package.json package-lock.json* ./\nRUN npm install\n\nCOPY prisma ./prisma\nRUN npx prisma generate\n\nCOPY src ./src\n\nEXPOSE 3001\n\nCMD [\"sh\", \"-c\", \"npx prisma migrate deploy && node src/index.js\"]","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"auth.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"auth.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"27 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"const PUBLIC_PATHS = new Set([\n '/api/health',\n '/api/payments/ingest',\n]);\n\nfunction authentikMiddleware(req, res, next) {\n if (PUBLIC_PATHS.has(req.path)) return next();\n\n const username = req.headers['x-authentik-username'];\n if (!username) {\n return res.status(401).json({ error: 'Unauthorized — missing Authentik session' });\n }\n\n req.user = {\n username,\n email: req.headers['x-authentik-email'] || null,\n groups: (req.headers['x-authentik-groups'] || '')\n .split(',')\n .map(g => g.trim())\n .filter(Boolean),\n };\n\n next();\n}\n\nmodule.exports = { authentikMiddleware };","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"parser.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"parser.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"104 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/**\n * Parses SMS payment messages from Bulgarian banks (DSK Bank, etc.)\n *\n * Supported formats:\n *\n * POS / INTERNET / ECOM / P2P payment:\n * DSK Bank. Na DD/MM/YYYY v HH:MM sa plateni AMOUNT CURRENCY s karta CARD na POS s adres: RECIPIENT. Nalichni: BALANCE CURRENCY.\n *\n * ATM withdrawal:\n * DSK Bank. Na DD/MM/YYYY v HH:MM sa iztegleni AMOUNT CURRENCY s karta CARD ot ATM s adres: RECIPIENT. Nalichni: BALANCE CURRENCY.\n *\n * ATM utility payment (amount may include fee as AMOUNT/FEE):\n * DSK Bank. Na DD/MM/YYYY v HH:MM sa plateni AMOUNT CURRENCY/FEE CURRENCY s karta CARD na ATM s adres:RECIPIENT. Nalichni: BALANCE CURRENCY.\n */\n\nconst LOCAL_TZ = process.env.TZ || 'Europe/Sofia';\n\n/**\n * Convert a local-timezone date/time to a UTC Date object.\n * Uses Intl to resolve the actual UTC offset (DST-aware).\n */\nfunction localToUtc(year, month, day, hour, minute) {\n const naive = new Date(Date.UTC(year, month - 1, day, hour, minute, 0));\n\n const formatter = new Intl.DateTimeFormat('en-US', {\n timeZone: LOCAL_TZ,\n year: 'numeric', month: '2-digit', day: '2-digit',\n hour: '2-digit', minute: '2-digit', second: '2-digit',\n hour12: false,\n });\n\n const parts = {};\n formatter.formatToParts(naive).forEach(p => { parts[p.type] = p.value; });\n\n const localAtNaive = new Date(Date.UTC(\n parseInt(parts.year), parseInt(parts.month) - 1, parseInt(parts.day),\n parseInt(parts.hour) % 24, parseInt(parts.minute), parseInt(parts.second),\n ));\n\n const offsetMs = localAtNaive.getTime() - naive.getTime();\n return new Date(Date.UTC(year, month - 1, day, hour, minute, 0) - offsetMs);\n}\n\nfunction parsePaymentSms(message) {\n const result = {\n rawMessage: message,\n date: null,\n type: null,\n card: null,\n recipient: null,\n amount: null,\n balance: null,\n };\n\n // Date and time: \"Na DD/MM/YYYY v HH:MM\"\n const dateMatch = message.match(/Na (\\d{2})\\/(\\d{2})\\/(\\d{4}) v (\\d{2}):(\\d{2})/i);\n if (dateMatch) {\n const [, day, month, year, hour, minute] = dateMatch;\n result.date = localToUtc(\n parseInt(year), parseInt(month), parseInt(day),\n parseInt(hour), parseInt(minute),\n );\n }\n\n // Card mask: \"s karta 400915***4447\" or \"s karta 483890***7162\"\n const cardMatch = message.match(/s karta\\s+([\\d*]+)/i);\n if (cardMatch) {\n result.card = cardMatch[1];\n }\n\n // Transaction type: supports both prepositions\n // \"na POS\" / \"na ATM\" / \"na INTERNET\" etc. (payment)\n // \"ot ATM\" (withdrawal)\n const typeMatch = message.match(/(?:na|ot)\\s+(POS|ATM|INTERNET|ECOM|P2P)\\b/i);\n if (typeMatch) {\n result.type = typeMatch[1].toUpperCase();\n }\n\n // Recipient address: \"s adres: MERCHANT\" or \"s adres:MERCHANT\" (no space variant)\n const recipientMatch = message.match(/s adres:\\s*([^.]+)\\./i);\n if (recipientMatch) {\n result.recipient = recipientMatch[1].trim();\n }\n\n // Amount: handles both verbs and the AMOUNT/FEE suffix format\n // \"sa plateni 7.78 EUR\"\n // \"sa iztegleni 400.00 EUR\"\n // \"sa plateni 0.50 EUR/0.50 EUR\" → captures 0.50 (the charged amount, ignoring fee)\n const amountMatch = message.match(/sa (?:plateni|iztegleni)\\s+([\\d.,]+)\\s+[A-Z]{3}/i);\n if (amountMatch) {\n result.amount = parseFloat(amountMatch[1].replace(',', '.'));\n }\n\n // Balance: \"Nalichni: 2583.07 EUR.\"\n const balanceMatch = message.match(/Nalichni:\\s*([\\d.,]+)\\s+[A-Z]{3}/i);\n if (balanceMatch) {\n result.balance = parseFloat(balanceMatch[1].replace(',', '.'));\n }\n\n return result;\n}\n\nmodule.exports = { parsePaymentSms };","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"csvParser.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"csvParser.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"175 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/**\n * DSK Bank CSV parser — Node.js port of dskuploader.py\n *\n * DSK Bank exports use Windows-1251 (cp1251) encoding.\n * Each row maps to a Payment record with source=UPLOAD, currency=BGN.\n */\n\nconst { parse } = require('csv-parse');\nconst iconv = require('iconv-lite');\n\nconst SKIP_TYPE = 'ТРАНСФЕР СОБСТВЕНИ СМЕТКИ';\nconst CARD_REGEX = /^\\d{6}x{6}\\d{4}$/;\nconst POS_REGEX = /^\\s*ПЛАЩАНЕ\\s+НА\\s+ПОС\\s+\\d{2}\\.\\d{2}\\.\\d{4}\\s+\\d{2}:\\d{2}/;\n\nconst COL = {\n DATE: 'Дата',\n TYPE: 'Вид на трансакцията',\n REASON: 'Основание',\n DEBIT: 'Дебит BGN',\n CREDIT: 'Кредит BGN',\n PAYEE: 'Наредител/Получател',\n ACCT: 'Номер сметка на наредителя / получателя',\n};\n\nconst TAG_RULES = [\n ['reason', 'ЗАПЛАТА', 'Salary'],\n ['reason', 'ТЕГЛЕНЕ НА ATM', 'ATM'],\n ['reason', 'ПЛАЩАНЕ ПО ЗАЕМ', 'Home Credit'],\n ['reason', 'АВТ.ТАКСА ОБСЛУЖВАНЕ', 'Bills'],\n ['transactionType', 'КОМУНАЛНИ УСЛУГИ', 'Bills'],\n ['payee', 'VIVACOM', 'Subscriptions'],\n ['payee', 'Google', 'Subscriptions'],\n ['payee', 'SkyShowtime', 'Subscriptions'],\n ['payee', 'NETFLIX', 'Subscriptions'],\n ['payee', 'LUKOIL', 'Bills'],\n ['payee', 'CityGate', 'Bills'],\n ['payee', 'CBA', 'Groceries'],\n ['payee', 'FANTASTICO', 'Groceries'],\n ['payee', 'LIDL', 'Groceries'],\n];\n\nfunction parseNum(val) {\n if (val == null || val === '') return null;\n if (typeof val === 'number') return isNaN(val) ? null : val;\n const s = String(val).trim().replace(/\\xa0/g, '').replace(/ /g, '').replace(',', '.');\n const n = parseFloat(s);\n return isNaN(n) ? null : n;\n}\n\nfunction parseDate(val) {\n if (!val) return null;\n const s = String(val).trim();\n const m = s.match(/^(\\d{2})\\.(\\d{2})\\.(\\d{4})$/);\n if (m) {\n return new Date(Date.UTC(parseInt(m[3]), parseInt(m[2]) - 1, parseInt(m[1])));\n }\n return null;\n}\n\nfunction processReasonAndCard(reason) {\n if (!reason || typeof reason !== 'string') return { reason: '', card: null };\n\n const parts = reason.trim().split(' ');\n let card = null;\n let cleanReason = reason.trim();\n\n if (parts[0] && CARD_REGEX.test(parts[0])) {\n card = parts[0];\n cleanReason = parts.slice(1).join(' ').trim();\n }\n\n if (POS_REGEX.test(cleanReason)) {\n const posParts = cleanReason.split('<br/>');\n try {\n const dateTime = posParts[0].split('ПОС ')[1];\n cleanReason = `POS PAYMENT ${dateTime}`;\n } catch (_) { /* keep original */ }\n }\n\n return { reason: cleanReason.replace(/\\s+/g, ' ').trim(), card };\n}\n\nfunction generateTags(fields) {\n const tags = new Set();\n for (const [field, keyword, tagName] of TAG_RULES) {\n if ((fields[field] || '').includes(keyword)) {\n tags.add(tagName);\n }\n }\n return Array.from(tags);\n}\n\nfunction processRow(row) {\n const transactionType = (row[COL.TYPE] || '').trim();\n if (transactionType === SKIP_TYPE) return null;\n\n const { reason, card } = processReasonAndCard(row[COL.REASON]);\n const payee = (row[COL.PAYEE] || '').trim();\n const payerAccount = (row[COL.ACCT] || '').trim();\n const debitBgn = parseNum(row[COL.DEBIT]);\n const creditBgn = parseNum(row[COL.CREDIT]);\n const date = parseDate(row[COL.DATE]);\n\n const autoTags = generateTags({ reason, transactionType, payee, debitBgn, creditBgn });\n\n const amount = debitBgn ?? creditBgn ?? null;\n\n const rawMessage = [\n row[COL.DATE] && `Date: ${row[COL.DATE]}`,\n transactionType && `Type: ${transactionType}`,\n payee && `Payee: ${payee}`,\n debitBgn != null && `Debit: ${debitBgn} BGN`,\n creditBgn != null && `Credit: ${creditBgn} BGN`,\n ].filter(Boolean).join(' | ');\n\n return {\n rawMessage,\n date,\n type: null,\n card,\n recipient: payee || null,\n amount,\n currency: 'BGN',\n balance: null,\n source: 'UPLOAD',\n debitBgn,\n creditBgn,\n transactionType: transactionType || null,\n payerAccount: payerAccount || null,\n autoTags,\n };\n}\n\n/**\n * Parse a Buffer containing a DSK Bank CSV (cp1251 or UTF-8).\n * Returns { rows, skipped, errors }.\n */\nasync function parseDskCsv(buffer) {\n // Try cp1251 first (DSK Bank export encoding), fall back to UTF-8\n let text = iconv.decode(buffer, 'cp1251');\n if (!text.includes(COL.DATE)) {\n text = buffer.toString('utf-8');\n }\n\n return new Promise((resolve, reject) => {\n const rows = [];\n const errors = [];\n let skipped = 0;\n\n const parser = parse(text, {\n columns: true,\n skip_empty_lines: true,\n trim: true,\n relax_column_count: true,\n });\n\n parser.on('readable', () => {\n let record;\n while ((record = parser.read()) !== null) {\n try {\n const row = processRow(record);\n if (row === null) { skipped++; } else { rows.push(row); }\n } catch (err) {\n errors.push(err.message);\n }\n }\n });\n\n parser.on('error', reject);\n parser.on('end', () => resolve({ rows, skipped, errors }));\n });\n}\n\nmodule.exports = { parseDskCsv };","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"index.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"index.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"39 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"const express = require('express');\nconst cors = require('cors');\nconst morgan = require('morgan');\nconst rateLimit = require('express-rate-limit');\nconst { authentikMiddleware } = require('./auth');\nconst paymentsRouter = require('./routes/payments');\nconst uploadRouter = require('./routes/upload');\n\nconst app = express();\nconst PORT = process.env.PORT || 3001;\n\napp.use(cors());\napp.use(express.json({ limit: '16kb' }));\napp.use(morgan('combined'));\n\n// Rate-limit the public ingest endpoint before auth middleware\nconst ingestLimiter = rateLimit({\n windowMs: 60 * 1000,\n max: 200,\n standardHeaders: true,\n legacyHeaders: false,\n message: { error: 'Too many requests, slow down' },\n});\napp.use('/api/payments/ingest', ingestLimiter);\n\n// Authentik header auth (skips /api/health and /api/payments/ingest)\napp.use(authentikMiddleware);\n\napp.get('/api/health', (_req, res) => {\n res.json({ status: 'ok', timestamp: new Date().toISOString() });\n});\n\napp.use('/api/payments', paymentsRouter);\napp.use('/api/upload', uploadRouter);\n\napp.listen(PORT, '0.0.0.0', () => {\n console.log(`Finance Hub API running on port ${PORT}`);\n});","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"payments.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"payments.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"399 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"const express = require('express');\nconst { PrismaClient } = require('@prisma/client');\nconst { parsePaymentSms } = require('../parser');\n\nconst router = express.Router();\nconst prisma = new PrismaClient();\n\nconst NOTIFIER_URL = process.env.NOTIFIER_URL;\nconst NOTIFIER_CHANNEL = process.env.NOTIFIER_CHANNEL || 'viber';\nconst DEFAULT_PHONE = process.env.NOTIFY_DEFAULT_PHONE;\n\n// ── Helpers ───────────────────────────────────────────────────────────────────\n\nfunction parseId(raw) {\n const id = parseInt(raw, 10);\n return Number.isFinite(id) ? id : null;\n}\n\nfunction formatNotifyMessage(payment) {\n const currency = payment.currency || 'EUR';\n const parts = [];\n if (payment.amount != null) parts.push(`Amount: ${payment.amount.toFixed(2)} ${currency}`);\n if (payment.recipient) parts.push(`At: ${payment.recipient}`);\n if (payment.balance != null) parts.push(`Balance: ${payment.balance.toFixed(2)} ${currency}`);\n if (payment.date) parts.push(`Date: ${new Date(payment.date).toLocaleString('en-GB')}`);\n return parts.join('\\n');\n}\n\nasync function sendNotification(payment) {\n if (!NOTIFIER_URL) {\n console.warn('[NOTIFY] NOTIFIER_URL not set — skipping notification');\n return;\n }\n\n const phone = payment.notifyPhone || DEFAULT_PHONE;\n if (!phone) {\n console.warn('[NOTIFY] No phone number for payment #' + payment.id + ' and NOTIFY_DEFAULT_PHONE not set');\n return;\n }\n\n const body = {\n phone,\n notification: NOTIFIER_CHANNEL,\n message: formatNotifyMessage(payment),\n };\n\n const res = await fetch(NOTIFIER_URL, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n });\n\n if (!res.ok) {\n const text = await res.text().catch(() => '');\n throw new Error(`Notifier responded ${res.status}: ${text}`);\n }\n}\n\n// ── Ingest a payment (public — no auth) ──────────────────────────────────────\n//\n// Two modes:\n//\n// SMS mode (default):\n// { \"message\": \"<raw SMS text>\", \"notifyPhone\": \"...\" }\n//\n// Structured mode (Apple Wallet / manual):\n// { \"ingestMode\": \"apple_wallet\", \"amount\": 7.78, \"recipient\": \"Apple Store\",\n// \"type\": \"WALLET\", \"card\": \"••••4447\", \"date\": \"2026-02-22T10:30:00Z\" }\n//\nrouter.post('/ingest', async (req, res) => {\n try {\n const { message, notifyPhone, ingestMode } = req.body;\n\n let data;\n\n if (ingestMode === 'apple_wallet' || (!message && req.body.amount != null)) {\n // ── Structured / Apple Wallet mode ──────────────────────────────────────\n const { amount, recipient, type, card, date, balance } = req.body;\n if (amount == null || !recipient) {\n return res.status(400).json({ error: 'amount and recipient are required for structured ingest' });\n }\n\n const rawMessage = [\n `Source: ${ingestMode || 'structured'}`,\n `Amount: ${amount}`,\n recipient && `Recipient: ${recipient}`,\n type && `Type: ${type}`,\n card && `Card: ${card}`,\n ].filter(Boolean).join(' | ');\n\n data = {\n rawMessage,\n date: date ? new Date(date) : new Date(),\n type: type || 'WALLET',\n card: card || null,\n recipient,\n amount: parseFloat(amount),\n currency: 'EUR',\n balance: balance != null ? parseFloat(balance) : null,\n source: 'INGEST',\n notifyPhone: notifyPhone || null,\n };\n\n } else {\n // ── SMS mode ─────────────────────────────────────────────────────────────\n if (!message) {\n return res.status(400).json({ error: 'message is required' });\n }\n if (typeof message !== 'string' || message.length > 2000) {\n return res.status(400).json({ error: 'message must be a string under 2000 characters' });\n }\n\n const parsed = parsePaymentSms(message);\n data = {\n rawMessage: parsed.rawMessage,\n date: parsed.date,\n type: parsed.type,\n card: parsed.card,\n recipient: parsed.recipient,\n amount: parsed.amount,\n currency: 'EUR',\n balance: parsed.balance,\n source: 'INGEST',\n notifyPhone: notifyPhone || null,\n };\n }\n\n const payment = await prisma.payment.create({\n data,\n include: { tags: true },\n });\n\n res.status(201).json(payment);\n } catch (err) {\n console.error('Ingest error:', err);\n res.status(500).json({ error: 'Failed to ingest payment' });\n }\n});\n\n// ── List payments with filtering ──────────────────────────────────────────────\nrouter.get('/', async (req, res) => {\n try {\n const {\n status,\n type,\n tag,\n source,\n recipient,\n dateFrom,\n dateTo,\n search,\n sortBy = 'createdAt',\n sortDir = 'desc',\n page = 1,\n } = req.query;\n\n const limit = Math.min(parseInt(req.query.limit, 10) || 50, 200);\n\n const where = {};\n\n if (status) where.status = status;\n if (type) where.type = type;\n if (source) where.source = source;\n if (recipient) where.recipient = { contains: recipient, mode: 'insensitive' };\n if (tag) where.tags = { some: { name: tag } };\n if (search) {\n where.OR = [\n { rawMessage: { contains: search, mode: 'insensitive' } },\n { recipient: { contains: search, mode: 'insensitive' } },\n ];\n }\n if (dateFrom || dateTo) {\n where.date = {};\n if (dateFrom) where.date.gte = new Date(dateFrom);\n if (dateTo) where.date.lte = new Date(dateTo);\n }\n\n const allowedSortFields = ['date', 'amount', 'balance', 'recipient', 'type', 'source', 'createdAt', 'status'];\n const orderField = allowedSortFields.includes(sortBy) ? sortBy : 'createdAt';\n const orderDir = sortDir === 'asc' ? 'asc' : 'desc';\n\n const skip = (parseInt(page, 10) - 1) * limit;\n\n const [payments, total] = await Promise.all([\n prisma.payment.findMany({\n where,\n include: { tags: true },\n orderBy: { [orderField]: orderDir },\n skip,\n take: limit,\n }),\n prisma.payment.count({ where }),\n ]);\n\n res.json({ payments, total, page: parseInt(page, 10), limit });\n } catch (err) {\n console.error('List error:', err);\n res.status(500).json({ error: 'Failed to list payments' });\n }\n});\n\n// ── Get filter options ────────────────────────────────────────────────────────\nrouter.get('/meta/filters', async (_req, res) => {\n try {\n const [types, recipients, tags, sources] = await Promise.all([\n prisma.payment.findMany({ distinct: ['type'], select: { type: true }, where: { type: { not: null } } }),\n prisma.payment.findMany({ distinct: ['recipient'], select: { recipient: true }, where: { recipient: { not: null } } }),\n prisma.tag.findMany({ orderBy: { name: 'asc' } }),\n prisma.payment.findMany({ distinct: ['source'], select: { source: true } }),\n ]);\n\n res.json({\n types: types.map(t => t.type),\n recipients: recipients.map(r => r.recipient),\n tags,\n sources: sources.map(s => s.source),\n });\n } catch (err) {\n res.status(500).json({ error: 'Failed to get filters' });\n }\n});\n\n// ── Get all tags ──────────────────────────────────────────────────────────────\nrouter.get('/meta/tags', async (_req, res) => {\n try {\n const tags = await prisma.tag.findMany({ orderBy: { name: 'asc' } });\n res.json(tags);\n } catch (err) {\n res.status(500).json({ error: 'Failed to list tags' });\n }\n});\n\n// ── Get single payment ────────────────────────────────────────────────────────\nrouter.get('/:id', async (req, res) => {\n const id = parseId(req.params.id);\n if (id === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n const payment = await prisma.payment.findUnique({\n where: { id },\n include: { tags: true },\n });\n if (!payment) return res.status(404).json({ error: 'Not found' });\n res.json(payment);\n } catch (err) {\n console.error('Get error:', err);\n res.status(500).json({ error: 'Failed to get payment' });\n }\n});\n\n// ── Update payment metadata (status) ─────────────────────────────────────────\nrouter.patch('/:id', async (req, res) => {\n const id = parseId(req.params.id);\n if (id === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n const { status } = req.body;\n const data = {};\n\n if (status) {\n const validStatuses = ['UNPROCESSED', 'SENT', 'SKIPPED'];\n if (!validStatuses.includes(status)) {\n return res.status(400).json({ error: `Invalid status. Must be one of: ${validStatuses.join(', ')}` });\n }\n data.status = status;\n }\n\n if (Object.keys(data).length === 0) {\n return res.status(400).json({ error: 'No valid fields to update' });\n }\n\n const updated = await prisma.payment.update({\n where: { id },\n data,\n include: { tags: true },\n });\n res.json(updated);\n } catch (err) {\n if (err.code === 'P2025') return res.status(404).json({ error: 'Not found' });\n console.error('Update error:', err);\n res.status(500).json({ error: 'Failed to update payment' });\n }\n});\n\n// ── Delete payment ───────────────────────────────────────────────────────────\nrouter.delete('/:id', async (req, res) => {\n const id = parseId(req.params.id);\n if (id === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n await prisma.payment.delete({ where: { id } });\n res.json({ success: true });\n } catch (err) {\n if (err.code === 'P2025') return res.status(404).json({ error: 'Not found' });\n console.error('Delete error:', err);\n res.status(500).json({ error: 'Failed to delete payment' });\n }\n});\n\n// ── Send notification (mark as SENT + call notifier service) ─────────────────\nrouter.post('/:id/send', async (req, res) => {\n const id = parseId(req.params.id);\n if (id === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n const payment = await prisma.payment.findUnique({ where: { id } });\n if (!payment) return res.status(404).json({ error: 'Not found' });\n if (payment.status !== 'UNPROCESSED') {\n return res.status(409).json({ error: `Payment is already ${payment.status.toLowerCase()}` });\n }\n\n await sendNotification(payment);\n\n const updated = await prisma.payment.update({\n where: { id },\n data: { status: 'SENT', notifiedAt: new Date() },\n include: { tags: true },\n });\n\n res.json(updated);\n } catch (err) {\n console.error('Send error:', err);\n res.status(500).json({ error: 'Failed to send notification' });\n }\n});\n\n// ── Skip notification (mark as SKIPPED) ──────────────────────────────────────\nrouter.post('/:id/skip', async (req, res) => {\n const id = parseId(req.params.id);\n if (id === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n const payment = await prisma.payment.findUnique({ where: { id } });\n if (!payment) return res.status(404).json({ error: 'Not found' });\n if (payment.status !== 'UNPROCESSED') {\n return res.status(409).json({ error: `Payment is already ${payment.status.toLowerCase()}` });\n }\n\n const updated = await prisma.payment.update({\n where: { id },\n data: { status: 'SKIPPED' },\n include: { tags: true },\n });\n res.json(updated);\n } catch (err) {\n console.error('Skip error:', err);\n res.status(500).json({ error: 'Failed to skip payment' });\n }\n});\n\n// ── Add tag to payment ────────────────────────────────────────────────────────\nrouter.post('/:id/tags', async (req, res) => {\n const id = parseId(req.params.id);\n if (id === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n const { name, color } = req.body;\n if (!name) return res.status(400).json({ error: 'tag name is required' });\n\n const tag = await prisma.tag.upsert({\n where: { name },\n update: {},\n create: { name, color: color || '#6b7280' },\n });\n\n const updated = await prisma.payment.update({\n where: { id },\n data: { tags: { connect: { id: tag.id } } },\n include: { tags: true },\n });\n\n res.json(updated);\n } catch (err) {\n console.error('Tag error:', err);\n res.status(500).json({ error: 'Failed to add tag' });\n }\n});\n\n// ── Remove tag from payment ───────────────────────────────────────────────────\nrouter.delete('/:id/tags/:tagId', async (req, res) => {\n const id = parseId(req.params.id);\n const tagId = parseId(req.params.tagId);\n if (id === null || tagId === null) return res.status(400).json({ error: 'Invalid id' });\n\n try {\n const updated = await prisma.payment.update({\n where: { id },\n data: { tags: { disconnect: { id: tagId } } },\n include: { tags: true },\n });\n res.json(updated);\n } catch (err) {\n console.error('Remove tag error:', err);\n res.status(500).json({ error: 'Failed to remove tag' });\n }\n});\n\nmodule.exports = router;","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"upload.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"upload.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"89 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"const express = require('express');\nconst multer = require('multer');\nconst { PrismaClient } = require('@prisma/client');\nconst { parseDskCsv } = require('../csvParser');\n\nconst router = express.Router();\nconst prisma = new PrismaClient();\n\nconst upload = multer({\n storage: multer.memoryStorage(),\n limits: { fileSize: 10 * 1024 * 1024, files: 10 },\n fileFilter: (_req, file, cb) => {\n if (file.mimetype === 'text/csv' || file.originalname.toLowerCase().endsWith('.csv')) {\n cb(null, true);\n } else {\n cb(new Error('Only CSV files are accepted'));\n }\n },\n});\n\n// POST /api/upload/csv\n// Accepts 1-10 CSV files, parses them, stores to DB with source=UPLOAD.\n// Returns { imported, skipped, errors, payments[] }\nrouter.post('/csv', upload.array('files', 10), async (req, res) => {\n if (!req.files || req.files.length === 0) {\n return res.status(400).json({ error: 'No files uploaded' });\n }\n\n const allRows = [];\n const allErrors = [];\n let totalSkipped = 0;\n\n for (const file of req.files) {\n try {\n const { rows, skipped, errors } = await parseDskCsv(file.buffer);\n allRows.push(...rows);\n totalSkipped += skipped;\n allErrors.push(...errors.map(e => `${file.originalname}: ${e}`));\n } catch (err) {\n allErrors.push(`${file.originalname}: ${err.message}`);\n }\n }\n\n if (allRows.length === 0) {\n return res.status(422).json({\n error: 'No importable rows found',\n skipped: totalSkipped,\n errors: allErrors,\n });\n }\n\n const created = [];\n\n for (const row of allRows) {\n const { autoTags, ...paymentData } = row;\n try {\n const tagConnects = [];\n for (const tagName of autoTags) {\n const tag = await prisma.tag.upsert({\n where: { name: tagName },\n update: {},\n create: { name: tagName, color: '#6b7280' },\n });\n tagConnects.push({ id: tag.id });\n }\n\n const payment = await prisma.payment.create({\n data: {\n ...paymentData,\n ...(tagConnects.length ? { tags: { connect: tagConnects } } : {}),\n },\n include: { tags: true },\n });\n created.push(payment);\n } catch (err) {\n allErrors.push(`Row insert failed: ${err.message}`);\n }\n }\n\n res.status(201).json({\n imported: created.length,\n skipped: totalSkipped,\n errors: allErrors,\n payments: created,\n });\n});\n\nmodule.exports = router;","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Now writing all frontend config files:","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"package.json","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"package.json","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"24 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"{\n \"name\": \"finance-hub-frontend\",\n \"version\": \"1.0.0\",\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"vite\",\n \"build\": \"vite build\",\n \"preview\": \"vite preview\"\n },\n \"dependencies\": {\n \"lucide-react\": \"^0.460.0\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\"\n },\n \"devDependencies\": {\n \"@types/react\": \"^18.3.12\",\n \"@vitejs/plugin-react\": \"^4.3.4\",\n \"autoprefixer\": \"^10.4.20\",\n \"postcss\": \"^8.4.49\",\n \"tailwindcss\": \"^3.4.15\",\n \"vite\": \"^6.0.1\"\n }\n}","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Dockerfile","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Dockerfile","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"13 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FROM node:20-alpine\n\nWORKDIR /app\n\nCOPY package.json package-lock.json* ./\nRUN npm install\n\nCOPY . .\n\nEXPOSE 5173\n\nCMD [\"npm\", \"run\", \"dev\"]","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"vite.config.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"vite.config.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"18 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"import { defineConfig } from 'vite';\nimport react from '@vitejs/plugin-react';\n\nexport default defineConfig({\n plugins: [react()],\n server: {\n host: '0.0.0.0',\n port: 5173,\n allowedHosts: ['finance-hub.lakylak.xyz'],\n proxy: {\n '/api': {\n target: 'http://backend:3001',\n changeOrigin: true,\n },\n },\n },\n});","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"tailwind.config.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"tailwind.config.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"12 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/** @type {import('tailwindcss').Config} */\nexport default {\n content: [\n \"./index.html\",\n \"./src/**/*.{js,ts,jsx,tsx}\",\n ],\n theme: {\n extend: {},\n },\n plugins: [],\n};","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"postcss.config.js","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"postcss.config.js","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"7 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"export default {\n plugins: {\n tailwindcss: {},\n autoprefixer: {},\n },\n};","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"index.html","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"index.html","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"14 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>Finance Hub</title>\n <link rel=\"icon\" type=\"image/svg+xml\" href=\"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>💰</text></svg>\" />\n </head>\n <body class=\"bg-gray-50 min-h-screen\">\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.jsx\"></script>\n </body>\n</html>","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"index.css","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"index.css","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"4 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"@tailwind base;\n@tailwind components;\n@tailwind utilities;","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Now writing all React components:","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"main.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"main.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"11 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"import React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport App from './App';\nimport './index.css';\n\nReactDOM.createRoot(document.getElementById('root')).render(\n <React.StrictMode>\n <App />\n </React.StrictMode>\n);","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"App.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"App.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"257 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"import React, { useState, useEffect, useCallback } from 'react';\nimport { LayoutDashboard, Upload, RefreshCw, LogOut } from 'lucide-react';\nimport FilterBar from './components/FilterBar';\nimport PaymentTable from './components/PaymentTable';\nimport UploadPanel from './components/UploadPanel';\n\nconst API_BASE = '/api/payments';\n\nexport default function App() {\n const [activeTab, setActiveTab] = useState('payments');\n const [payments, setPayments] = useState([]);\n const [total, setTotal] = useState(0);\n const [page, setPage] = useState(1);\n const [filters, setFilters] = useState({});\n const [sortBy, setSortBy] = useState('createdAt');\n const [sortDir, setSortDir] = useState('desc');\n const [filterOptions, setFilterOptions] = useState({ types: [], recipients: [], tags: [], sources: [] });\n const [loading, setLoading] = useState(false);\n\n const fetchPayments = useCallback(async () => {\n setLoading(true);\n try {\n const params = new URLSearchParams();\n params.set('page', page);\n params.set('limit', 50);\n params.set('sortBy', sortBy);\n params.set('sortDir', sortDir);\n Object.entries(filters).forEach(([key, val]) => {\n if (val) params.set(key, val);\n });\n const res = await fetch(`${API_BASE}?${params}`);\n const data = await res.json();\n setPayments(data.payments || []);\n setTotal(data.total || 0);\n } catch (err) {\n console.error('Failed to fetch payments:', err);\n } finally {\n setLoading(false);\n }\n }, [page, filters, sortBy, sortDir]);\n\n const fetchFilterOptions = useCallback(async () => {\n try {\n const res = await fetch(`${API_BASE}/meta/filters`);\n const data = await res.json();\n setFilterOptions(data);\n } catch (err) {\n console.error('Failed to fetch filter options:', err);\n }\n }, []);\n\n useEffect(() => {\n fetchPayments();\n }, [fetchPayments]);\n\n useEffect(() => {\n fetchFilterOptions();\n }, [fetchFilterOptions]);\n\n // Refresh payments list after a successful CSV upload\n const handleUploadSuccess = () => {\n fetchPayments();\n fetchFilterOptions();\n setActiveTab('payments');\n };\n\n const handleAction = async (id, action) => {\n try {\n await fetch(`${API_BASE}/${id}/${action}`, { method: 'POST' });\n fetchPayments();\n fetchFilterOptions();\n } catch (err) {\n console.error(`Failed to ${action} payment:`, err);\n }\n };\n\n const handleAddTag = async (id, tagName, tagColor) => {\n try {\n await fetch(`${API_BASE}/${id}/tags`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ name: tagName, color: tagColor }),\n });\n fetchPayments();\n fetchFilterOptions();\n } catch (err) {\n console.error('Failed to add tag:', err);\n }\n };\n\n const handleRemoveTag = async (paymentId, tagId) => {\n try {\n await fetch(`${API_BASE}/${paymentId}/tags/${tagId}`, { method: 'DELETE' });\n fetchPayments();\n } catch (err) {\n console.error('Failed to remove tag:', err);\n }\n };\n\n const handleDelete = async (id) => {\n try {\n await fetch(`${API_BASE}/${id}`, { method: 'DELETE' });\n fetchPayments();\n fetchFilterOptions();\n } catch (err) {\n console.error('Failed to delete payment:', err);\n }\n };\n\n const handleUpdateStatus = async (id, status) => {\n try {\n await fetch(`${API_BASE}/${id}`, {\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ status }),\n });\n fetchPayments();\n } catch (err) {\n console.error('Failed to update status:', err);\n }\n };\n\n const handleFilterChange = (newFilters) => {\n setFilters(newFilters);\n setPage(1);\n };\n\n const handleSort = (field) => {\n if (sortBy === field) {\n setSortDir(d => d === 'asc' ? 'desc' : 'asc');\n } else {\n setSortBy(field);\n setSortDir('desc');\n }\n setPage(1);\n };\n\n const totalPages = Math.ceil(total / 50);\n\n return (\n <div className=\"min-h-screen bg-gray-50\">\n <header className=\"bg-white border-b border-gray-200 shadow-sm\">\n <div className=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4\">\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-3\">\n <div className=\"bg-indigo-600 p-2 rounded-lg\">\n <LayoutDashboard className=\"w-6 h-6 text-white\" />\n </div>\n <div>\n <h1 className=\"text-xl font-bold text-gray-900\">Finance Hub</h1>\n <p className=\"text-sm text-gray-500\">{total} transaction{total !== 1 ? 's' : ''} total</p>\n </div>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {/* Tab switcher */}\n <div className=\"flex items-center rounded-lg border border-gray-200 bg-gray-50 p-1 gap-1\">\n <button\n onClick={() => setActiveTab('payments')}\n className={`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${\n activeTab === 'payments'\n ? 'bg-white text-indigo-700 shadow-sm'\n : 'text-gray-600 hover:text-gray-900'\n }`}\n >\n <LayoutDashboard className=\"w-4 h-4\" />\n Payments\n </button>\n <button\n onClick={() => setActiveTab('upload')}\n className={`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${\n activeTab === 'upload'\n ? 'bg-white text-emerald-700 shadow-sm'\n : 'text-gray-600 hover:text-gray-900'\n }`}\n >\n <Upload className=\"w-4 h-4\" />\n Upload CSV\n </button>\n </div>\n\n {activeTab === 'payments' && (\n <button\n onClick={() => { fetchPayments(); fetchFilterOptions(); }}\n className=\"flex items-center gap-2 px-3 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors\"\n >\n <RefreshCw className={`w-4 h-4 ${loading ? 'animate-spin' : ''}`} />\n Refresh\n </button>\n )}\n\n <button\n onClick={() => { window.location.href = '/outpost.goauthentik.io/sign_out'; }}\n className=\"flex items-center gap-2 px-3 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors\"\n title=\"Sign out\"\n >\n <LogOut className=\"w-4 h-4\" />\n </button>\n </div>\n </div>\n </div>\n </header>\n\n <main className=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6\">\n {activeTab === 'payments' ? (\n <>\n <FilterBar\n filters={filters}\n filterOptions={filterOptions}\n onFilterChange={handleFilterChange}\n />\n\n <PaymentTable\n payments={payments}\n loading={loading}\n sortBy={sortBy}\n sortDir={sortDir}\n onSort={handleSort}\n onSend={(id) => handleAction(id, 'send')}\n onSkip={(id) => handleAction(id, 'skip')}\n onAddTag={handleAddTag}\n onRemoveTag={handleRemoveTag}\n onDelete={handleDelete}\n onUpdateStatus={handleUpdateStatus}\n existingTags={filterOptions.tags}\n />\n\n {totalPages > 1 && (\n <div className=\"flex items-center justify-center gap-2 mt-6\">\n <button\n onClick={() => setPage(p => Math.max(1, p - 1))}\n disabled={page === 1}\n className=\"px-3 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n Previous\n </button>\n <span className=\"text-sm text-gray-600\">\n Page {page} of {totalPages}\n </span>\n <button\n onClick={() => setPage(p => Math.min(totalPages, p + 1))}\n disabled={page === totalPages}\n className=\"px-3 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n Next\n </button>\n </div>\n )}\n </>\n ) : (\n <UploadPanel onUploadSuccess={handleUploadSuccess} />\n )}\n </main>\n </div>\n );\n}","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"FilterBar.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"FilterBar.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"167 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"import React, { useState, useEffect } from 'react';\nimport { Search, Filter, X, Calendar, ChevronDown, ChevronUp } from 'lucide-react';\n\nconst STATUS_OPTIONS = [\n { value: '', label: 'All Statuses' },\n { value: 'UNPROCESSED', label: 'Unprocessed' },\n { value: 'SENT', label: 'Sent' },\n { value: 'SKIPPED', label: 'Skipped' },\n];\n\nconst SOURCE_OPTIONS = [\n { value: '', label: 'All Sources' },\n { value: 'INGEST', label: 'SMS Ingest' },\n { value: 'UPLOAD', label: 'CSV Upload' },\n];\n\nexport default function FilterBar({ filters, filterOptions, onFilterChange }) {\n const [search, setSearch] = useState(filters.search || '');\n const [isOpen, setIsOpen] = useState(() => window.innerWidth >= 768);\n\n useEffect(() => {\n const mq = window.matchMedia('(min-width: 768px)');\n const handler = (e) => setIsOpen(e.matches);\n mq.addEventListener('change', handler);\n return () => mq.removeEventListener('change', handler);\n }, []);\n\n const handleSearchSubmit = (e) => {\n e.preventDefault();\n onFilterChange({ ...filters, search: search || undefined });\n };\n\n const handleSelectChange = (key, value) => {\n const newFilters = { ...filters };\n if (value) {\n newFilters[key] = value;\n } else {\n delete newFilters[key];\n }\n onFilterChange(newFilters);\n };\n\n const clearFilters = () => {\n setSearch('');\n onFilterChange({});\n };\n\n const activeFilterCount = Object.keys(filters).length;\n const hasActiveFilters = activeFilterCount > 0;\n\n return (\n <div className=\"bg-white rounded-xl border border-gray-200 shadow-sm p-4 mb-6\">\n <button\n onClick={() => setIsOpen(!isOpen)}\n className=\"w-full flex items-center gap-2\"\n >\n <Filter className=\"w-4 h-4 text-gray-500\" />\n <span className=\"text-sm font-medium text-gray-700\">Filters</span>\n {hasActiveFilters && (\n <span className=\"inline-flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-indigo-600 rounded-full\">\n {activeFilterCount}\n </span>\n )}\n {hasActiveFilters && (\n <span\n onClick={(e) => { e.stopPropagation(); clearFilters(); }}\n className=\"ml-1 flex items-center gap-1 text-xs text-red-600 hover:text-red-700\"\n >\n <X className=\"w-3 h-3\" />\n Clear\n </span>\n )}\n <span className=\"ml-auto\">\n {isOpen\n ? <ChevronUp className=\"w-4 h-4 text-gray-400\" />\n : <ChevronDown className=\"w-4 h-4 text-gray-400\" />\n }\n </span>\n </button>\n\n {isOpen && (\n <div className=\"space-y-3 mt-3 pt-3 border-t border-gray-100\">\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-3\">\n <form onSubmit={handleSearchSubmit} className=\"relative\">\n <Search className=\"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400\" />\n <input\n type=\"text\"\n placeholder=\"Search...\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n onBlur={() => onFilterChange({ ...filters, search: search || undefined })}\n className=\"w-full pl-9 pr-3 py-2 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none\"\n />\n </form>\n\n <select\n value={filters.source || ''}\n onChange={(e) => handleSelectChange('source', e.target.value)}\n className=\"w-full py-2 px-3 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none bg-white\"\n >\n {SOURCE_OPTIONS.map(opt => (\n <option key={opt.value} value={opt.value}>{opt.label}</option>\n ))}\n </select>\n\n <select\n value={filters.status || ''}\n onChange={(e) => handleSelectChange('status', e.target.value)}\n className=\"w-full py-2 px-3 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none bg-white\"\n >\n {STATUS_OPTIONS.map(opt => (\n <option key={opt.value} value={opt.value}>{opt.label}</option>\n ))}\n </select>\n\n <select\n value={filters.type || ''}\n onChange={(e) => handleSelectChange('type', e.target.value)}\n className=\"w-full py-2 px-3 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none bg-white\"\n >\n <option value=\"\">All Types</option>\n {(filterOptions.types || []).map(t => (\n <option key={t} value={t}>{t}</option>\n ))}\n </select>\n\n <select\n value={filters.tag || ''}\n onChange={(e) => handleSelectChange('tag', e.target.value)}\n className=\"w-full py-2 px-3 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none bg-white\"\n >\n <option value=\"\">All Tags</option>\n {(filterOptions.tags || []).map(t => (\n <option key={t.id} value={t.name}>{t.name}</option>\n ))}\n </select>\n </div>\n\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\n <div className=\"relative\">\n <Calendar className=\"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400\" />\n <input\n type=\"date\"\n placeholder=\"From date\"\n value={filters.dateFrom || ''}\n onChange={(e) => handleSelectChange('dateFrom', e.target.value)}\n className=\"w-full pl-9 pr-3 py-2 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none\"\n />\n </div>\n\n <div className=\"relative\">\n <Calendar className=\"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400\" />\n <input\n type=\"date\"\n placeholder=\"To date\"\n value={filters.dateTo || ''}\n onChange={(e) => handleSelectChange('dateTo', e.target.value)}\n className=\"w-full pl-9 pr-3 py-2 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none\"\n />\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"PaymentTable.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"PaymentTable.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"339 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"import React, { useState } from 'react';\nimport {\n ArrowUpDown, ArrowUp, ArrowDown,\n Send, XCircle, CheckCircle, MinusCircle, Clock,\n Inbox, Plus, X, ChevronDown, ChevronUp, Trash2,\n} from 'lucide-react';\n\nconst STATUS_CONFIG = {\n UNPROCESSED: { label: 'Unprocessed', icon: Clock, color: 'bg-amber-100 text-amber-700' },\n SENT: { label: 'Sent', icon: CheckCircle, color: 'bg-green-100 text-green-700' },\n SKIPPED: { label: 'Skipped', icon: MinusCircle, color: 'bg-gray-100 text-gray-500' },\n};\n\nconst TAG_COLORS = [\n '#ef4444', '#f97316', '#eab308', '#22c55e', '#06b6d4',\n '#3b82f6', '#8b5cf6', '#ec4899', '#6b7280',\n];\n\nconst COLUMNS = [\n { key: 'date', label: 'Date & Time', sortable: true },\n { key: 'source', label: 'Source', sortable: true },\n { key: 'type', label: 'Type', sortable: true },\n { key: 'recipient', label: 'Recipient', sortable: true },\n { key: 'amount', label: 'Amount', sortable: true },\n { key: 'balance', label: 'Balance', sortable: true },\n { key: 'status', label: 'Status', sortable: true },\n { key: 'tags', label: 'Tags', sortable: false },\n { key: 'actions', label: 'Actions', sortable: false },\n];\n\nfunction SortIcon({ column, sortBy, sortDir }) {\n if (sortBy !== column) return <ArrowUpDown className=\"w-3 h-3 text-gray-400\" />;\n return sortDir === 'asc'\n ? <ArrowUp className=\"w-3 h-3 text-indigo-600\" />\n : <ArrowDown className=\"w-3 h-3 text-indigo-600\" />;\n}\n\nfunction SourceBadge({ source }) {\n if (source === 'UPLOAD') {\n return (\n <span className=\"px-2 py-0.5 text-xs font-medium rounded bg-emerald-50 text-emerald-700\">\n CSV\n </span>\n );\n }\n return (\n <span className=\"px-2 py-0.5 text-xs font-medium rounded bg-indigo-50 text-indigo-700\">\n SMS\n </span>\n );\n}\n\nfunction TagCell({ payment, onAddTag, onRemoveTag, existingTags }) {\n const [open, setOpen] = useState(false);\n const [newTagName, setNewTagName] = useState('');\n const [newTagColor, setNewTagColor] = useState('#3b82f6');\n\n const paymentTags = payment.tags || [];\n const availableTags = existingTags.filter(t => !paymentTags.some(pt => pt.id === t.id));\n\n const handleAdd = (e) => {\n e.preventDefault();\n if (newTagName.trim()) {\n onAddTag(payment.id, newTagName.trim(), newTagColor);\n setNewTagName('');\n setOpen(false);\n }\n };\n\n return (\n <div className=\"flex flex-wrap items-center gap-1\">\n {paymentTags.map(tag => (\n <span\n key={tag.id}\n className=\"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-xs font-medium rounded-full text-white\"\n style={{ backgroundColor: tag.color }}\n >\n {tag.name}\n <button onClick={() => onRemoveTag(payment.id, tag.id)} className=\"hover:opacity-75\">\n <X className=\"w-2.5 h-2.5\" />\n </button>\n </span>\n ))}\n <div className=\"relative\">\n <button\n onClick={() => setOpen(!open)}\n className=\"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-xs text-gray-500 border border-dashed border-gray-300 rounded-full hover:border-gray-400\"\n >\n <Plus className=\"w-2.5 h-2.5\" />\n </button>\n {open && (\n <div className=\"absolute z-20 top-full left-0 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg p-2 w-56\">\n <form onSubmit={handleAdd} className=\"flex items-center gap-1 mb-2\">\n <input\n type=\"text\"\n value={newTagName}\n onChange={(e) => setNewTagName(e.target.value)}\n placeholder=\"New tag\"\n autoFocus\n className=\"flex-1 px-2 py-1 text-xs border border-gray-300 rounded focus:ring-1 focus:ring-indigo-500 outline-none\"\n />\n <button type=\"submit\" className=\"text-xs text-indigo-600 font-medium hover:text-indigo-700 whitespace-nowrap\">Add</button>\n </form>\n <div className=\"flex gap-1 mb-2\">\n {TAG_COLORS.map(c => (\n <button\n key={c}\n type=\"button\"\n onClick={() => setNewTagColor(c)}\n className={`w-4 h-4 rounded-full border-2 ${newTagColor === c ? 'border-gray-800' : 'border-transparent'}`}\n style={{ backgroundColor: c }}\n />\n ))}\n </div>\n {availableTags.length > 0 && (\n <div className=\"border-t border-gray-100 pt-1 flex flex-wrap gap-1\">\n {availableTags.map(tag => (\n <button\n key={tag.id}\n onClick={() => { onAddTag(payment.id, tag.name, tag.color); setOpen(false); }}\n className=\"px-1.5 py-0.5 text-xs rounded-full border border-gray-200 text-gray-600 hover:bg-gray-100\"\n >\n {tag.name}\n </button>\n ))}\n </div>\n )}\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction ExpandedRow({ payment }) {\n return (\n <tr className=\"bg-gray-50\">\n <td colSpan={COLUMNS.length} className=\"px-4 py-3\">\n <div className=\"text-xs text-gray-500 uppercase tracking-wide mb-1\">Original Message / Raw Data</div>\n <p className=\"text-sm text-gray-700 whitespace-pre-wrap break-words\">{payment.rawMessage}</p>\n {payment.debitBgn != null && (\n <p className=\"text-xs text-gray-500 mt-1\">Debit: {payment.debitBgn.toFixed(2)} BGN</p>\n )}\n {payment.creditBgn != null && (\n <p className=\"text-xs text-gray-500 mt-0.5\">Credit: {payment.creditBgn.toFixed(2)} BGN</p>\n )}\n {payment.transactionType && (\n <p className=\"text-xs text-gray-500 mt-0.5\">Transaction type: {payment.transactionType}</p>\n )}\n {payment.payerAccount && (\n <p className=\"text-xs text-gray-500 mt-0.5\">Account: {payment.payerAccount}</p>\n )}\n {payment.notifiedAt && (\n <p className=\"text-xs text-green-600 mt-2\">\n Notified on {new Date(payment.notifiedAt).toLocaleString('en-GB')}\n {payment.notifyPhone && ` to ${payment.notifyPhone}`}\n </p>\n )}\n </td>\n </tr>\n );\n}\n\nfunction StatusCell({ payment, onUpdateStatus }) {\n const [open, setOpen] = useState(false);\n const statusCfg = STATUS_CONFIG[payment.status] || STATUS_CONFIG.UNPROCESSED;\n const StatusIcon = statusCfg.icon;\n\n return (\n <div className=\"relative\">\n <button\n onClick={() => setOpen(!open)}\n className={`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full cursor-pointer ${statusCfg.color}`}\n >\n <StatusIcon className=\"w-3 h-3\" />\n {statusCfg.label}\n </button>\n {open && (\n <div className=\"absolute z-20 top-full left-0 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg py-1 w-36\">\n {Object.entries(STATUS_CONFIG).map(([key, cfg]) => {\n const Icon = cfg.icon;\n return (\n <button\n key={key}\n onClick={() => { onUpdateStatus(payment.id, key); setOpen(false); }}\n className={`w-full flex items-center gap-2 px-3 py-1.5 text-xs hover:bg-gray-50 ${payment.status === key ? 'font-bold' : ''}`}\n >\n <Icon className=\"w-3 h-3\" />\n {cfg.label}\n </button>\n );\n })}\n </div>\n )}\n </div>\n );\n}\n\nexport default function PaymentTable({\n payments, loading, sortBy, sortDir, onSort,\n onSend, onSkip, onAddTag, onRemoveTag, onDelete, onUpdateStatus, existingTags,\n}) {\n const [expandedId, setExpandedId] = useState(null);\n\n if (loading) {\n return (\n <div className=\"flex items-center justify-center py-20\">\n <div className=\"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600\"></div>\n </div>\n );\n }\n\n if (!payments || payments.length === 0) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20 text-gray-400\">\n <Inbox className=\"w-12 h-12 mb-3\" />\n <p className=\"text-lg font-medium\">No transactions found</p>\n <p className=\"text-sm\">Try adjusting your filters, ingest a payment SMS, or upload a CSV.</p>\n </div>\n );\n }\n\n const formatDate = (d) => {\n if (!d) return '—';\n return new Date(d).toLocaleDateString('en-GB', {\n day: '2-digit', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit',\n });\n };\n\n const formatAmount = (v, currency) =>\n v != null ? `${v.toFixed(2)} ${currency || 'EUR'}` : '—';\n\n return (\n <div className=\"bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden\">\n <div className=\"overflow-x-auto\">\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"bg-gray-50 border-b border-gray-200\">\n {COLUMNS.map(col => (\n <th\n key={col.key}\n className={`px-4 py-3 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider ${col.sortable ? 'cursor-pointer select-none hover:bg-gray-100' : ''}`}\n onClick={() => col.sortable && onSort(col.key)}\n >\n <span className=\"inline-flex items-center gap-1\">\n {col.label}\n {col.sortable && <SortIcon column={col.key} sortBy={sortBy} sortDir={sortDir} />}\n </span>\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"divide-y divide-gray-100\">\n {payments.map(p => {\n const isExpanded = expandedId === p.id;\n return (\n <React.Fragment key={p.id}>\n <tr className=\"hover:bg-gray-50 transition-colors\">\n <td className=\"px-4 py-3 whitespace-nowrap text-gray-700\">{formatDate(p.date)}</td>\n <td className=\"px-4 py-3 whitespace-nowrap\">\n <SourceBadge source={p.source} />\n </td>\n <td className=\"px-4 py-3 whitespace-nowrap\">\n {p.type ? (\n <span className=\"px-2 py-0.5 text-xs font-medium rounded bg-blue-50 text-blue-700\">{p.type}</span>\n ) : (p.transactionType ? (\n <span className=\"px-2 py-0.5 text-xs font-medium rounded bg-gray-100 text-gray-600 max-w-24 truncate block\" title={p.transactionType}>{p.transactionType}</span>\n ) : '—')}\n </td>\n <td className=\"px-4 py-3 text-gray-700 max-w-xs truncate\" title={p.recipient || ''}>\n <div className=\"flex items-center gap-1\">\n <span className=\"truncate\">{p.recipient || '—'}</span>\n <button\n onClick={() => setExpandedId(isExpanded ? null : p.id)}\n className=\"flex-shrink-0 text-gray-400 hover:text-gray-600\"\n title=\"Show raw data\"\n >\n {isExpanded ? <ChevronUp className=\"w-3.5 h-3.5\" /> : <ChevronDown className=\"w-3.5 h-3.5\" />}\n </button>\n </div>\n </td>\n <td className=\"px-4 py-3 whitespace-nowrap font-medium text-gray-900\">\n {formatAmount(p.amount, p.currency)}\n </td>\n <td className=\"px-4 py-3 whitespace-nowrap text-gray-600\">\n {formatAmount(p.balance, p.currency)}\n </td>\n <td className=\"px-4 py-3 whitespace-nowrap\">\n <StatusCell payment={p} onUpdateStatus={onUpdateStatus} />\n </td>\n <td className=\"px-4 py-3\">\n <TagCell\n payment={p}\n onAddTag={onAddTag}\n onRemoveTag={onRemoveTag}\n existingTags={existingTags}\n />\n </td>\n <td className=\"px-4 py-3 whitespace-nowrap\">\n <div className=\"flex items-center gap-1.5\">\n {p.status === 'UNPROCESSED' && (\n <>\n <button\n onClick={() => onSend(p.id)}\n className=\"inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium text-white bg-indigo-600 rounded-md hover:bg-indigo-700 transition-colors\"\n >\n <Send className=\"w-3 h-3\" />\n Send\n </button>\n <button\n onClick={() => onSkip(p.id)}\n className=\"inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium text-gray-600 bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors\"\n >\n <XCircle className=\"w-3 h-3\" />\n Skip\n </button>\n </>\n )}\n <button\n onClick={() => { if (window.confirm('Delete this transaction?')) onDelete(p.id); }}\n className=\"inline-flex items-center gap-1 px-2 py-1 text-xs font-medium text-red-600 bg-white border border-red-200 rounded-md hover:bg-red-50 transition-colors\"\n title=\"Delete transaction\"\n >\n <Trash2 className=\"w-3 h-3\" />\n </button>\n </div>\n </td>\n </tr>\n {isExpanded && <ExpandedRow payment={p} />}\n </React.Fragment>\n );\n })}\n </tbody>\n </table>\n </div>\n </div>\n );\n}","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"UploadPanel.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"UploadPanel.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"192 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"import React, { useState, useRef } from 'react';\nimport { Upload, FileText, CheckCircle, AlertCircle, X, ArrowLeft } from 'lucide-react';\n\nexport default function UploadPanel({ onUploadSuccess }) {\n const [files, setFiles] = useState([]);\n const [loading, setLoading] = useState(false);\n const [result, setResult] = useState(null);\n const [error, setError] = useState(null);\n const [dragging, setDragging] = useState(false);\n const fileInputRef = useRef();\n\n const addFiles = (incoming) => {\n const csvFiles = Array.from(incoming).filter(f =>\n f.name.toLowerCase().endsWith('.csv')\n );\n setFiles(prev => {\n const existingNames = new Set(prev.map(f => f.name));\n return [...prev, ...csvFiles.filter(f => !existingNames.has(f.name))];\n });\n };\n\n const handleDrop = (e) => {\n e.preventDefault();\n setDragging(false);\n addFiles(e.dataTransfer.files);\n };\n\n const handleFileSelect = (e) => {\n addFiles(e.target.files);\n e.target.value = '';\n };\n\n const removeFile = (idx) => setFiles(prev => prev.filter((_, i) => i !== idx));\n\n const handleUpload = async () => {\n if (!files.length) return;\n setLoading(true);\n setError(null);\n setResult(null);\n\n const formData = new FormData();\n files.forEach(f => formData.append('files', f));\n\n try {\n const res = await fetch('/api/upload/csv', { method: 'POST', body: formData });\n const data = await res.json();\n if (!res.ok) throw new Error(data.error || 'Upload failed');\n setResult(data);\n setFiles([]);\n } catch (err) {\n setError(err.message);\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <div className=\"max-w-2xl mx-auto\">\n <div className=\"mb-6\">\n <h2 className=\"text-lg font-semibold text-gray-900\">Upload DSK Bank CSV</h2>\n <p className=\"text-sm text-gray-500 mt-1\">\n Import transactions from DSK Bank CSV exports. Multiple files are merged automatically.\n Internal transfers are skipped. Tags are auto-assigned based on payee and description.\n </p>\n </div>\n\n {/* Drop zone */}\n <div\n onDrop={handleDrop}\n onDragOver={(e) => { e.preventDefault(); setDragging(true); }}\n onDragLeave={() => setDragging(false)}\n onClick={() => fileInputRef.current.click()}\n className={`border-2 border-dashed rounded-xl p-12 text-center cursor-pointer transition-colors ${\n dragging\n ? 'border-emerald-400 bg-emerald-50'\n : 'border-gray-300 hover:border-emerald-400 hover:bg-emerald-50'\n }`}\n >\n <Upload className={`w-10 h-10 mx-auto mb-3 ${dragging ? 'text-emerald-500' : 'text-gray-400'}`} />\n <p className=\"text-sm font-medium text-gray-700\">Drop DSK Bank CSV files here</p>\n <p className=\"text-xs text-gray-500 mt-1\">or click to select files — multiple files supported</p>\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple\n accept=\".csv\"\n className=\"hidden\"\n onChange={handleFileSelect}\n />\n </div>\n\n {/* File list */}\n {files.length > 0 && (\n <div className=\"mt-4 space-y-2\">\n {files.map((f, i) => (\n <div key={i} className=\"flex items-center gap-2 bg-white rounded-lg border border-gray-200 px-3 py-2\">\n <FileText className=\"w-4 h-4 text-gray-400 flex-shrink-0\" />\n <span className=\"text-sm text-gray-700 flex-1 truncate\">{f.name}</span>\n <span className=\"text-xs text-gray-400 flex-shrink-0\">{(f.size / 1024).toFixed(1)} KB</span>\n <button\n onClick={(e) => { e.stopPropagation(); removeFile(i); }}\n className=\"text-gray-400 hover:text-gray-600 flex-shrink-0\"\n >\n <X className=\"w-4 h-4\" />\n </button>\n </div>\n ))}\n\n <button\n onClick={handleUpload}\n disabled={loading}\n className=\"w-full py-2.5 text-sm font-medium text-white bg-emerald-600 rounded-lg hover:bg-emerald-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors mt-2\"\n >\n {loading\n ? 'Importing…'\n : `Import ${files.length} file${files.length !== 1 ? 's' : ''}`\n }\n </button>\n </div>\n )}\n\n {/* Success result */}\n {result && (\n <div className=\"mt-6 bg-green-50 border border-green-200 rounded-xl p-5\">\n <div className=\"flex items-center gap-2 mb-3\">\n <CheckCircle className=\"w-5 h-5 text-green-600 flex-shrink-0\" />\n <span className=\"font-medium text-green-800\">Import complete</span>\n </div>\n <div className=\"grid grid-cols-3 gap-3 text-center mb-3\">\n <div className=\"bg-white rounded-lg border border-green-100 py-2 px-3\">\n <p className=\"text-2xl font-bold text-green-700\">{result.imported}</p>\n <p className=\"text-xs text-gray-500\">Imported</p>\n </div>\n <div className=\"bg-white rounded-lg border border-green-100 py-2 px-3\">\n <p className=\"text-2xl font-bold text-gray-500\">{result.skipped}</p>\n <p className=\"text-xs text-gray-500\">Skipped</p>\n </div>\n <div className=\"bg-white rounded-lg border border-green-100 py-2 px-3\">\n <p className=\"text-2xl font-bold text-amber-600\">{result.errors?.length ?? 0}</p>\n <p className=\"text-xs text-gray-500\">Warnings</p>\n </div>\n </div>\n <p className=\"text-xs text-gray-500 mb-3\">\n Skipped rows are internal bank transfers (ТРАНСФЕР СОБСТВЕНИ СМЕТКИ).\n </p>\n {result.errors?.length > 0 && (\n <details className=\"mb-3\">\n <summary className=\"text-xs text-amber-700 cursor-pointer hover:text-amber-800\">\n Show {result.errors.length} warning{result.errors.length !== 1 ? 's' : ''}\n </summary>\n <ul className=\"mt-2 text-xs text-amber-600 space-y-0.5 max-h-32 overflow-y-auto\">\n {result.errors.map((e, i) => <li key={i} className=\"font-mono\">{e}</li>)}\n </ul>\n </details>\n )}\n <button\n onClick={onUploadSuccess}\n className=\"flex items-center gap-1.5 text-sm font-medium text-green-700 hover:text-green-800\"\n >\n <ArrowLeft className=\"w-4 h-4\" />\n View imported transactions\n </button>\n </div>\n )}\n\n {/* Error */}\n {error && (\n <div className=\"mt-4 bg-red-50 border border-red-200 rounded-xl p-4 flex items-start gap-3\">\n <AlertCircle className=\"w-5 h-5 text-red-500 flex-shrink-0 mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-red-800\">Upload failed</p>\n <p className=\"text-sm text-red-700 mt-0.5\">{error}</p>\n </div>\n </div>\n )}\n\n {/* Info box */}\n {!result && !error && (\n <div className=\"mt-6 bg-blue-50 border border-blue-100 rounded-xl p-4\">\n <p className=\"text-xs font-medium text-blue-800 mb-1\">Expected CSV format (DSK Bank export)</p>\n <p className=\"text-xs text-blue-700 font-mono\">\n Дата, Вид на трансакцията, Основание, Дебит BGN, Кредит BGN, Наредител/Получател, Номер сметка...\n </p>\n <p className=\"text-xs text-blue-600 mt-2\">\n Both UTF-8 and Windows-1251 encodings are supported. Tags are auto-applied based on payee and description keywords.\n </p>\n </div>\n )}\n </div>\n );\n}","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"PaymentCard.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"PaymentCard.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"186 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"import React, { useState } from 'react';\nimport {\n Send, XCircle, CheckCircle, MinusCircle, Clock,\n CreditCard, Tag, Plus, X,\n} from 'lucide-react';\n\nconst STATUS_CONFIG = {\n UNPROCESSED: { label: 'Unprocessed', icon: Clock, color: 'bg-amber-100 text-amber-700 border-amber-200' },\n SENT: { label: 'Sent', icon: CheckCircle, color: 'bg-green-100 text-green-700 border-green-200' },\n SKIPPED: { label: 'Skipped', icon: MinusCircle, color: 'bg-gray-100 text-gray-500 border-gray-200' },\n};\n\nconst TAG_COLORS = [\n '#ef4444', '#f97316', '#eab308', '#22c55e', '#06b6d4',\n '#3b82f6', '#8b5cf6', '#ec4899', '#6b7280',\n];\n\nexport default function PaymentCard({ payment, onSend, onSkip, onAddTag, onRemoveTag, existingTags }) {\n const [showTagInput, setShowTagInput] = useState(false);\n const [newTagName, setNewTagName] = useState('');\n const [newTagColor, setNewTagColor] = useState('#3b82f6');\n\n const statusCfg = STATUS_CONFIG[payment.status] || STATUS_CONFIG.UNPROCESSED;\n const StatusIcon = statusCfg.icon;\n\n const handleAddTag = (e) => {\n e.preventDefault();\n if (newTagName.trim()) {\n onAddTag(payment.id, newTagName.trim(), newTagColor);\n setNewTagName('');\n setShowTagInput(false);\n }\n };\n\n const paymentTags = payment.tags || [];\n const availableTags = existingTags.filter(t => !paymentTags.some(pt => pt.id === t.id));\n\n const formattedDate = payment.date\n ? new Date(payment.date).toLocaleDateString('en-GB', {\n day: '2-digit', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit',\n })\n : 'N/A';\n\n const currency = payment.currency || 'EUR';\n\n return (\n <div className=\"bg-white rounded-xl border border-gray-200 shadow-sm hover:shadow-md transition-shadow p-4\">\n <div className=\"flex items-start justify-between gap-3 mb-3\">\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 mb-1\">\n <span className={`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full border ${statusCfg.color}`}>\n <StatusIcon className=\"w-3 h-3\" />\n {statusCfg.label}\n </span>\n {payment.source === 'UPLOAD' ? (\n <span className=\"px-2 py-0.5 text-xs font-medium rounded bg-emerald-50 text-emerald-700\">CSV</span>\n ) : (\n <span className=\"px-2 py-0.5 text-xs font-medium rounded bg-indigo-50 text-indigo-700\">SMS</span>\n )}\n </div>\n <p className=\"text-sm text-gray-600 break-words leading-relaxed\">{payment.rawMessage}</p>\n </div>\n </div>\n\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-3 text-sm\">\n <div>\n <span className=\"text-xs text-gray-400 uppercase tracking-wide\">Amount</span>\n <p className=\"font-semibold text-gray-900\">\n {payment.amount != null ? `${payment.amount.toFixed(2)} ${currency}` : 'N/A'}\n </p>\n </div>\n <div>\n <span className=\"text-xs text-gray-400 uppercase tracking-wide\">Date</span>\n <p className=\"text-gray-700\">{formattedDate}</p>\n </div>\n <div>\n <span className=\"text-xs text-gray-400 uppercase tracking-wide\">Card</span>\n <p className=\"text-gray-700 flex items-center gap-1\">\n <CreditCard className=\"w-3 h-3 text-gray-400\" />\n {payment.card || 'N/A'}\n </p>\n </div>\n <div>\n <span className=\"text-xs text-gray-400 uppercase tracking-wide\">Balance</span>\n <p className=\"text-gray-700\">\n {payment.balance != null ? `${payment.balance.toFixed(2)} ${currency}` : 'N/A'}\n </p>\n </div>\n </div>\n\n {/* Tags */}\n <div className=\"flex flex-wrap items-center gap-1.5 mb-3\">\n <Tag className=\"w-3 h-3 text-gray-400\" />\n {paymentTags.map(tag => (\n <span\n key={tag.id}\n className=\"inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full text-white\"\n style={{ backgroundColor: tag.color }}\n >\n {tag.name}\n <button onClick={() => onRemoveTag(payment.id, tag.id)} className=\"hover:opacity-75\">\n <X className=\"w-3 h-3\" />\n </button>\n </span>\n ))}\n {!showTagInput ? (\n <button\n onClick={() => setShowTagInput(true)}\n className=\"inline-flex items-center gap-0.5 px-2 py-0.5 text-xs text-gray-500 border border-dashed border-gray-300 rounded-full hover:border-gray-400 hover:text-gray-600\"\n >\n <Plus className=\"w-3 h-3\" />\n Tag\n </button>\n ) : (\n <form onSubmit={handleAddTag} className=\"inline-flex items-center gap-1\">\n <input\n type=\"text\"\n value={newTagName}\n onChange={(e) => setNewTagName(e.target.value)}\n placeholder=\"Tag name\"\n autoFocus\n className=\"w-24 px-2 py-0.5 text-xs border border-gray-300 rounded-md focus:ring-1 focus:ring-indigo-500 outline-none\"\n />\n <div className=\"flex gap-0.5\">\n {TAG_COLORS.map(c => (\n <button\n key={c}\n type=\"button\"\n onClick={() => setNewTagColor(c)}\n className={`w-4 h-4 rounded-full border-2 ${newTagColor === c ? 'border-gray-800' : 'border-transparent'}`}\n style={{ backgroundColor: c }}\n />\n ))}\n </div>\n <button type=\"submit\" className=\"text-xs text-indigo-600 font-medium hover:text-indigo-700\">Add</button>\n <button type=\"button\" onClick={() => setShowTagInput(false)} className=\"text-xs text-gray-400 hover:text-gray-600\">\n <X className=\"w-3 h-3\" />\n </button>\n </form>\n )}\n {showTagInput && availableTags.length > 0 && (\n <div className=\"flex flex-wrap gap-1 ml-1\">\n {availableTags.slice(0, 5).map(tag => (\n <button\n key={tag.id}\n onClick={() => { onAddTag(payment.id, tag.name, tag.color); setShowTagInput(false); }}\n className=\"px-2 py-0.5 text-xs rounded-full border border-gray-200 text-gray-600 hover:bg-gray-100\"\n >\n {tag.name}\n </button>\n ))}\n </div>\n )}\n </div>\n\n {payment.status === 'UNPROCESSED' && (\n <div className=\"flex items-center gap-2 pt-3 border-t border-gray-100\">\n <button\n onClick={() => onSend(payment.id)}\n className=\"flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 transition-colors\"\n >\n <Send className=\"w-4 h-4\" />\n Send\n </button>\n <button\n onClick={() => onSkip(payment.id)}\n className=\"flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors\"\n >\n <XCircle className=\"w-4 h-4\" />\n Do Not Send\n </button>\n </div>\n )}\n\n {payment.status === 'SENT' && payment.notifiedAt && (\n <div className=\"pt-3 border-t border-gray-100\">\n <p className=\"text-xs text-green-600\">\n Notified on {new Date(payment.notifiedAt).toLocaleString('en-GB')}\n {payment.notifyPhone && ` to ${payment.notifyPhone}`}\n </p>\n </div>\n )}\n </div>\n );\n}","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"PaymentList.jsx","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"PaymentList.jsx","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"40 lines","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"import React from 'react';\nimport { Inbox } from 'lucide-react';\nimport PaymentCard from './PaymentCard';\n\nexport default function PaymentList({ payments, loading, onSend, onSkip, onAddTag, onRemoveTag, existingTags }) {\n if (loading) {\n return (\n <div className=\"flex items-center justify-center py-20\">\n <div className=\"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600\"></div>\n </div>\n );\n }\n\n if (!payments || payments.length === 0) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20 text-gray-400\">\n <Inbox className=\"w-12 h-12 mb-3\" />\n <p className=\"text-lg font-medium\">No transactions found</p>\n <p className=\"text-sm\">Try adjusting your filters, ingest a payment SMS, or upload a CSV.</p>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4\">\n {payments.map(payment => (\n <PaymentCard\n key={payment.id}\n payment={payment}\n onSend={onSend}\n onSkip={onSkip}\n onAddTag={onAddTag}\n onRemoveTag={onRemoveTag}\n existingTags={existingTags}\n />\n ))}\n </div>\n );\n}","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Update Todos","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Create folder structure and root config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend Prisma schema and migration","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend package.json and Dockerfile","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend src files (auth, parser, csvParser, index)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write backend routes (payments.js, upload.js)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend config files","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Write frontend React components","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build and verify with docker compose","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"All files are written. Now building:","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Bash","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build finance-hub Docker images","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cd /volume2/docker/finance/finance-hub && docker compose build 2>&1","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy code to clipboard","depth":24,"on_screen":false,"help_text":"Copy code","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"OUT","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Exit code 1\ntime=\"2026-05-08T21:48:56+03:00\" level=warning msg=\"The \\\"DB_PASSWORD\\\" variable is not set. Defaulting to a blank string.\"\ntime=\"2026-05-08T21:48:56+03:00\" level=warning msg=\"The \\\"DB_PASSWORD\\\" variable is not set. Defaulting to a blank string.\"\ntime=\"2026-05-08T21:48:56+03:00\" level=warning msg=\"The \\\"NOTIFIER_URL\\\" variable is not set. Defaulting to a blank string.\"\ntime=\"2026-05-08T21:48:56+03:00\" level=warning msg=\"The \\\"NOTIFY_DEFAULT_PHONE\\\" variable is not set. Defaulting to a blank string.\"\ntime=\"2026-05-08T21:48:56+03:00\" level=warning msg=\"/volume2/docker/finance/finance-hub/docker-compose.yml: `version` is obsolete\"\npermission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Head \"http://%2Fvar%2Frun%2Fdocker.sock/_ping\": dial unix /var/run/docker.sock: connect: permission denied","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Bash","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Build finance-hub Docker images with sudo","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cd /volume2/docker/finance/finance-hub && sudo docker compose build 2>&1","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy code to clipboard","depth":24,"on_screen":false,"help_text":"Copy code","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"OUT","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Exit code 1\nsudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper\nsudo: a password is required","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Bash","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Check user groups and docker socket permissions","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"groups && ls -la /var/run/docker.sock 2>/dev/null && id","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy code to clipboard","depth":24,"on_screen":false,"help_text":"Copy code","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"OUT","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"admin users ughomeusers Media Social\nsrw-rw---- 1 root docker 0 Apr 8 18:40 /var/run/docker.sock\nuid=1000(Adm1n) gid=10(admin) groups=10(admin),100(users),133(ughomeusers),1001(Media),1002(Social)","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Docker requires group access not available in this session. Let me verify the full file structure is correct, then you can build.","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Bash","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"List all created files","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"find /volume2/docker/finance/finance-hub -type f | sort","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy code to clipboard","depth":24,"on_screen":false,"help_text":"Copy code","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"OUT","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"/volume2/docker/finance/finance-hub/backend/Dockerfile\n/volume2/docker/finance/finance-hub/backend/package.json\n/volume2/docker/finance/finance-hub/backend/prisma/migrations/20260508_init/migration.sql\n/volume2/docker/finance/finance-hub/backend/prisma/migrations/migration_lock.toml\n/volume2/docker/finance/finance-hub/backend/prisma/schema.prisma\n/volume2/docker/finance/finance-hub/backend/src/auth.js\n/volume2/docker/finance/finance-hub/backend/src/csvParser.js\n/volume2/docker/finance/finance-hub/backend/src/index.js\n/volume2/docker/finance/finance-hub/backend/src/parser.js\n/volume2/docker/finance/finance-hub/backend/src/routes/payments.js\n/volume2/docker/finance/finance-hub/backend/src/routes/upload.js\n/volume2/docker/finance/finance-hub/docker-compose.yml\n/volume2/docker/finance/finance-hub/.env.example\n/volume2/docker/finance/finance-hub/frontend/Dockerfile\n/volume2/docker/finance/finance-hub/frontend/index.html\n/volume2/docker/finance/finance-hub/frontend/package.json\n/volume2/docker/finance/finance-hub/frontend/postcss.config.js\n/volume2/docker/finance/finance-hub/frontend/src/App.jsx\n/volume2/docker/finance/finance-hub/frontend/src/components/FilterBar.jsx\n/volume2/docker/finance/finance-hub/frontend/src/components/PaymentCard.jsx\n/volume2/docker/finance/finance-hub/frontend/src/components/PaymentList.jsx\n/volume2/docker/finance/finance-hub/frontend/src/components/PaymentTable.jsx\n/volume2/docker/finance/finance-hub/frontend/src/components/UploadPanel.jsx\n/volume2/docker/finance/finance-hub/frontend/src/index.css\n/volume2/docker/finance/finance-hub/frontend/src/main.jsx\n/volume2/docker/finance/finance-hub/frontend/tailwind.config.js\n/volume2/docker/finance/finance-hub/frontend/vite.config.js\n/volume2/docker/finance/finance-hub/.gitignore","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"All 28 files present. Let me also create the","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".env","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"from the example so the build works immediately:","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Bash","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Copy existing .env as base for finance-hub","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IN","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cp /volume2/docker/finance/payments-logger/.env /volume2/docker/finance/finance-hub/.env 2>/dev/null && echo \"copied\" || echo \"no source .env found\"","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy code to clipboard","depth":24,"on_screen":false,"help_text":"Copy code","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"OUT","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"copied","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":".env","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":".env","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Thinking","depth":23,"on_screen":false,"role_description":"disclosure triangle","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thinking","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Good, the","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".env","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"has all the values. Let me strip out","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"JWT_SECRET","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"since we no longer need it:","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Edit","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":".env","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":".env","depth":25,"on_screen":false,"role_description":"text"}]...
|
-8042896772090803814
|
6808971250940275611
|
click
|
accessibility
|
NULL
|
Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧ Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧G)
Run and Debug (⇧⌘D)
Remote Explorer
Extensions (⇧⌘X) - 2 require update
2
Claude Code
Containers
EXPLORER
EXPLORER
Explorer Section: finance [SSH: nas]
Explorer Section: finance [SSH: nas]
FINANCE [SSH: NAS]
auth
dsk-uploader
finance-hub
backend
frontend
.env
.env.example
.gitignore
docker-compose.yml
payments-logger
Outline Section
OUTLINE
OUTLINE
Timeline Section
TIMELINE
TIMELINE
docker-compose.yml, Editor Group 1
.env, Editor Group 1
# ── Database ───────────────────────────────────────────────────────────────────
[ENV_SECRET]
# ── Notifier service ──────────────────────────────────────────────────────────
NOTIFIER_URL=[URL_WITH_CREDENTIALS] @default(autoincrement())
rawMessage String @map("raw_message")
date DateTime?
type String?
card String?
recipient String?
amount Float?
currency String? @default("EUR")
balance Float?
source Source @default(INGEST)
status Status @default(UNPROCESSED)
tags Tag[]
notifiedAt DateTime? @map("notified_at")
notifyPhone String? @map("notify_phone")
debitBgn Float? @map("debit_bgn")
creditBgn Float? @map("credit_bgn")
transactionType String? @map("transaction_type")
payerAccount String? @map("payer_account")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("payments")
}
model Tag {
id Int @id @default(autoincrement())
name String @unique
color String @default("#6b7280")
payments Payment[]
@@map("tags")
}
enum Status { UNPROCESSED SENT SKIPPED }
enum Source { INGEST UPLOAD }
```
**Key decisions:**
- No `User` model — Authentik owns identity.
- `currency`: `EUR` for SMS ingest, `BGN` for CSV uploads.
- `debitBgn`, `creditBgn`, `transactionType`, `payerAccount`: nullable CSV-only columns; INGEST rows store nulls. Avoids a union query for the unified list view.
- `balance` is always null for CSV rows (DSK export does not include running balance).
- Fresh consolidated migration — no data migration from reference apps required.
---
## API Routes
| Method | Path | Auth | Description |
|--------|------|------|-------------|
| GET | /api/health | public | Health check |
| POST | /api/payments/ingest | public | SMS or structured ingest (source=INGEST) |
| GET | /api/payments | required | List with filters/sort/pagination (+ source filter) |
| GET | /api/payments/meta/tags | required | All tags |
| GET | /api/payments/meta/filters | required | Filter options incl. `sources` array |
| GET | /api/payments/:id | required | Single payment |
| PATCH | /api/payments/:id | required | Update status |
| DELETE | /api/payments/:id | required | Delete |
| POST | /api/payments/:id/send | required | Send notification |
| POST | /api/payments/:id/skip | required | Skip |
| POST | /api/payments/:id/tags | required | Add/upsert tag |
| DELETE | /api/payments/:id/tags/:tagId | required | Remove tag |
| POST | /api/upload/csv | required | DSK CSV file upload (source=UPLOAD) |
---
## Key Implementation Details
### auth.js (replaces entire old auth module)
```js
const PUBLIC_PATHS = new Set(['/api/health', '/api/payments/ingest']);
function authentikMiddleware(req, res, next) {
if (PUBLIC_PATHS.has(req.path)) return next();
const username = req.headers['x-authentik-username'];
if (!username) return res.status(401).json({ error: 'Unauthorized' });
req.user = {
username,
email: req.headers['x-authentik-email'] || null,
groups: (req.headers['x-authentik-groups'] || '').split(',').map(g => g.trim()).filter(Boolean),
};
next();
}
module.exports = { authentikMiddleware };
```
### csvParser.js (port of dskuploader.py)
- `iconv-lite` decodes buffer as cp1251 (DSK Bank export encoding), falls back to UTF-8
- `csv-parse` parses the decoded text with `columns: true`
- Columns: `Дата`, `Вид на трансакцията`, `Основание`, `Дебит BGN`, `Кредит BGN`, `Наредител/Получател`, `Номер сметка на наредителя / получателя`
- Card extraction: regex `/^\d{6}x{6}\d{4}$/` on first token of `Основание`
- Skips rows where `Вид на трансакцията === 'ТРАНСФЕР СОБСТВЕНИ СМЕТКИ'`
- Auto-tags via keyword rules (ЗАПЛАТА→Salary, LIDL→Groceries, NETFLIX→Subscriptions, etc.) — same logic as Python `generate_tags()`
- Returns `{ rows: PaymentData[], skipped: number, errors: string[] }`
### payments.js changes from payments-logger
1. Add `source: 'INGEST'` and `currency` to the `/ingest` create call
2. Add `source` to the `GET /` where clause filter
3. Add `sources` to `meta/filters` response
4. Currency-aware amount formatting in notification message
5. Remove all JWT/auth references (no `/auth/register`, `/auth/login`)
### upload.js (new)
- `multer` memory storage, max 10 files × 10 MB
- Calls `parseDskCsv(buffer)` per file
- Upserts tags via `prisma.tag.upsert` then connects
- Returns `{ imported, skipped, errors, payments[] }`
### Frontend changes
- **Delete**: `auth.js`, `AuthProvider.jsx`
- **main.jsx**: Remove `<AuthProvider>` wrapper
- **App.jsx**: Replace `authFetch` with plain `fetch` (Authentik session cookie travels automatically); logout → `window.location.href = '/outpost.goauthentik.io/sign_out'`; add "Payments" / "Upload CSV" tab toggle
- **FilterBar.jsx**: Add source `<select>` (All / SMS Ingest / CSV Upload); widen grid to 5 cols
- **PaymentTable.jsx**: Add `Source` column with `SMS` (indigo) / `CSV` (emerald) badge; show `${amount} ${currency}` in amount cell
- **UploadPanel.jsx** (new): Drag-and-drop zone + file list + import button + result summary with error accordion; calls `POST /api/upload/csv` with `FormData`
---
## Docker Compose
```yaml
services:
db:
image: postgres:16-alpine
environment: { POSTGRES_USER: finance, POSTGRES_PASSWORD: [PASSWORD] POSTGRES_DB: finance_hub }
volumes: [pgdata:/var/lib/postgresql/data]
healthcheck: { test: pg_isready -U finance -d finance_hub, interval: 5s }
backend:
build: ./backend
environment:
DATABASE_URL: [CONNECTION_STRING]
PORT: "3001"
NOTIFIER_URL: ${NOTIFIER_URL}
NOTIFIER_CHANNEL: ${NOTIFIER_CHANNEL:-viber}
NOTIFY_DEFAULT_PHONE: ${NOTIFY_DEFAULT_PHONE}
TZ: ${TZ:-Europe/Sofia}
ports: ["${BACKEND_PORT:-3001}:3001"]
depends_on: { db: { condition: service_healthy } }
frontend:
build: ./frontend
ports: ["${FRONTEND_PORT:-5175}:5173"]
depends_on: [backend]
volumes: { pgdata: }
```
**NPM setup:** Frontend port proxied through Authentik forward auth. Backend port exposed separately (unprotected) so the public `/api/payments/ingest` remains reachable by iOS Shortcuts / SMS gateways without login.
---
## Environment Variables (.env)
```bash
[ENV_SECRET]
NOTIFIER_URL=[URL_WITH_CREDENTIALS] @default(autoincrement())
rawMessage String @map("raw_message")
date DateTime?
type String?
card String?
recipient String?
amount Float?
currency String? @default("EUR")
balance Float?
source Source @default(INGEST)
status Status @default(UNPROCESSED)
tags Tag[]
notifiedAt DateTime? @map("notified_at")
notifyPhone String? @map("notify_phone")
debitBgn Float? @map("debit_bgn")
creditBgn Float? @map("credit_bgn")
transactionType String? @map("transaction_type")
payerAccount String? @map("payer_account")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("payments")
}
model Tag {
id Int @id @default(autoincrement())
name String @unique
color String @default("#6b7280")
payments Payment[]
@@map("tags")
}
enum Status {
UNPROCESSED
SENT
SKIPPED
}
enum Source {
INGEST
UPLOAD
}
Write
migration.sql
migration.sql
55 lines
-- CreateEnum
CREATE TYPE "Status" AS ENUM ('UNPROCESSED', 'SENT', 'SKIPPED');
CREATE TYPE "Source" AS ENUM ('INGEST', 'UPLOAD');
-- CreateTable
CREATE TABLE "payments" (
"id" SERIAL PRIMARY KEY,
"raw_message" TEXT NOT NULL,
"date" TIMESTAMP(3),
"type" TEXT,
"card" TEXT,
"recipient" TEXT,
"amount" DOUBLE PRECISION,
"currency" TEXT DEFAULT 'EUR',
"balance" DOUBLE PRECISION,
"source" "Source" NOT NULL DEFAULT 'INGEST',
"status" "Status" NOT NULL DEFAULT 'UNPROCESSED',
"notified_at" TIMESTAMP(3),
"notify_phone" TEXT,
"debit_bgn" DOUBLE PRECISION,
"credit_bgn" DOUBLE PRECISION,
"transaction_type" TEXT,
"payer_account" TEXT,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP
);
-- CreateTable
CREATE TABLE "tags" (
"id" SERIAL PRIMARY KEY,
"name" TEXT NOT NULL,
"color" TEXT NOT NULL DEFAULT '#6b7280'
);
-- CreateUniqueIndex
CREATE UNIQUE INDEX "tags_name_key" ON "tags"("name");
-- CreateTable (M2M join)
CREATE TABLE "_PaymentToTag" (
"A" INTEGER NOT NULL,
"B" INTEGER NOT NULL,
CONSTRAINT "_PaymentToTag_AB_pkey" PRIMARY KEY ("A", "B")
);
CREATE INDEX "_PaymentToTag_B_index" ON "_PaymentToTag"("B");
-- AddForeignKey
ALTER TABLE "_PaymentToTag"
ADD CONSTRAINT "_PaymentToTag_A_fkey"
FOREIGN KEY ("A") REFERENCES "payments"("id") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "_PaymentToTag"
ADD CONSTRAINT "_PaymentToTag_B_fkey"
FOREIGN KEY ("B") REFERENCES "tags"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Write
migration_lock.toml
migration_lock.toml
4 lines
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"
Update Todos
Create folder structure and root config files
Write backend Prisma schema and migration
Write backend package.json and Dockerfile
Write backend src files (auth, parser, csvParser, index)
Write backend routes (payments.js, upload.js)
Write frontend config files
Write frontend React components
Build and verify with docker compose
Write
package.json
package.json
26 lines
{
"name": "finance-hub-backend",
"version": "1.0.0",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js",
"dev": "nodemon src/index.js",
"prisma:generate": "prisma generate",
"prisma:migrate": "prisma migrate deploy"
},
"dependencies": {
"@prisma/client": "^5.22.0",
"cors": "^2.8.5",
"csv-parse": "^5.5.6",
"express": "^4.21.1",
"express-rate-limit": "^7.4.0",
"iconv-lite": "^0.6.3",
"morgan": "^1.10.0",
"multer": "^1.4.5-lts.1"
},
"devDependencies": {
"nodemon": "^3.1.7",
"prisma": "^5.22.0"
}
}
Write
Dockerfile
Dockerfile
18 lines
FROM node:20-alpine
RUN apk add --no-cache openssl
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install
COPY prisma ./prisma
RUN npx prisma generate
COPY src ./src
EXPOSE 3001
CMD ["sh", "-c", "npx prisma migrate deploy && node src/index.js"]
Update Todos
Create folder structure and root config files
Write backend Prisma schema and migration
Write backend package.json and Dockerfile
Write backend src files (auth, parser, csvParser, index)
Write backend routes (payments.js, upload.js)
Write frontend config files
Write frontend React components
Build and verify with docker compose
Write
auth.js
auth.js
27 lines
const PUBLIC_PATHS = new Set([
'/api/health',
'/api/payments/ingest',
]);
function authentikMiddleware(req, res, next) {
if (PUBLIC_PATHS.has(req.path)) return next();
const username = req.headers['x-authentik-username'];
if (!username) {
return res.status(401).json({ error: 'Unauthorized — missing Authentik session' });
}
req.user = {
username,
email: req.headers['x-authentik-email'] || null,
groups: (req.headers['x-authentik-groups'] || '')
.split(',')
.map(g => g.trim())
.filter(Boolean),
};
next();
}
module.exports = { authentikMiddleware };
Write
parser.js
parser.js
104 lines
/**
* Parses SMS payment messages from Bulgarian banks (DSK Bank, etc.)
*
* Supported formats:
*
* POS / INTERNET / ECOM / P2P payment:
* DSK Bank. Na DD/MM/YYYY v HH:MM sa plateni AMOUNT CURRENCY s karta CARD na POS s adres: RECIPIENT. Nalichni: BALANCE CURRENCY.
*
* ATM withdrawal:
* DSK Bank. Na DD/MM/YYYY v HH:MM sa iztegleni AMOUNT CURRENCY s karta CARD ot ATM s adres: RECIPIENT. Nalichni: BALANCE CURRENCY.
*
* ATM utility payment (amount may include fee as AMOUNT/FEE):
* DSK Bank. Na DD/MM/YYYY v HH:MM sa plateni AMOUNT CURRENCY/FEE CURRENCY s karta CARD na ATM s adres:RECIPIENT. Nalichni: BALANCE CURRENCY.
*/
const LOCAL_TZ = process.env.TZ || 'Europe/Sofia';
/**
* Convert a local-timezone date/time to a UTC Date object.
* Uses Intl to resolve the actual UTC offset (DST-aware).
*/
function localToUtc(year, month, day, hour, minute) {
const naive = new Date(Date.UTC(year, month - 1, day, hour, minute, 0));
const formatter = new Intl.DateTimeFormat('en-US', {
timeZone: LOCAL_TZ,
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit', second: '2-digit',
hour12: false,
});
const parts = {};
formatter.formatToParts(naive).forEach(p => { parts[p.type] = p.value; });
const localAtNaive = new Date(Date.UTC(
parseInt(parts.year), parseInt(parts.month) - 1, parseInt(parts.day),
parseInt(parts.hour) % 24, parseInt(parts.minute), parseInt(parts.second),
));
const offsetMs = localAtNaive.getTime() - naive.getTime();
return new Date(Date.UTC(year, month - 1, day, hour, minute, 0) - offsetMs);
}
function parsePaymentSms(message) {
const result = {
rawMessage: message,
date: null,
type: null,
card: null,
recipient: null,
amount: null,
balance: null,
};
// Date and time: "Na DD/MM/YYYY v HH:MM"
const dateMatch = message.match(/Na (\d{2})\/(\d{2})\/(\d{4}) v (\d{2}):(\d{2})/i);
if (dateMatch) {
const [, day, month, year, hour, minute] = dateMatch;
result.date = localToUtc(
parseInt(year), parseInt(month), parseInt(day),
parseInt(hour), parseInt(minute),
);
}
// Card mask: "s karta 400915***4447" or "s karta 483890***7162"
const cardMatch = message.match(/s karta\s+([\d*]+)/i);
if (cardMatch) {
result.card = cardMatch[1];
}
// Transaction type: supports both prepositions
// "na POS" / "na ATM" / "na INTERNET" etc. (payment)
// "ot ATM" (withdrawal)
const typeMatch = message.match(/(?:na|ot)\s+(POS|ATM|INTERNET|ECOM|P2P)\b/i);
if (typeMatch) {
result.type = typeMatch[1].toUpperCase();
}
// Recipient address: "s adres: MERCHANT" or "s adres:MERCHANT" (no space variant)
const recipientMatch = message.match(/s adres:\s*([^.]+)\./i);
if (recipientMatch) {
result.recipient = recipientMatch[1].trim();
}
// Amount: handles both verbs and the AMOUNT/FEE suffix format
// "sa plateni 7.78 EUR"
// "sa iztegleni 400.00 EUR"
// "sa plateni 0.50 EUR/0.50 EUR" → captures 0.50 (the charged amount, ignoring fee)
const amountMatch = message.match(/sa (?:plateni|iztegleni)\s+([\d.,]+)\s+[A-Z]{3}/i);
if (amountMatch) {
result.amount = parseFloat(amountMatch[1].replace(',', '.'));
}
// Balance: "Nalichni: 2583.07 EUR."
const balanceMatch = message.match(/Nalichni:\s*([\d.,]+)\s+[A-Z]{3}/i);
if (balanceMatch) {
result.balance = parseFloat(balanceMatch[1].replace(',', '.'));
}
return result;
}
module.exports = { parsePaymentSms };
Write
csvParser.js
csvParser.js
175 lines
/**
* DSK Bank CSV parser — Node.js port of dskuploader.py
*
* DSK Bank exports use Windows-1251 (cp1251) encoding.
* Each row maps to a Payment record with source=UPLOAD, currency=BGN.
*/
const { parse } = require('csv-parse');
const iconv = require('iconv-lite');
const SKIP_TYPE = 'ТРАНСФЕР СОБСТВЕНИ СМЕТКИ';
const CARD_REGEX = /^\d{6}x{6}\d{4}$/;
const POS_REGEX = /^\s*ПЛАЩАНЕ\s+НА\s+ПОС\s+\d{2}\.\d{2}\.\d{4}\s+\d{2}:\d{2}/;
const COL = {
DATE: 'Дата',
TYPE: 'Вид на трансакцията',
REASON: 'Основание',
DEBIT: 'Дебит BGN',
CREDIT: 'Кредит BGN',
PAYEE: 'Наредител/Получател',
ACCT: 'Номер сметка на наредителя / получателя',
};
const TAG_RULES = [
['reason', 'ЗАПЛАТА', 'Salary'],
['reason', 'ТЕГЛЕНЕ НА ATM', 'ATM'],
['reason', 'ПЛАЩАНЕ ПО ЗАЕМ', 'Home Credit'],
['reason', 'АВТ.ТАКСА ОБСЛУЖВАНЕ', 'Bills'],
['transactionType', 'КОМУНАЛНИ УСЛУГИ', 'Bills'],
['payee', 'VIVACOM', 'Subscriptions'],
['payee', 'Google', 'Subscriptions'],
['payee', 'SkyShowtime', 'Subscriptions'],
['payee', 'NETFLIX', 'Subscriptions'],
['payee', 'LUKOIL', 'Bills'],
['payee', 'CityGate', 'Bills'],
['payee', 'CBA', 'Groceries'],
['payee', 'FANTASTICO', 'Groceries'],
['payee', 'LIDL', 'Groceries'],
];
function parseNum(val) {
if (val == null || val === '') return null;
if (typeof val === 'number') return isNaN(val) ? null : val;
const s = String(val).trim().replace(/\xa0/g, '').replace(/ /g, '').replace(',', '.');
const n = parseFloat(s);
return isNaN(n) ? null : n;
}
function parseDate(val) {
if (!val) return null;
const s = String(val).trim();
const m = s.match(/^(\d{2})\.(\d{2})\.(\d{4})$/);
if (m) {
return new Date(Date.UTC(parseInt(m[3]), parseInt(m[2]) - 1, parseInt(m[1])));
}
return null;
}
function processReasonAndCard(reason) {
if (!reason || typeof reason !== 'string') return { reason: '', card: null };
const parts = reason.trim().split(' ');
let card = null;
let cleanReason = reason.trim();
if (parts[0] && CARD_REGEX.test(parts[0])) {
card = parts[0];
cleanReason = parts.slice(1).join(' ').trim();
}
if (POS_REGEX.test(cleanReason)) {
const posParts = cleanReason.split('<br/>');
try {
const dateTime = posParts[0].split('ПОС ')[1];
cleanReason = `POS PAYMENT ${dateTime}`;
} catch (_) { /* keep original */ }
}
return { reason: cleanReason.replace(/\s+/g, ' ').trim(), card };
}
function generateTags(fields) {
const tags = new Set();
for (const [field, keyword, tagName] of TAG_RULES) {
if ((fields[field] || '').includes(keyword)) {
tags.add(tagName);
}
}
return Array.from(tags);
}
function processRow(row) {
const transactionType = (row[COL.TYPE] || '').trim();
if (transactionType === SKIP_TYPE) return null;
const { reason, card } = processReasonAndCard(row[COL.REASON]);
const payee = (row[COL.PAYEE] || '').trim();
const payerAccount = (row[COL.ACCT] || '').trim();
const debitBgn = parseNum(row[COL.DEBIT]);
const creditBgn = parseNum(row[COL.CREDIT]);
const date = parseDate(row[COL.DATE]);
const autoTags = generateTags({ reason, transactionType, payee, debitBgn, creditBgn });
const amount = debitBgn ?? creditBgn ?? null;
const rawMessage = [
row[COL.DATE] && `Date: ${row[COL.DATE]}`,
transactionType && `Type: ${transactionType}`,
payee && `Payee: ${payee}`,
debitBgn != null && `Debit: ${debitBgn} BGN`,
creditBgn != null && `Credit: ${creditBgn} BGN`,
].filter(Boolean).join(' | ');
return {
rawMessage,
date,
type: null,
card,
recipient: payee || null,
amount,
currency: 'BGN',
balance: null,
source: 'UPLOAD',
debitBgn,
creditBgn,
transactionType: transactionType || null,
payerAccount: payerAccount || null,
autoTags,
};
}
/**
* Parse a Buffer containing a DSK Bank CSV (cp1251 or UTF-8).
* Returns { rows, skipped, errors }.
*/
async function parseDskCsv(buffer) {
// Try cp1251 first (DSK Bank export encoding), fall back to UTF-8
let text = iconv.decode(buffer, 'cp1251');
if (!text.includes(COL.DATE)) {
text = buffer.toString('utf-8');
}
return new Promise((resolve, reject) => {
const rows = [];
const errors = [];
let skipped = 0;
const parser = parse(text, {
columns: true,
skip_empty_lines: true,
trim: true,
relax_column_count: true,
});
parser.on('readable', () => {
let record;
while ((record = parser.read()) !== null) {
try {
const row = processRow(record);
if (row === null) { skipped++; } else { rows.push(row); }
} catch (err) {
errors.push(err.message);
}
}
});
parser.on('error', reject);
parser.on('end', () => resolve({ rows, skipped, errors }));
});
}
module.exports = { parseDskCsv };
Write
index.js
index.js
39 lines
const express = require('express');
const cors = require('cors');
const morgan = require('morgan');
const rateLimit = require('express-rate-limit');
const { authentikMiddleware } = require('./auth');
const paymentsRouter = require('./routes/payments');
const uploadRouter = require('./routes/upload');
const app = express();
const PORT = process.env.PORT || 3001;
app.use(cors());
app.use(express.json({ limit: '16kb' }));
app.use(morgan('combined'));
// Rate-limit the public ingest endpoint before auth middleware
const ingestLimiter = rateLimit({
windowMs: 60 * 1000,
max: 200,
standardHeaders: true,
legacyHeaders: false,
message: { error: 'Too many requests, slow down' },
});
app.use('/api/payments/ingest', ingestLimiter);
// Authentik header auth (skips /api/health and /api/payments/ingest)
app.use(authentikMiddleware);
app.get('/api/health', (_req, res) => {
res.json({ status: 'ok', timestamp: new Date().toISOString() });
});
app.use('/api/payments', paymentsRouter);
app.use('/api/upload', uploadRouter);
app.listen(PORT, '[IP_ADDRESS]', () => {
console.log(`Finance Hub API running on port ${PORT}`);
});
Update Todos
Create folder structure and root config files
Write backend Prisma schema and migration
Write backend package.json and Dockerfile
Write backend src files (auth, parser, csvParser, index)
Write backend routes (payments.js, upload.js)
Write frontend config files
Write frontend React components
Build and verify with docker compose
Write
payments.js
payments.js
399 lines
const express = require('express');
const { PrismaClient } = require('@prisma/client');
const { parsePaymentSms } = require('../pa...
|
11844
|
NULL
|
NULL
|
NULL
|
|
9890
|
445
|
16
|
2026-05-08T13:42:01.088618+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-08/1778 /Users/lukas/.screenpipe/data/data/2026-05-08/1778247721088_m1.jpg...
|
PhpStorm
|
faVsco.js – Client.php
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
19
Previous Highlighted Error
Next Highlighted Error
[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {
"headers":{
"Date":["Thu,07 May 2026 14:21:15 GMT"],
"Content-Type":["application/json;charset=utf-8"],
"Transfer-Encoding":["chunked"],
"Connection":["keep-alive"],
"CF-Ray":["9f80deb8db60dc3a-SOF"],
"CF-Cache-Status":["DYNAMIC"],
"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],
"Vary":["origin,
accept-encoding"],
"access-control-allow-credentials":["false"],
"server-timing":["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\",
cfr;desc=\"9f80deb8e7c6dc3a-IAD\""],
"x-content-type-options":["nosniff"],
"x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],
"Set-Cookie":["__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-[IP_ADDRESS]-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,
07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None"],
"Report-To":["{
\"endpoints\":[{
\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\"}],
\"group\":\"cf-nel\",
\"max_age\":604800}"],
"NEL":["{
\"success_fraction\":0.01,
\"report_to\":\"cf-nel\",
\"max_age\":604800}"],
"Server":["cloudflare"]}} {
"correlation_id":"95236535-ec98-4541-b92a-adfa73b69eab",
"trace_id":"c7ab8365-903f-46d4-9403-0e5b551e3545"}
Show Replace Field
Search History
doSer
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
0 results
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
2
64
1
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot;
use HubSpot\Client\Crm\Deals\ApiException as DealApiException;
use HubSpot\Client\Crm\Contacts\ApiException as ContactApiException;
use HubSpot\Client\Crm\Companies\ApiException as CompanyApiException;
use HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations as ContactsWithAssociations;
use HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations as CompaniesWithAssociations;
use HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations as DealWithAssociations;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations as ObjectWithAssociations;
use HubSpot\Client\Crm\Pipelines\Model\Error;
use HubSpot\Client\Crm\Pipelines\Model\PipelineStage;
use HubSpot\Client\Crm\Properties\Model\Property;
use HubSpot\Discovery\Discovery;
use Jiminny\Exceptions\CrmException;
use Jiminny\Exceptions\RateLimitException;
use Jiminny\Exceptions\SocialAccountTokenInvalidException;
use Jiminny\Jobs\Crm\NoteObject;
use Jiminny\Models\Crm\Field;
use Jiminny\Services\Crm\BaseClient;
use Jiminny\Services\Crm\Hubspot\DTO\Response\Owner;
use Jiminny\Services\SocialAccountService;
use SevenShores\Hubspot\Exceptions\BadRequest;
use SevenShores\Hubspot\Exceptions\HubspotException;
use SevenShores\Hubspot\Factory;
use SevenShores\Hubspot\Http\Response;
use Jiminny\Services\Crm\Hubspot\Pagination\HubspotPaginationService;
use Throwable;
/**
* @phpstan-type CrmFieldOption array{id:string, label:string, value?:string}
*/
class Client extends BaseClient implements HubspotClientInterface
{
public const string MIN_API_VERSION = '2';
public const string BASE_URL = '[URL_WITH_CREDENTIALS] T
* @param callable(): T $apiCall
* @return T
*
* @throws RateLimitException
*/
private function executeRequest(callable $apiCall)
{
try {
return $apiCall();
} catch (Throwable $e) {
if ($this->isHubspotRateLimit($e)) {
$retryAfter = $this->parseRetryAfter($e);
$this->log->warning('[Hubspot] Received 429 from API', [
'team_id' => $this->config->team_id,
'config_id' => $this->config->getId(),
'retry_after' => $retryAfter,
'reason' => $e->getMessage(),
]);
throw new RateLimitException('Hubspot returned 429', $retryAfter, $e);
}
throw $e;
}
}
public function isHubspotRateLimit(Throwable $e): bool
{
if ($e instanceof BadRequest
|| $e instanceof DealApiException
|| $e instanceof ContactApiException
|| $e instanceof CompanyApiException
|| $e instanceof \GuzzleHttp\Exception\RequestException
) {
return (int) $e->getCode() === 429;
}
return false;
}
public function parseRetryAfter(Throwable $e): int
{
// First try to get Retry-After from response headers
if (method_exists($e, 'getResponseHeaders')) {
$headers = $e->getResponseHeaders() ?: [];
$value = $headers['Retry-After'] ?? $headers['retry-after'] ?? null;
if (is_array($value)) {
$value = $value[0] ?? null;
}
if (is_numeric($value)) {
return (int) $value;
}
}
if (method_exists($e, 'getResponseBody')) {
$body = $e->getResponseBody();
if (is_string($body)) {
$body = json_decode($body, true) ?? [];
}
$policyName = $body['policyName'] ?? $body['policy'] ?? $body['context']['policyName'] ?? null;
if ($policyName === 'TEN_SECONDLY_ROLLING' || $policyName === 'ten_secondly_rolling') {
return 10;
}
if ($policyName === 'SECONDLY' || $policyName === 'secondly') {
return 1;
}
}
$this->log->warning('[Hubspot] No retry-after header or policy name found, using default', [
'exception_class' => get_class($e),
]);
return 10;
}
public function getMinimumApiVersion(): string
{
return self::MIN_API_VERSION;
}
public function getInstance(): Factory
{
return new Factory([
'key' => $this->accessToken,
'oauth2' => true,
'base_url' => $this->baseUrl,
]);
}
public function getNewInstance(): Discovery
{
return \HubSpot\Factory::createWithAccessToken($this->accessToken);
}
/**
* Secondly and daily limits for Hubspot API
*
* Product Tier: Free & Starter | Professional & Enterprise | API add-on (any tier)
* Burst: 100/10 seconds | 150/10 seconds | 200/10 seconds
* Daily: 250,000 | 500,000 | 1,000,000
*
* Official documentation states: The search endpoints are rate limited to five requests per second.
* Since with 5 RPS were still hitting secondly rate limits we lowered it to 4
*/
public function getPaginatedData(array $payload, string $type, int $offset = 0): array
{
$total = 0;
$lastId = null;
$rows = [];
foreach ($this->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastId) as $row) {
$rows[] = $row;
}
return ['results' => $rows, 'total' => $total, 'last_record' => $lastId];
}
/**
* @throws HubspotException
* @throws SocialAccountTokenInvalidException
* @throws BadRequest
*/
public function getPaginatedDataGenerator(
array $payload,
string $type,
int $offset = 0,
int &$total = 0,
?string &$lastRecordId = null
): \Generator {
return $this->paginationService->getPaginatedDataGenerator(
$this,
$payload,
$type,
$offset,
$total,
$lastRecordId
);
}
/**
* Execute a search request against HubSpot CRM objects with rate limiting.
*
* @param string $objectType The object type ('deals', 'companies', 'contacts', 'calls')
* @param array<string, mixed> $payload The search payload with filters, sorts, properties, etc.
* @return array The search response with 'results', 'total', 'paging' keys
* @throws RateLimitException When rate limit is hit
* @throws HubspotException On API errors
*/
public function search(string $objectType, array $payload): array
{
$endpoint = self::BASE_URL . "/crm/v3/objects/{$objectType}/search";
return $this->executeRequest(function () use ($endpoint, $payload) {
$response = $this->getInstance()->getClient()->request('POST', $endpoint, ['json' => $payload]);
return $response->toArray();
});
}
/**
* @throws DealApiException
* @throws CrmException
*/
public function getOpportunityById(string $crmId, array $fields): array
{
try {
// $deal = $this->executeRequest(fn () => $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$deal = $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$crmId,
implode(',', $fields),
'companies,contacts'
);
} catch (DealApiException $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $deal instanceof DealWithAssociations) {
throw new CrmException('Deal not found');
}
return [
'id' => $deal->getId(),
'properties' => $deal->getProperties(),
'associations' => $deal->getAssociations(),
];
}
/**
* Generic batch read method for HubSpot objects
*
* @param string $objectType The object type ('deals', 'companies', 'contacts')
* @param array<string> $crmIds Array of HubSpot object IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with object data
*/
private function batchReadObjects(string $objectType, array $crmIds, array $fields): array
{
if (empty($crmIds)) {
return [];
}
$this->validateBatchSize($objectType, $crmIds);
$this->ensureValidToken();
try {
$batchConfig = $this->createBatchConfiguration($objectType);
$batchReadRequest = $this->prepareBatchRequest($batchConfig, $crmIds, $fields);
$response = $batchConfig['api']->read($batchReadRequest);
$this->validateApiResponse($response, $objectType);
$results = $this->processApiResults($response);
$this->logBatchResults($objectType, $crmIds, $results);
return $results;
} catch (\Throwable $e) {
$this->handleBatchError($e, $objectType, $crmIds);
}
}
private function validateBatchSize(string $objectType, array $crmIds): void
{
if (count($crmIds) > 100) {
throw new \InvalidArgumentException("Batch size cannot exceed 100 {$objectType}");
}
}
private function createBatchConfiguration(string $objectType): array
{
$configurations = [
'deals' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->deals()->batchApi(),
],
'companies' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->companies()->batchApi(),
],
'contacts' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->contacts()->batchApi(),
],
];
if (! isset($configurations[$objectType])) {
throw new \InvalidArgumentException("Unsupported object type: {$objectType}");
}
return $configurations[$objectType];
}
private function prepareBatchRequest(array $batchConfig, array $crmIds, array $fields): object
{
$batchReadRequest = $batchConfig['batchReadRequest'];
$inputClass = $batchConfig['inputClass'];
$inputs = array_map(function ($crmId) use ($inputClass) {
$input = new $inputClass();
$input->setId($crmId);
return $input;
}, $crmIds);
$batchReadRequest->setInputs($inputs);
$batchReadRequest->setProperties($fields);
return $batchReadRequest;
}
private function validateApiResponse($response, string $objectType): void
{
if (! $response) {
throw new CrmException("HubSpot API returned null response for {$objectType} batch read");
}
}
private function processApiResults($response): array
{
$results = [];
$responseResults = $response->getResults();
if ($responseResults) {
foreach ($responseResults as $object) {
if ($object && $object->getId()) {
$results[$object->getId()] = [
'id' => $object->getId(),
'properties' => $object->getProperties() ?: [],
];
}
}
}
return $results;
}
private function logBatchResults(string $objectType, array $crmIds, array $results): void
{
$this->log->info("[HubSpot] Batch fetched {$objectType}", [
'requested_count' => count($crmIds),
'returned_count' => count($results),
'crm_ids' => $crmIds,
]);
}
private function handleBatchError(\Throwable $e, string $objectType, array $crmIds): void
{
$errorMessage = $e->getMessage() ?: 'Unknown error';
$errorTrace = $e->getTraceAsString() ?: 'No trace available';
$this->log->error("[HubSpot] Failed to batch fetch {$objectType}", [
'crm_ids' => $crmIds,
'error' => $errorMessage,
'trace' => $errorTrace,
]);
throw new CrmException("Failed to batch fetch {$objectType}: " . $errorMessage);
}
/**
* Batch read multiple opportunities by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot deal IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with opportunity data
*/
public function getOpportunitiesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('deals', $crmIds, $fields);
}
/**
* Batch read multiple companies by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot company IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with company data
*/
public function getCompaniesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('companies', $crmIds, $fields);
}
/**
* Batch read multiple contacts by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot contact IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with contact data
*/
public function getContactsByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('contacts', $crmIds, $fields);
}
/**
* @throws CompanyApiException
* @throws CrmException
*/
public function getAccountById(string $crmId, array $fields): array
{
try {
$company = $this->getNewInstance()->crm()->companies()->basicApi()->getById(
$crmId,
implode(',', $fields),
);
} catch (CompanyApiException $e) {
$this->log->info('[Hubspot] Failed to fetch account', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $company instanceof CompaniesWithAssociations) {
throw new CrmException('Account not found');
}
return [
'id' => $company->getId(),
'properties' => $company->getProperties(),
];
}
/**
* @throws ContactApiException
* @throws CrmException
*/
public function getContactById(string $crmId, array $fields): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$crmId,
implode(',', $fields)
);
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $contact instanceof ContactsWithAssociations) {
throw new CrmException('Contact not found');
}
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
}
/**
* This is email search request that Hubspot offers as GET (more generous quota)
*/
public function getContactByEmail(string $email, array $fields = []): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$email,
implode(',', $fields),
null,
false,
'email'
);
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'email' => $email,
'reason' => $e->getMessage(),
]);
return [];
}
}
/**
* @throws CrmException
*/
public function fetchProperty(string $objectType, string $propertyId): Property
{
$result = $this->getNewInstance()->crm()->properties()->coreApi()->getByName($objectType, $propertyId);
if (! $result instanceof Property) {
$this->log->error('[Hubspot] Failed to fetch property', [
'object_type' => $objectType,
'property_id' => $propertyId,
'reason' => $result->getMessage(),
]);
throw new CrmException('Failed to fetch property');
}
return $result;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchPropertyOptions(string $objectType, string $propertyId): array
{
/** @var array<CrmFieldOption> */
return $this->fetchProperty($objectType, $propertyId)->getOptions();
}
/**
* @return array<array{id:string, label:string, deleted:bool}>
*/
public function fetchCallDispositions(): array
{
/** @var Response $response */
$response = $this->getInstance()->engagements()->getCallDispositions();
/**
* @var array<array{
* id:string,
* label:string,
* deleted: bool
* }>
*/
return $response->toArray();
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityPipelineStages(): array
{
$stages = [];
$apiResponse = $this->getNewInstance()->crm()->pipelines()->pipelinesApi()->getAll('deals');
if ($apiResponse instanceof Error) {
$this->log->error('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $apiResponse->getMessage(),
]);
return [];
}
foreach ($apiResponse->getResults() as $pipeline) {
$pipelineStages = array_map(
static function (PipelineStage $stage) {
return [
'id' => $stage->getId(),
'label' => $stage->getLabel(),
];
},
$pipeline->getStages()
);
$stages = array_merge($stages, $pipelineStages);
}
return $stages;
}
public function fetchOpportunityPipelines(): array
{
$pipelines = [];
try {
$apiResponse = $this->makeRequest('/crm/v3/pipelines/deals');
} catch (\Exception $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $e->getMessage(),
]);
return [];
}
$response = $apiResponse->toArray();
foreach ($response['results'] as $pipeline) {
$pipelines[] = [
'id' => $pipeline['id'],
'label' => $pipeline['label'],
];
}
return $pipelines;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchMeetingOutcomeFieldOptions(Field $field): array
{
return $field->getCrmProviderId() === 'meetingOutcome'
? $this->fetchMeetingOutcomeTypes()
: $this->fetchCallActivityTypes();
}
public function fetchMeetingOutcomeTypes(): array
{
return $this->extractMeetingTypeOptions(
'[URL_WITH_CREDENTIALS] Response $response */
$response = $this->getInstance()
->getClient()
->request('GET', $endpoint);
/**
* @var array<array{
* value: string,
* label: string,
* displayOrder: int
* }> $optionData
*/
$optionData = $response->toArray()['options'] ?? [];
$options = [];
foreach ($optionData as $item) {
$options[] = [
'id' => $item['value'],
'value' => $item['value'],
'label' => $item['label'],
'display_order' => $item['displayOrder'],
];
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchDispositionFieldOptions(): array
{
$options = [];
$dispositions = $this->fetchCallDispositions();
foreach ($dispositions as $disposition) {
if ($disposition['deleted'] !== false) {
continue;
}
$option['value'] = $disposition['id'];
$option['id'] = $disposition['id'];
$option['label'] = $disposition['label'];
$options[] = $option;
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityFieldOptions(Field $field): array
{
if ($field->isStageField()) {
return $this->fetchOpportunityPipelineStages();
}
if ($field->isPipelineField()) {
return $this->fetchOpportunityPipelines();
}
return $this->fetchPropertyOptions('deals', $field->getCrmProviderId());
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function makeRequest(string $endpoint, $method = 'GET', $payload = [], ?string $queryString = null)
{
$endpoint = self::BASE_URL . $endpoint;
if ($method === 'GET') {
$response = $this->getInstance()->getClient()?->request(
method: $method,
endpoint: $endpoint,
query_string: $queryString
);
} else {
$response = $this->getInstance()->getClient()->request($method, $endpoint, [
'json' => ($payload),
]);
}
//
// $max = $response->getHeaderLine('X-HubSpot-RateLimit-Max'); // "110"
// $remaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'); // "109"
// $interval = $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // "10000"
// $body = json_decode((string) $response->getBody(), true);
//
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$max ' . PHP_EOL . print_r($max, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$remaining ' . PHP_EOL . print_r($remaining, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$interval ' . PHP_EOL . print_r($interval, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$body ' . PHP_EOL . print_r($body, true));
return $response;
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function createMeeting(array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings';
return $this->makeRequest($endpoint, 'POST', $payload);
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function updateMeeting(string $meetingId, array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings/' . $meetingId;
return $this->makeRequest($endpoint, 'PATCH', $payload);
}
/**
* @throws \Exception
*/
public function createNote(
string $body,
string $ownerId,
int $timestamp,
string $objectId,
NoteObject $noteObject
): ?string {
try {
$noteInput = new SimplePublicObjectInput([
'properties' => [
'hs_note_body' => $body,
'hubspot_owner_id' => $ownerId,
'hs_timestamp' => $timestamp,
],
]);
// Create note
$note = $this->getNewInstance()->crm()->objects()->basicApi()->create('note', $noteInput);
$this->getNewInstance()->crm()->objects()->associationsApi()->create(
'note',
$note->getId(),
$this->getNoteObject($noteObject),
$objectId,
$this->getNoteAssociationType($noteObject),
);
return $note->getId();
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to create note', [
'objectId' => $objectId,
'noteObject' => $noteObject->getObjectType(),
'reason' => $e->getMessage(),
]);
\Sentry::captureException($e);
}
return null;
}
public function updateEngagement(string $objectId, array $engagement, array $metadata): void
{
$this->getInstance()->engagements()->update($objectId, $engagement, $metadata);
}
public function getEngagementData(string $engagementId): array
{
$engagement = $this->getInstance()->engagements()->get($engagementId);
return $engagement->toArray();
}
public function createEngagement(array $engagement, array $associations, array $metadata): Response
{
return $this->getInstance()
->engagements()
->create($engagement, $associations, $metadata);
}
public function isUnauthorizedException(\Exception $e): bool
{
if ($e instanceof BadRequest
|| $e instanceof DealApiException
|| $e instanceof ContactApiException
|| $e instanceof CompanyApiException
) {
return (int) $e->getCode() === 401;
}
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
return $e->getResponse()?->getStatusCode() === 401;
}
$message = strtolower($e->getMessage());
return str_contains($message, '401 unauthorized') ||
str_contains($message, 'http 401') ||
str_contains($message, 'status code 401') ||
(preg_match('/\b401\b/', $message) === 1 && str_contains($message, 'unauthorized'));
}
/**
* Validates and refreshes the access token if needed before API requests.
* This ensures long-running processes don't fail due to token expiration.
*
* @throws SocialAccountTokenInvalidException
*/
public function ensureValidToken(): void
{
if ($this->oauthAccount === null) {
return;
}
$newToken = $this->tokenManager->ensureValidToken($this->oauthAccount);
if ($newToken !== null) {
$this->accessToken = $newToken;
}
}
public function getConfig()
{
return $this->config;
}
// returns only active (archived=false)
public function getOwners(): array
{
return $this->getNewInstance()->crm()->owners()->getAll();
}
/**
* @param bool $archived
*
* @return array<Owner>|[]
*/
public function getOwnersArchived(bool $archived = true): array
{
$endpoint = '/crm/v3/owners';
$queryParams = [
'archived' => $archived ? 'true' : 'false',
];
$queryString = http_build_query($queryParams);
$owners = [];
try {
$response = $this->makeRequest(endpoint: $endpoint, queryString: $queryString);
$responseData = $response?->toArray();
foreach ($responseData['results'] as $result) {
try {
$owners[] = Owner::create($result);
} catch (Throwable $e) {
$this->log->error('[HubSpot] Failed to process owner data', [
'result' => $result,
'error' => $e->getMessage(),
]);
continue;
}
}
} catch (Throwable $e) {
$this->log->error('HubSpot] Failed to fetch owners', [
'archived' => $archived,
'error' => $e->getMessage(),
]);
return [];
}
return $owners;
}
public function getMeeting(string $engagementId): ObjectWithAssociations
{
return $this->getNewInstance()->crm()->objects()->basicApi()
->getById('meeting', $engagementId, null, 'contact,company,deal');
}
public function deleteEngagement(string $engagementId): void
{
$this->getInstance()->engagements()->delete((int) $engagementId);
}
public function getAssociationsData(array $ids, string $fromObject, string $toObject): array
{
$associationData = [];
$idChunks = array_chunk($ids, self::ASSOCIATIONS_BATCH_SIZE_LIMIT);
foreach ($idChunks as $idChunk) {
try {
$batchInput = new \HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId();
$batchInput->setInputs(array_map(function ($id) {
$publicObjectId = new \HubSpot\Client\Crm\Associations\Model\PublicObjectId();
$publicObjectId->setId($id);
return $publicObjectId;
}, $idChunk));
$associatedObjectsData = $this
->getNewInstance()
->crm()
->associations()
->batchApi()
->read($fromObject, $toObject, $batchInput);
if ($associatedObjectsData instanceof \HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti) {
foreach ($associatedObjectsData->getResults() as $association) {
$from = $association->getFrom()->getId();
$toAssociations = $association->getTo();
if (! empty($toAssociations)) {
$associationData[$from] = array_map(function ($item) {
return $item->getId();
}, $toAssociations);
}
}
}
} catch (RateLimitException $e) {
throw $e;
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to fetch associations', [
'from_object' => $fromObject,
'to_object' => $toObject,
'reason' => $e->getMessage(),
]);
}
}
return $associationData;
}
/**
* @throws \Exception
*/
private function getNoteAssociationType(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'note_to_deal',
NoteObject::Lead, NoteObject::Contact => 'note_to_contact', // or 'note_to_lead' if your portal supports it
NoteObject::Account => 'note_to_company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
/**
* @throws \Exception
*/
private function getNoteObject(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'deal',
NoteObject::Lead, NoteObject::Contact => 'contact',
NoteObject::Account => 'company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
public function addAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/create";
return $this->makeRequest($endpoint, 'POST', $payload);
}
public function removeAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/archive";
return $this->makeRequest($endpoint, 'POST', $payload);
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"19","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {\n\"headers\":{\n\"Date\":[\"Thu,07 May 2026 14:21:15 GMT\"],\n \"Content-Type\":[\"application/json;charset=utf-8\"],\n \"Transfer-Encoding\":[\"chunked\"],\n \"Connection\":[\"keep-alive\"],\n \"CF-Ray\":[\"9f80deb8db60dc3a-SOF\"],\n \"CF-Cache-Status\":[\"DYNAMIC\"],\n \"Strict-Transport-Security\":[\"max-age=31536000; includeSubDomains; preload\"],\n \"Vary\":[\"origin,\n accept-encoding\"],\n \"access-control-allow-credentials\":[\"false\"],\n \"server-timing\":[\"hcid;desc=\\\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\\\",\n cfr;desc=\\\"9f80deb8e7c6dc3a-IAD\\\"\"],\n \"x-content-type-options\":[\"nosniff\"],\n \"x-hubspot-correlation-id\":[\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\"],\n \"Set-Cookie\":[\"__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-1.0.1.1-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,\n 07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None\"],\n \"Report-To\":[\"{\n\\\"endpoints\\\":[{\n\\\"url\\\":\\\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report\\\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\\\"}],\n\\\"group\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"NEL\":[\"{\n\\\"success_fraction\\\":0.01,\n\\\"report_to\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"Server\":[\"cloudflare\"]}} {\n\"correlation_id\":\"95236535-ec98-4541-b92a-adfa73b69eab\",\n\"trace_id\":\"c7ab8365-903f-46d4-9403-0e5b551e3545\"}","depth":4,"on_screen":true,"value":"[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {\n\"headers\":{\n\"Date\":[\"Thu,07 May 2026 14:21:15 GMT\"],\n \"Content-Type\":[\"application/json;charset=utf-8\"],\n \"Transfer-Encoding\":[\"chunked\"],\n \"Connection\":[\"keep-alive\"],\n \"CF-Ray\":[\"9f80deb8db60dc3a-SOF\"],\n \"CF-Cache-Status\":[\"DYNAMIC\"],\n \"Strict-Transport-Security\":[\"max-age=31536000; includeSubDomains; preload\"],\n \"Vary\":[\"origin,\n accept-encoding\"],\n \"access-control-allow-credentials\":[\"false\"],\n \"server-timing\":[\"hcid;desc=\\\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\\\",\n cfr;desc=\\\"9f80deb8e7c6dc3a-IAD\\\"\"],\n \"x-content-type-options\":[\"nosniff\"],\n \"x-hubspot-correlation-id\":[\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\"],\n \"Set-Cookie\":[\"__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-1.0.1.1-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,\n 07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None\"],\n \"Report-To\":[\"{\n\\\"endpoints\\\":[{\n\\\"url\\\":\\\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report\\\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\\\"}],\n\\\"group\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"NEL\":[\"{\n\\\"success_fraction\\\":0.01,\n\\\"report_to\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"Server\":[\"cloudflare\"]}} {\n\"correlation_id\":\"95236535-ec98-4541-b92a-adfa73b69eab\",\n\"trace_id\":\"c7ab8365-903f-46d4-9403-0e5b551e3545\"}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"doSer","depth":4,"on_screen":true,"value":"doSer","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"0 results","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"64","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Hubspot;\n\nuse HubSpot\\Client\\Crm\\Deals\\ApiException as DealApiException;\nuse HubSpot\\Client\\Crm\\Contacts\\ApiException as ContactApiException;\nuse HubSpot\\Client\\Crm\\Companies\\ApiException as CompanyApiException;\nuse HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations as ContactsWithAssociations;\nuse HubSpot\\Client\\Crm\\Companies\\Model\\SimplePublicObjectWithAssociations as CompaniesWithAssociations;\nuse HubSpot\\Client\\Crm\\Deals\\Model\\SimplePublicObjectWithAssociations as DealWithAssociations;\nuse HubSpot\\Client\\Crm\\Objects\\Model\\SimplePublicObjectInput;\nuse HubSpot\\Client\\Crm\\Objects\\Model\\SimplePublicObjectWithAssociations as ObjectWithAssociations;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\Error;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\PipelineStage;\nuse HubSpot\\Client\\Crm\\Properties\\Model\\Property;\nuse HubSpot\\Discovery\\Discovery;\nuse Jiminny\\Exceptions\\CrmException;\nuse Jiminny\\Exceptions\\RateLimitException;\nuse Jiminny\\Exceptions\\SocialAccountTokenInvalidException;\nuse Jiminny\\Jobs\\Crm\\NoteObject;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Services\\Crm\\BaseClient;\nuse Jiminny\\Services\\Crm\\Hubspot\\DTO\\Response\\Owner;\nuse Jiminny\\Services\\SocialAccountService;\nuse SevenShores\\Hubspot\\Exceptions\\BadRequest;\nuse SevenShores\\Hubspot\\Exceptions\\HubspotException;\nuse SevenShores\\Hubspot\\Factory;\nuse SevenShores\\Hubspot\\Http\\Response;\nuse Jiminny\\Services\\Crm\\Hubspot\\Pagination\\HubspotPaginationService;\nuse Throwable;\n\n/**\n * @phpstan-type CrmFieldOption array{id:string, label:string, value?:string}\n */\nclass Client extends BaseClient implements HubspotClientInterface\n{\n public const string MIN_API_VERSION = '2';\n\n public const string BASE_URL = 'https://api.hubapi.com';\n\n public const int ASSOCIATIONS_BATCH_SIZE_LIMIT = 1000;\n\n private HubspotPaginationService $paginationService;\n private HubspotTokenManager $tokenManager;\n\n public function __construct(\n SocialAccountService $socialAccountService,\n HubspotPaginationService $paginationService,\n HubspotTokenManager $tokenManager,\n ) {\n parent::__construct($socialAccountService);\n $this->paginationService = $paginationService;\n $this->tokenManager = $tokenManager;\n\n $this->setBaseUrl(self::BASE_URL);\n $this->setVersion(self::MIN_API_VERSION);\n }\n\n /**\n * Reacts to a rate limits (429) from HubSpot by translating it\n * into a RateLimitException carrying retry_after.\n *\n * Wrap any outbound HubSpot call (SDK or raw HTTP) like:\n *\n * $this->executeRequest(fn () => $this->getNewInstance()->crm()->...);\n *\n * @template T\n * @param callable(): T $apiCall\n * @return T\n *\n * @throws RateLimitException\n */\n private function executeRequest(callable $apiCall)\n {\n try {\n return $apiCall();\n } catch (Throwable $e) {\n if ($this->isHubspotRateLimit($e)) {\n $retryAfter = $this->parseRetryAfter($e);\n\n $this->log->warning('[Hubspot] Received 429 from API', [\n 'team_id' => $this->config->team_id,\n 'config_id' => $this->config->getId(),\n 'retry_after' => $retryAfter,\n 'reason' => $e->getMessage(),\n ]);\n\n throw new RateLimitException('Hubspot returned 429', $retryAfter, $e);\n }\n\n throw $e;\n }\n }\n\n public function isHubspotRateLimit(Throwable $e): bool\n {\n if ($e instanceof BadRequest\n || $e instanceof DealApiException\n || $e instanceof ContactApiException\n || $e instanceof CompanyApiException\n || $e instanceof \\GuzzleHttp\\Exception\\RequestException\n ) {\n return (int) $e->getCode() === 429;\n }\n\n return false;\n }\n\n public function parseRetryAfter(Throwable $e): int\n {\n // First try to get Retry-After from response headers\n if (method_exists($e, 'getResponseHeaders')) {\n $headers = $e->getResponseHeaders() ?: [];\n $value = $headers['Retry-After'] ?? $headers['retry-after'] ?? null;\n if (is_array($value)) {\n $value = $value[0] ?? null;\n }\n if (is_numeric($value)) {\n return (int) $value;\n }\n }\n\n if (method_exists($e, 'getResponseBody')) {\n $body = $e->getResponseBody();\n if (is_string($body)) {\n $body = json_decode($body, true) ?? [];\n }\n\n $policyName = $body['policyName'] ?? $body['policy'] ?? $body['context']['policyName'] ?? null;\n\n if ($policyName === 'TEN_SECONDLY_ROLLING' || $policyName === 'ten_secondly_rolling') {\n return 10;\n }\n if ($policyName === 'SECONDLY' || $policyName === 'secondly') {\n return 1;\n }\n }\n\n $this->log->warning('[Hubspot] No retry-after header or policy name found, using default', [\n 'exception_class' => get_class($e),\n ]);\n\n return 10;\n }\n\n public function getMinimumApiVersion(): string\n {\n return self::MIN_API_VERSION;\n }\n\n public function getInstance(): Factory\n {\n return new Factory([\n 'key' => $this->accessToken,\n 'oauth2' => true,\n 'base_url' => $this->baseUrl,\n ]);\n }\n\n public function getNewInstance(): Discovery\n {\n return \\HubSpot\\Factory::createWithAccessToken($this->accessToken);\n }\n\n /**\n * Secondly and daily limits for Hubspot API\n *\n * Product Tier: Free & Starter | Professional & Enterprise | API add-on (any tier)\n * Burst: 100/10 seconds | 150/10 seconds | 200/10 seconds\n * Daily: 250,000 | 500,000 | 1,000,000\n *\n * Official documentation states: The search endpoints are rate limited to five requests per second.\n * Since with 5 RPS were still hitting secondly rate limits we lowered it to 4\n */\n public function getPaginatedData(array $payload, string $type, int $offset = 0): array\n {\n $total = 0;\n $lastId = null;\n $rows = [];\n foreach ($this->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastId) as $row) {\n $rows[] = $row;\n }\n\n return ['results' => $rows, 'total' => $total, 'last_record' => $lastId];\n }\n\n /**\n * @throws HubspotException\n * @throws SocialAccountTokenInvalidException\n * @throws BadRequest\n */\n public function getPaginatedDataGenerator(\n array $payload,\n string $type,\n int $offset = 0,\n int &$total = 0,\n ?string &$lastRecordId = null\n ): \\Generator {\n return $this->paginationService->getPaginatedDataGenerator(\n $this,\n $payload,\n $type,\n $offset,\n $total,\n $lastRecordId\n );\n }\n\n /**\n * Execute a search request against HubSpot CRM objects with rate limiting.\n *\n * @param string $objectType The object type ('deals', 'companies', 'contacts', 'calls')\n * @param array<string, mixed> $payload The search payload with filters, sorts, properties, etc.\n * @return array The search response with 'results', 'total', 'paging' keys\n * @throws RateLimitException When rate limit is hit\n * @throws HubspotException On API errors\n */\n public function search(string $objectType, array $payload): array\n {\n $endpoint = self::BASE_URL . \"/crm/v3/objects/{$objectType}/search\";\n\n return $this->executeRequest(function () use ($endpoint, $payload) {\n $response = $this->getInstance()->getClient()->request('POST', $endpoint, ['json' => $payload]);\n\n return $response->toArray();\n });\n }\n\n /**\n * @throws DealApiException\n * @throws CrmException\n */\n public function getOpportunityById(string $crmId, array $fields): array\n {\n try {\n// $deal = $this->executeRequest(fn () => $this->getNewInstance()->crm()->deals()->basicApi()->getById(\n $deal = $this->getNewInstance()->crm()->deals()->basicApi()->getById(\n $crmId,\n implode(',', $fields),\n 'companies,contacts'\n );\n } catch (DealApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch opportunity', [\n 'crm_id' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n\n if (! $deal instanceof DealWithAssociations) {\n throw new CrmException('Deal not found');\n }\n\n return [\n 'id' => $deal->getId(),\n 'properties' => $deal->getProperties(),\n 'associations' => $deal->getAssociations(),\n ];\n }\n\n /**\n * Generic batch read method for HubSpot objects\n *\n * @param string $objectType The object type ('deals', 'companies', 'contacts')\n * @param array<string> $crmIds Array of HubSpot object IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with object data\n */\n private function batchReadObjects(string $objectType, array $crmIds, array $fields): array\n {\n if (empty($crmIds)) {\n return [];\n }\n\n $this->validateBatchSize($objectType, $crmIds);\n $this->ensureValidToken();\n\n try {\n $batchConfig = $this->createBatchConfiguration($objectType);\n $batchReadRequest = $this->prepareBatchRequest($batchConfig, $crmIds, $fields);\n $response = $batchConfig['api']->read($batchReadRequest);\n\n $this->validateApiResponse($response, $objectType);\n\n $results = $this->processApiResults($response);\n $this->logBatchResults($objectType, $crmIds, $results);\n\n return $results;\n } catch (\\Throwable $e) {\n $this->handleBatchError($e, $objectType, $crmIds);\n }\n }\n\n private function validateBatchSize(string $objectType, array $crmIds): void\n {\n if (count($crmIds) > 100) {\n throw new \\InvalidArgumentException(\"Batch size cannot exceed 100 {$objectType}\");\n }\n }\n\n private function createBatchConfiguration(string $objectType): array\n {\n $configurations = [\n 'deals' => [\n 'batchReadRequest' => new \\HubSpot\\Client\\Crm\\Deals\\Model\\BatchReadInputSimplePublicObjectId(),\n 'inputClass' => \\HubSpot\\Client\\Crm\\Deals\\Model\\SimplePublicObjectId::class,\n 'api' => $this->getNewInstance()->crm()->deals()->batchApi(),\n ],\n 'companies' => [\n 'batchReadRequest' => new \\HubSpot\\Client\\Crm\\Companies\\Model\\BatchReadInputSimplePublicObjectId(),\n 'inputClass' => \\HubSpot\\Client\\Crm\\Companies\\Model\\SimplePublicObjectId::class,\n 'api' => $this->getNewInstance()->crm()->companies()->batchApi(),\n ],\n 'contacts' => [\n 'batchReadRequest' => new \\HubSpot\\Client\\Crm\\Contacts\\Model\\BatchReadInputSimplePublicObjectId(),\n 'inputClass' => \\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectId::class,\n 'api' => $this->getNewInstance()->crm()->contacts()->batchApi(),\n ],\n ];\n\n if (! isset($configurations[$objectType])) {\n throw new \\InvalidArgumentException(\"Unsupported object type: {$objectType}\");\n }\n\n return $configurations[$objectType];\n }\n\n private function prepareBatchRequest(array $batchConfig, array $crmIds, array $fields): object\n {\n $batchReadRequest = $batchConfig['batchReadRequest'];\n $inputClass = $batchConfig['inputClass'];\n\n $inputs = array_map(function ($crmId) use ($inputClass) {\n $input = new $inputClass();\n $input->setId($crmId);\n\n return $input;\n }, $crmIds);\n\n $batchReadRequest->setInputs($inputs);\n $batchReadRequest->setProperties($fields);\n\n return $batchReadRequest;\n }\n\n private function validateApiResponse($response, string $objectType): void\n {\n if (! $response) {\n throw new CrmException(\"HubSpot API returned null response for {$objectType} batch read\");\n }\n }\n\n private function processApiResults($response): array\n {\n $results = [];\n $responseResults = $response->getResults();\n\n if ($responseResults) {\n foreach ($responseResults as $object) {\n if ($object && $object->getId()) {\n $results[$object->getId()] = [\n 'id' => $object->getId(),\n 'properties' => $object->getProperties() ?: [],\n ];\n }\n }\n }\n\n return $results;\n }\n\n private function logBatchResults(string $objectType, array $crmIds, array $results): void\n {\n $this->log->info(\"[HubSpot] Batch fetched {$objectType}\", [\n 'requested_count' => count($crmIds),\n 'returned_count' => count($results),\n 'crm_ids' => $crmIds,\n ]);\n }\n\n private function handleBatchError(\\Throwable $e, string $objectType, array $crmIds): void\n {\n $errorMessage = $e->getMessage() ?: 'Unknown error';\n $errorTrace = $e->getTraceAsString() ?: 'No trace available';\n\n $this->log->error(\"[HubSpot] Failed to batch fetch {$objectType}\", [\n 'crm_ids' => $crmIds,\n 'error' => $errorMessage,\n 'trace' => $errorTrace,\n ]);\n\n throw new CrmException(\"Failed to batch fetch {$objectType}: \" . $errorMessage);\n }\n\n /**\n * Batch read multiple opportunities by their CRM IDs\n *\n * @param array<string> $crmIds Array of HubSpot deal IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with opportunity data\n */\n public function getOpportunitiesByIds(array $crmIds, array $fields): array\n {\n return $this->batchReadObjects('deals', $crmIds, $fields);\n }\n\n /**\n * Batch read multiple companies by their CRM IDs\n *\n * @param array<string> $crmIds Array of HubSpot company IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with company data\n */\n public function getCompaniesByIds(array $crmIds, array $fields): array\n {\n return $this->batchReadObjects('companies', $crmIds, $fields);\n }\n\n /**\n * Batch read multiple contacts by their CRM IDs\n *\n * @param array<string> $crmIds Array of HubSpot contact IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with contact data\n */\n public function getContactsByIds(array $crmIds, array $fields): array\n {\n return $this->batchReadObjects('contacts', $crmIds, $fields);\n }\n\n /**\n * @throws CompanyApiException\n * @throws CrmException\n */\n public function getAccountById(string $crmId, array $fields): array\n {\n try {\n $company = $this->getNewInstance()->crm()->companies()->basicApi()->getById(\n $crmId,\n implode(',', $fields),\n );\n } catch (CompanyApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch account', [\n 'crm_id' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n\n if (! $company instanceof CompaniesWithAssociations) {\n throw new CrmException('Account not found');\n }\n\n return [\n 'id' => $company->getId(),\n 'properties' => $company->getProperties(),\n ];\n }\n\n /**\n * @throws ContactApiException\n * @throws CrmException\n */\n public function getContactById(string $crmId, array $fields): array\n {\n try {\n $contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(\n $crmId,\n implode(',', $fields)\n );\n } catch (ContactApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch contact', [\n 'crm_id' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n\n if (! $contact instanceof ContactsWithAssociations) {\n throw new CrmException('Contact not found');\n }\n\n return [\n 'id' => $contact->getId(),\n 'properties' => $contact->getProperties(),\n ];\n }\n\n /**\n * This is email search request that Hubspot offers as GET (more generous quota)\n */\n public function getContactByEmail(string $email, array $fields = []): array\n {\n try {\n $contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(\n $email,\n implode(',', $fields),\n null,\n false,\n 'email'\n );\n\n return [\n 'id' => $contact->getId(),\n 'properties' => $contact->getProperties(),\n ];\n } catch (ContactApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch contact', [\n 'email' => $email,\n 'reason' => $e->getMessage(),\n ]);\n\n return [];\n }\n }\n\n /**\n * @throws CrmException\n */\n public function fetchProperty(string $objectType, string $propertyId): Property\n {\n $result = $this->getNewInstance()->crm()->properties()->coreApi()->getByName($objectType, $propertyId);\n\n if (! $result instanceof Property) {\n $this->log->error('[Hubspot] Failed to fetch property', [\n 'object_type' => $objectType,\n 'property_id' => $propertyId,\n 'reason' => $result->getMessage(),\n ]);\n\n throw new CrmException('Failed to fetch property');\n }\n\n return $result;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchPropertyOptions(string $objectType, string $propertyId): array\n {\n /** @var array<CrmFieldOption> */\n return $this->fetchProperty($objectType, $propertyId)->getOptions();\n }\n\n /**\n * @return array<array{id:string, label:string, deleted:bool}>\n */\n public function fetchCallDispositions(): array\n {\n /** @var Response $response */\n $response = $this->getInstance()->engagements()->getCallDispositions();\n\n /**\n * @var array<array{\n * id:string,\n * label:string,\n * deleted: bool\n * }>\n */\n return $response->toArray();\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchOpportunityPipelineStages(): array\n {\n $stages = [];\n $apiResponse = $this->getNewInstance()->crm()->pipelines()->pipelinesApi()->getAll('deals');\n\n if ($apiResponse instanceof Error) {\n $this->log->error('[Hubspot] Failed to fetch opportunity pipelines', [\n 'reason' => $apiResponse->getMessage(),\n ]);\n\n return [];\n }\n\n foreach ($apiResponse->getResults() as $pipeline) {\n $pipelineStages = array_map(\n static function (PipelineStage $stage) {\n return [\n 'id' => $stage->getId(),\n 'label' => $stage->getLabel(),\n ];\n },\n $pipeline->getStages()\n );\n\n $stages = array_merge($stages, $pipelineStages);\n }\n\n return $stages;\n }\n\n public function fetchOpportunityPipelines(): array\n {\n $pipelines = [];\n\n try {\n $apiResponse = $this->makeRequest('/crm/v3/pipelines/deals');\n } catch (\\Exception $e) {\n $this->log->info('[Hubspot] Failed to fetch opportunity pipelines', [\n 'reason' => $e->getMessage(),\n ]);\n\n return [];\n }\n\n $response = $apiResponse->toArray();\n\n foreach ($response['results'] as $pipeline) {\n $pipelines[] = [\n 'id' => $pipeline['id'],\n 'label' => $pipeline['label'],\n ];\n }\n\n return $pipelines;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchMeetingOutcomeFieldOptions(Field $field): array\n {\n return $field->getCrmProviderId() === 'meetingOutcome'\n ? $this->fetchMeetingOutcomeTypes()\n : $this->fetchCallActivityTypes();\n }\n\n public function fetchMeetingOutcomeTypes(): array\n {\n return $this->extractMeetingTypeOptions(\n 'https://api.hubapi.com/crm/v3/properties/meeting/hs_meeting_outcome'\n );\n }\n\n public function fetchCallActivityTypes(): array\n {\n return $this->extractMeetingTypeOptions(\n 'https://api.hubapi.com/crm/v3/properties/call/hs_activity_type'\n );\n }\n\n private function extractMeetingTypeOptions(string $endpoint): array\n {\n /** @var Response $response */\n $response = $this->getInstance()\n ->getClient()\n ->request('GET', $endpoint);\n\n /**\n * @var array<array{\n * value: string,\n * label: string,\n * displayOrder: int\n * }> $optionData\n */\n $optionData = $response->toArray()['options'] ?? [];\n\n $options = [];\n foreach ($optionData as $item) {\n $options[] = [\n 'id' => $item['value'],\n 'value' => $item['value'],\n 'label' => $item['label'],\n 'display_order' => $item['displayOrder'],\n ];\n }\n\n return $options;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchDispositionFieldOptions(): array\n {\n $options = [];\n\n $dispositions = $this->fetchCallDispositions();\n\n foreach ($dispositions as $disposition) {\n if ($disposition['deleted'] !== false) {\n continue;\n }\n\n $option['value'] = $disposition['id'];\n $option['id'] = $disposition['id'];\n $option['label'] = $disposition['label'];\n\n $options[] = $option;\n }\n\n return $options;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchOpportunityFieldOptions(Field $field): array\n {\n if ($field->isStageField()) {\n return $this->fetchOpportunityPipelineStages();\n }\n\n if ($field->isPipelineField()) {\n return $this->fetchOpportunityPipelines();\n }\n\n return $this->fetchPropertyOptions('deals', $field->getCrmProviderId());\n }\n\n /**\n * @throws BadRequest\n * @throws HubspotException\n */\n public function makeRequest(string $endpoint, $method = 'GET', $payload = [], ?string $queryString = null)\n {\n $endpoint = self::BASE_URL . $endpoint;\n\n if ($method === 'GET') {\n $response = $this->getInstance()->getClient()?->request(\n method: $method,\n endpoint: $endpoint,\n query_string: $queryString\n );\n } else {\n $response = $this->getInstance()->getClient()->request($method, $endpoint, [\n 'json' => ($payload),\n ]);\n }\n//\n// $max = $response->getHeaderLine('X-HubSpot-RateLimit-Max'); // \"110\"\n// $remaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'); // \"109\"\n// $interval = $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // \"10000\"\n// $body = json_decode((string) $response->getBody(), true);\n//\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$max ' . PHP_EOL . print_r($max, true));\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$remaining ' . PHP_EOL . print_r($remaining, true));\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$interval ' . PHP_EOL . print_r($interval, true));\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$body ' . PHP_EOL . print_r($body, true));\n\n return $response;\n }\n\n /**\n * @throws BadRequest\n * @throws HubspotException\n */\n public function createMeeting(array $payload): Response\n {\n $endpoint = '/crm/v3/objects/meetings';\n\n return $this->makeRequest($endpoint, 'POST', $payload);\n }\n\n /**\n * @throws BadRequest\n * @throws HubspotException\n */\n public function updateMeeting(string $meetingId, array $payload): Response\n {\n $endpoint = '/crm/v3/objects/meetings/' . $meetingId;\n\n return $this->makeRequest($endpoint, 'PATCH', $payload);\n }\n\n /**\n * @throws \\Exception\n */\n public function createNote(\n string $body,\n string $ownerId,\n int $timestamp,\n string $objectId,\n NoteObject $noteObject\n ): ?string {\n try {\n $noteInput = new SimplePublicObjectInput([\n 'properties' => [\n 'hs_note_body' => $body,\n 'hubspot_owner_id' => $ownerId,\n 'hs_timestamp' => $timestamp,\n ],\n ]);\n\n // Create note\n $note = $this->getNewInstance()->crm()->objects()->basicApi()->create('note', $noteInput);\n\n $this->getNewInstance()->crm()->objects()->associationsApi()->create(\n 'note',\n $note->getId(),\n $this->getNoteObject($noteObject),\n $objectId,\n $this->getNoteAssociationType($noteObject),\n );\n\n return $note->getId();\n } catch (\\Exception $e) {\n $this->log->error('[Hubspot] Failed to create note', [\n 'objectId' => $objectId,\n 'noteObject' => $noteObject->getObjectType(),\n 'reason' => $e->getMessage(),\n ]);\n\n \\Sentry::captureException($e);\n }\n\n return null;\n }\n\n public function updateEngagement(string $objectId, array $engagement, array $metadata): void\n {\n $this->getInstance()->engagements()->update($objectId, $engagement, $metadata);\n }\n\n public function getEngagementData(string $engagementId): array\n {\n $engagement = $this->getInstance()->engagements()->get($engagementId);\n\n return $engagement->toArray();\n }\n\n public function createEngagement(array $engagement, array $associations, array $metadata): Response\n {\n return $this->getInstance()\n ->engagements()\n ->create($engagement, $associations, $metadata);\n }\n\n public function isUnauthorizedException(\\Exception $e): bool\n {\n if ($e instanceof BadRequest\n || $e instanceof DealApiException\n || $e instanceof ContactApiException\n || $e instanceof CompanyApiException\n ) {\n return (int) $e->getCode() === 401;\n }\n\n if ($e instanceof \\GuzzleHttp\\Exception\\RequestException && $e->hasResponse()) {\n return $e->getResponse()?->getStatusCode() === 401;\n }\n\n $message = strtolower($e->getMessage());\n\n return str_contains($message, '401 unauthorized') ||\n str_contains($message, 'http 401') ||\n str_contains($message, 'status code 401') ||\n (preg_match('/\\b401\\b/', $message) === 1 && str_contains($message, 'unauthorized'));\n }\n\n /**\n * Validates and refreshes the access token if needed before API requests.\n * This ensures long-running processes don't fail due to token expiration.\n *\n * @throws SocialAccountTokenInvalidException\n */\n public function ensureValidToken(): void\n {\n if ($this->oauthAccount === null) {\n return;\n }\n\n $newToken = $this->tokenManager->ensureValidToken($this->oauthAccount);\n if ($newToken !== null) {\n $this->accessToken = $newToken;\n }\n }\n\n public function getConfig()\n {\n return $this->config;\n }\n\n // returns only active (archived=false)\n public function getOwners(): array\n {\n return $this->getNewInstance()->crm()->owners()->getAll();\n }\n\n /**\n * @param bool $archived\n *\n * @return array<Owner>|[]\n */\n public function getOwnersArchived(bool $archived = true): array\n {\n $endpoint = '/crm/v3/owners';\n $queryParams = [\n 'archived' => $archived ? 'true' : 'false',\n ];\n $queryString = http_build_query($queryParams);\n\n $owners = [];\n\n try {\n $response = $this->makeRequest(endpoint: $endpoint, queryString: $queryString);\n $responseData = $response?->toArray();\n\n foreach ($responseData['results'] as $result) {\n try {\n $owners[] = Owner::create($result);\n } catch (Throwable $e) {\n $this->log->error('[HubSpot] Failed to process owner data', [\n 'result' => $result,\n 'error' => $e->getMessage(),\n ]);\n\n continue;\n }\n }\n } catch (Throwable $e) {\n $this->log->error('HubSpot] Failed to fetch owners', [\n 'archived' => $archived,\n 'error' => $e->getMessage(),\n ]);\n\n return [];\n }\n\n return $owners;\n }\n\n public function getMeeting(string $engagementId): ObjectWithAssociations\n {\n return $this->getNewInstance()->crm()->objects()->basicApi()\n ->getById('meeting', $engagementId, null, 'contact,company,deal');\n }\n\n public function deleteEngagement(string $engagementId): void\n {\n $this->getInstance()->engagements()->delete((int) $engagementId);\n }\n\n public function getAssociationsData(array $ids, string $fromObject, string $toObject): array\n {\n $associationData = [];\n $idChunks = array_chunk($ids, self::ASSOCIATIONS_BATCH_SIZE_LIMIT);\n\n foreach ($idChunks as $idChunk) {\n try {\n $batchInput = new \\HubSpot\\Client\\Crm\\Associations\\Model\\BatchInputPublicObjectId();\n $batchInput->setInputs(array_map(function ($id) {\n $publicObjectId = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicObjectId();\n $publicObjectId->setId($id);\n\n return $publicObjectId;\n }, $idChunk));\n\n $associatedObjectsData = $this\n ->getNewInstance()\n ->crm()\n ->associations()\n ->batchApi()\n ->read($fromObject, $toObject, $batchInput);\n\n if ($associatedObjectsData instanceof \\HubSpot\\Client\\Crm\\Associations\\Model\\BatchResponsePublicAssociationMulti) {\n foreach ($associatedObjectsData->getResults() as $association) {\n $from = $association->getFrom()->getId();\n $toAssociations = $association->getTo();\n\n if (! empty($toAssociations)) {\n $associationData[$from] = array_map(function ($item) {\n return $item->getId();\n }, $toAssociations);\n }\n }\n }\n } catch (RateLimitException $e) {\n throw $e;\n } catch (\\Exception $e) {\n $this->log->error('[Hubspot] Failed to fetch associations', [\n 'from_object' => $fromObject,\n 'to_object' => $toObject,\n 'reason' => $e->getMessage(),\n ]);\n }\n }\n\n return $associationData;\n }\n\n /**\n * @throws \\Exception\n */\n private function getNoteAssociationType(NoteObject $noteObject): string\n {\n return match($noteObject) {\n NoteObject::Opportunity => 'note_to_deal',\n NoteObject::Lead, NoteObject::Contact => 'note_to_contact', // or 'note_to_lead' if your portal supports it\n NoteObject::Account => 'note_to_company',\n NoteObject::Call, NoteObject::Event => throw new \\Exception('Not supported'),\n };\n }\n\n /**\n * @throws \\Exception\n */\n private function getNoteObject(NoteObject $noteObject): string\n {\n return match($noteObject) {\n NoteObject::Opportunity => 'deal',\n NoteObject::Lead, NoteObject::Contact => 'contact',\n NoteObject::Account => 'company',\n NoteObject::Call, NoteObject::Event => throw new \\Exception('Not supported'),\n };\n }\n\n public function addAssociations(string $objectType, string $associationType, array $payload): Response\n {\n $endpoint = \"/crm/v4/associations/$objectType/$associationType/batch/create\";\n\n return $this->makeRequest($endpoint, 'POST', $payload);\n }\n\n public function removeAssociations(string $objectType, string $associationType, array $payload): Response\n {\n $endpoint = \"/crm/v4/associations/$objectType/$associationType/batch/archive\";\n\n return $this->makeRequest($endpoint, 'POST', $payload);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Hubspot;\n\nuse HubSpot\\Client\\Crm\\Deals\\ApiException as DealApiException;\nuse HubSpot\\Client\\Crm\\Contacts\\ApiException as ContactApiException;\nuse HubSpot\\Client\\Crm\\Companies\\ApiException as CompanyApiException;\nuse HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations as ContactsWithAssociations;\nuse HubSpot\\Client\\Crm\\Companies\\Model\\SimplePublicObjectWithAssociations as CompaniesWithAssociations;\nuse HubSpot\\Client\\Crm\\Deals\\Model\\SimplePublicObjectWithAssociations as DealWithAssociations;\nuse HubSpot\\Client\\Crm\\Objects\\Model\\SimplePublicObjectInput;\nuse HubSpot\\Client\\Crm\\Objects\\Model\\SimplePublicObjectWithAssociations as ObjectWithAssociations;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\Error;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\PipelineStage;\nuse HubSpot\\Client\\Crm\\Properties\\Model\\Property;\nuse HubSpot\\Discovery\\Discovery;\nuse Jiminny\\Exceptions\\CrmException;\nuse Jiminny\\Exceptions\\RateLimitException;\nuse Jiminny\\Exceptions\\SocialAccountTokenInvalidException;\nuse Jiminny\\Jobs\\Crm\\NoteObject;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Services\\Crm\\BaseClient;\nuse Jiminny\\Services\\Crm\\Hubspot\\DTO\\Response\\Owner;\nuse Jiminny\\Services\\SocialAccountService;\nuse SevenShores\\Hubspot\\Exceptions\\BadRequest;\nuse SevenShores\\Hubspot\\Exceptions\\HubspotException;\nuse SevenShores\\Hubspot\\Factory;\nuse SevenShores\\Hubspot\\Http\\Response;\nuse Jiminny\\Services\\Crm\\Hubspot\\Pagination\\HubspotPaginationService;\nuse Throwable;\n\n/**\n * @phpstan-type CrmFieldOption array{id:string, label:string, value?:string}\n */\nclass Client extends BaseClient implements HubspotClientInterface\n{\n public const string MIN_API_VERSION = '2';\n\n public const string BASE_URL = 'https://api.hubapi.com';\n\n public const int ASSOCIATIONS_BATCH_SIZE_LIMIT = 1000;\n\n private HubspotPaginationService $paginationService;\n private HubspotTokenManager $tokenManager;\n\n public function __construct(\n SocialAccountService $socialAccountService,\n HubspotPaginationService $paginationService,\n HubspotTokenManager $tokenManager,\n ) {\n parent::__construct($socialAccountService);\n $this->paginationService = $paginationService;\n $this->tokenManager = $tokenManager;\n\n $this->setBaseUrl(self::BASE_URL);\n $this->setVersion(self::MIN_API_VERSION);\n }\n\n /**\n * Reacts to a rate limits (429) from HubSpot by translating it\n * into a RateLimitException carrying retry_after.\n *\n * Wrap any outbound HubSpot call (SDK or raw HTTP) like:\n *\n * $this->executeRequest(fn () => $this->getNewInstance()->crm()->...);\n *\n * @template T\n * @param callable(): T $apiCall\n * @return T\n *\n * @throws RateLimitException\n */\n private function executeRequest(callable $apiCall)\n {\n try {\n return $apiCall();\n } catch (Throwable $e) {\n if ($this->isHubspotRateLimit($e)) {\n $retryAfter = $this->parseRetryAfter($e);\n\n $this->log->warning('[Hubspot] Received 429 from API', [\n 'team_id' => $this->config->team_id,\n 'config_id' => $this->config->getId(),\n 'retry_after' => $retryAfter,\n 'reason' => $e->getMessage(),\n ]);\n\n throw new RateLimitException('Hubspot returned 429', $retryAfter, $e);\n }\n\n throw $e;\n }\n }\n\n public function isHubspotRateLimit(Throwable $e): bool\n {\n if ($e instanceof BadRequest\n || $e instanceof DealApiException\n || $e instanceof ContactApiException\n || $e instanceof CompanyApiException\n || $e instanceof \\GuzzleHttp\\Exception\\RequestException\n ) {\n return (int) $e->getCode() === 429;\n }\n\n return false;\n }\n\n public function parseRetryAfter(Throwable $e): int\n {\n // First try to get Retry-After from response headers\n if (method_exists($e, 'getResponseHeaders')) {\n $headers = $e->getResponseHeaders() ?: [];\n $value = $headers['Retry-After'] ?? $headers['retry-after'] ?? null;\n if (is_array($value)) {\n $value = $value[0] ?? null;\n }\n if (is_numeric($value)) {\n return (int) $value;\n }\n }\n\n if (method_exists($e, 'getResponseBody')) {\n $body = $e->getResponseBody();\n if (is_string($body)) {\n $body = json_decode($body, true) ?? [];\n }\n\n $policyName = $body['policyName'] ?? $body['policy'] ?? $body['context']['policyName'] ?? null;\n\n if ($policyName === 'TEN_SECONDLY_ROLLING' || $policyName === 'ten_secondly_rolling') {\n return 10;\n }\n if ($policyName === 'SECONDLY' || $policyName === 'secondly') {\n return 1;\n }\n }\n\n $this->log->warning('[Hubspot] No retry-after header or policy name found, using default', [\n 'exception_class' => get_class($e),\n ]);\n\n return 10;\n }\n\n public function getMinimumApiVersion(): string\n {\n return self::MIN_API_VERSION;\n }\n\n public function getInstance(): Factory\n {\n return new Factory([\n 'key' => $this->accessToken,\n 'oauth2' => true,\n 'base_url' => $this->baseUrl,\n ]);\n }\n\n public function getNewInstance(): Discovery\n {\n return \\HubSpot\\Factory::createWithAccessToken($this->accessToken);\n }\n\n /**\n * Secondly and daily limits for Hubspot API\n *\n * Product Tier: Free & Starter | Professional & Enterprise | API add-on (any tier)\n * Burst: 100/10 seconds | 150/10 seconds | 200/10 seconds\n * Daily: 250,000 | 500,000 | 1,000,000\n *\n * Official documentation states: The search endpoints are rate limited to five requests per second.\n * Since with 5 RPS were still hitting secondly rate limits we lowered it to 4\n */\n public function getPaginatedData(array $payload, string $type, int $offset = 0): array\n {\n $total = 0;\n $lastId = null;\n $rows = [];\n foreach ($this->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastId) as $row) {\n $rows[] = $row;\n }\n\n return ['results' => $rows, 'total' => $total, 'last_record' => $lastId];\n }\n\n /**\n * @throws HubspotException\n * @throws SocialAccountTokenInvalidException\n * @throws BadRequest\n */\n public function getPaginatedDataGenerator(\n array $payload,\n string $type,\n int $offset = 0,\n int &$total = 0,\n ?string &$lastRecordId = null\n ): \\Generator {\n return $this->paginationService->getPaginatedDataGenerator(\n $this,\n $payload,\n $type,\n $offset,\n $total,\n $lastRecordId\n );\n }\n\n /**\n * Execute a search request against HubSpot CRM objects with rate limiting.\n *\n * @param string $objectType The object type ('deals', 'companies', 'contacts', 'calls')\n * @param array<string, mixed> $payload The search payload with filters, sorts, properties, etc.\n * @return array The search response with 'results', 'total', 'paging' keys\n * @throws RateLimitException When rate limit is hit\n * @throws HubspotException On API errors\n */\n public function search(string $objectType, array $payload): array\n {\n $endpoint = self::BASE_URL . \"/crm/v3/objects/{$objectType}/search\";\n\n return $this->executeRequest(function () use ($endpoint, $payload) {\n $response = $this->getInstance()->getClient()->request('POST', $endpoint, ['json' => $payload]);\n\n return $response->toArray();\n });\n }\n\n /**\n * @throws DealApiException\n * @throws CrmException\n */\n public function getOpportunityById(string $crmId, array $fields): array\n {\n try {\n// $deal = $this->executeRequest(fn () => $this->getNewInstance()->crm()->deals()->basicApi()->getById(\n $deal = $this->getNewInstance()->crm()->deals()->basicApi()->getById(\n $crmId,\n implode(',', $fields),\n 'companies,contacts'\n );\n } catch (DealApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch opportunity', [\n 'crm_id' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n\n if (! $deal instanceof DealWithAssociations) {\n throw new CrmException('Deal not found');\n }\n\n return [\n 'id' => $deal->getId(),\n 'properties' => $deal->getProperties(),\n 'associations' => $deal->getAssociations(),\n ];\n }\n\n /**\n * Generic batch read method for HubSpot objects\n *\n * @param string $objectType The object type ('deals', 'companies', 'contacts')\n * @param array<string> $crmIds Array of HubSpot object IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with object data\n */\n private function batchReadObjects(string $objectType, array $crmIds, array $fields): array\n {\n if (empty($crmIds)) {\n return [];\n }\n\n $this->validateBatchSize($objectType, $crmIds);\n $this->ensureValidToken();\n\n try {\n $batchConfig = $this->createBatchConfiguration($objectType);\n $batchReadRequest = $this->prepareBatchRequest($batchConfig, $crmIds, $fields);\n $response = $batchConfig['api']->read($batchReadRequest);\n\n $this->validateApiResponse($response, $objectType);\n\n $results = $this->processApiResults($response);\n $this->logBatchResults($objectType, $crmIds, $results);\n\n return $results;\n } catch (\\Throwable $e) {\n $this->handleBatchError($e, $objectType, $crmIds);\n }\n }\n\n private function validateBatchSize(string $objectType, array $crmIds): void\n {\n if (count($crmIds) > 100) {\n throw new \\InvalidArgumentException(\"Batch size cannot exceed 100 {$objectType}\");\n }\n }\n\n private function createBatchConfiguration(string $objectType): array\n {\n $configurations = [\n 'deals' => [\n 'batchReadRequest' => new \\HubSpot\\Client\\Crm\\Deals\\Model\\BatchReadInputSimplePublicObjectId(),\n 'inputClass' => \\HubSpot\\Client\\Crm\\Deals\\Model\\SimplePublicObjectId::class,\n 'api' => $this->getNewInstance()->crm()->deals()->batchApi(),\n ],\n 'companies' => [\n 'batchReadRequest' => new \\HubSpot\\Client\\Crm\\Companies\\Model\\BatchReadInputSimplePublicObjectId(),\n 'inputClass' => \\HubSpot\\Client\\Crm\\Companies\\Model\\SimplePublicObjectId::class,\n 'api' => $this->getNewInstance()->crm()->companies()->batchApi(),\n ],\n 'contacts' => [\n 'batchReadRequest' => new \\HubSpot\\Client\\Crm\\Contacts\\Model\\BatchReadInputSimplePublicObjectId(),\n 'inputClass' => \\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectId::class,\n 'api' => $this->getNewInstance()->crm()->contacts()->batchApi(),\n ],\n ];\n\n if (! isset($configurations[$objectType])) {\n throw new \\InvalidArgumentException(\"Unsupported object type: {$objectType}\");\n }\n\n return $configurations[$objectType];\n }\n\n private function prepareBatchRequest(array $batchConfig, array $crmIds, array $fields): object\n {\n $batchReadRequest = $batchConfig['batchReadRequest'];\n $inputClass = $batchConfig['inputClass'];\n\n $inputs = array_map(function ($crmId) use ($inputClass) {\n $input = new $inputClass();\n $input->setId($crmId);\n\n return $input;\n }, $crmIds);\n\n $batchReadRequest->setInputs($inputs);\n $batchReadRequest->setProperties($fields);\n\n return $batchReadRequest;\n }\n\n private function validateApiResponse($response, string $objectType): void\n {\n if (! $response) {\n throw new CrmException(\"HubSpot API returned null response for {$objectType} batch read\");\n }\n }\n\n private function processApiResults($response): array\n {\n $results = [];\n $responseResults = $response->getResults();\n\n if ($responseResults) {\n foreach ($responseResults as $object) {\n if ($object && $object->getId()) {\n $results[$object->getId()] = [\n 'id' => $object->getId(),\n 'properties' => $object->getProperties() ?: [],\n ];\n }\n }\n }\n\n return $results;\n }\n\n private function logBatchResults(string $objectType, array $crmIds, array $results): void\n {\n $this->log->info(\"[HubSpot] Batch fetched {$objectType}\", [\n 'requested_count' => count($crmIds),\n 'returned_count' => count($results),\n 'crm_ids' => $crmIds,\n ]);\n }\n\n private function handleBatchError(\\Throwable $e, string $objectType, array $crmIds): void\n {\n $errorMessage = $e->getMessage() ?: 'Unknown error';\n $errorTrace = $e->getTraceAsString() ?: 'No trace available';\n\n $this->log->error(\"[HubSpot] Failed to batch fetch {$objectType}\", [\n 'crm_ids' => $crmIds,\n 'error' => $errorMessage,\n 'trace' => $errorTrace,\n ]);\n\n throw new CrmException(\"Failed to batch fetch {$objectType}: \" . $errorMessage);\n }\n\n /**\n * Batch read multiple opportunities by their CRM IDs\n *\n * @param array<string> $crmIds Array of HubSpot deal IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with opportunity data\n */\n public function getOpportunitiesByIds(array $crmIds, array $fields): array\n {\n return $this->batchReadObjects('deals', $crmIds, $fields);\n }\n\n /**\n * Batch read multiple companies by their CRM IDs\n *\n * @param array<string> $crmIds Array of HubSpot company IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with company data\n */\n public function getCompaniesByIds(array $crmIds, array $fields): array\n {\n return $this->batchReadObjects('companies', $crmIds, $fields);\n }\n\n /**\n * Batch read multiple contacts by their CRM IDs\n *\n * @param array<string> $crmIds Array of HubSpot contact IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with contact data\n */\n public function getContactsByIds(array $crmIds, array $fields): array\n {\n return $this->batchReadObjects('contacts', $crmIds, $fields);\n }\n\n /**\n * @throws CompanyApiException\n * @throws CrmException\n */\n public function getAccountById(string $crmId, array $fields): array\n {\n try {\n $company = $this->getNewInstance()->crm()->companies()->basicApi()->getById(\n $crmId,\n implode(',', $fields),\n );\n } catch (CompanyApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch account', [\n 'crm_id' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n\n if (! $company instanceof CompaniesWithAssociations) {\n throw new CrmException('Account not found');\n }\n\n return [\n 'id' => $company->getId(),\n 'properties' => $company->getProperties(),\n ];\n }\n\n /**\n * @throws ContactApiException\n * @throws CrmException\n */\n public function getContactById(string $crmId, array $fields): array\n {\n try {\n $contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(\n $crmId,\n implode(',', $fields)\n );\n } catch (ContactApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch contact', [\n 'crm_id' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n\n if (! $contact instanceof ContactsWithAssociations) {\n throw new CrmException('Contact not found');\n }\n\n return [\n 'id' => $contact->getId(),\n 'properties' => $contact->getProperties(),\n ];\n }\n\n /**\n * This is email search request that Hubspot offers as GET (more generous quota)\n */\n public function getContactByEmail(string $email, array $fields = []): array\n {\n try {\n $contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(\n $email,\n implode(',', $fields),\n null,\n false,\n 'email'\n );\n\n return [\n 'id' => $contact->getId(),\n 'properties' => $contact->getProperties(),\n ];\n } catch (ContactApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch contact', [\n 'email' => $email,\n 'reason' => $e->getMessage(),\n ]);\n\n return [];\n }\n }\n\n /**\n * @throws CrmException\n */\n public function fetchProperty(string $objectType, string $propertyId): Property\n {\n $result = $this->getNewInstance()->crm()->properties()->coreApi()->getByName($objectType, $propertyId);\n\n if (! $result instanceof Property) {\n $this->log->error('[Hubspot] Failed to fetch property', [\n 'object_type' => $objectType,\n 'property_id' => $propertyId,\n 'reason' => $result->getMessage(),\n ]);\n\n throw new CrmException('Failed to fetch property');\n }\n\n return $result;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchPropertyOptions(string $objectType, string $propertyId): array\n {\n /** @var array<CrmFieldOption> */\n return $this->fetchProperty($objectType, $propertyId)->getOptions();\n }\n\n /**\n * @return array<array{id:string, label:string, deleted:bool}>\n */\n public function fetchCallDispositions(): array\n {\n /** @var Response $response */\n $response = $this->getInstance()->engagements()->getCallDispositions();\n\n /**\n * @var array<array{\n * id:string,\n * label:string,\n * deleted: bool\n * }>\n */\n return $response->toArray();\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchOpportunityPipelineStages(): array\n {\n $stages = [];\n $apiResponse = $this->getNewInstance()->crm()->pipelines()->pipelinesApi()->getAll('deals');\n\n if ($apiResponse instanceof Error) {\n $this->log->error('[Hubspot] Failed to fetch opportunity pipelines', [\n 'reason' => $apiResponse->getMessage(),\n ]);\n\n return [];\n }\n\n foreach ($apiResponse->getResults() as $pipeline) {\n $pipelineStages = array_map(\n static function (PipelineStage $stage) {\n return [\n 'id' => $stage->getId(),\n 'label' => $stage->getLabel(),\n ];\n },\n $pipeline->getStages()\n );\n\n $stages = array_merge($stages, $pipelineStages);\n }\n\n return $stages;\n }\n\n public function fetchOpportunityPipelines(): array\n {\n $pipelines = [];\n\n try {\n $apiResponse = $this->makeRequest('/crm/v3/pipelines/deals');\n } catch (\\Exception $e) {\n $this->log->info('[Hubspot] Failed to fetch opportunity pipelines', [\n 'reason' => $e->getMessage(),\n ]);\n\n return [];\n }\n\n $response = $apiResponse->toArray();\n\n foreach ($response['results'] as $pipeline) {\n $pipelines[] = [\n 'id' => $pipeline['id'],\n 'label' => $pipeline['label'],\n ];\n }\n\n return $pipelines;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchMeetingOutcomeFieldOptions(Field $field): array\n {\n return $field->getCrmProviderId() === 'meetingOutcome'\n ? $this->fetchMeetingOutcomeTypes()\n : $this->fetchCallActivityTypes();\n }\n\n public function fetchMeetingOutcomeTypes(): array\n {\n return $this->extractMeetingTypeOptions(\n 'https://api.hubapi.com/crm/v3/properties/meeting/hs_meeting_outcome'\n );\n }\n\n public function fetchCallActivityTypes(): array\n {\n return $this->extractMeetingTypeOptions(\n 'https://api.hubapi.com/crm/v3/properties/call/hs_activity_type'\n );\n }\n\n private function extractMeetingTypeOptions(string $endpoint): array\n {\n /** @var Response $response */\n $response = $this->getInstance()\n ->getClient()\n ->request('GET', $endpoint);\n\n /**\n * @var array<array{\n * value: string,\n * label: string,\n * displayOrder: int\n * }> $optionData\n */\n $optionData = $response->toArray()['options'] ?? [];\n\n $options = [];\n foreach ($optionData as $item) {\n $options[] = [\n 'id' => $item['value'],\n 'value' => $item['value'],\n 'label' => $item['label'],\n 'display_order' => $item['displayOrder'],\n ];\n }\n\n return $options;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchDispositionFieldOptions(): array\n {\n $options = [];\n\n $dispositions = $this->fetchCallDispositions();\n\n foreach ($dispositions as $disposition) {\n if ($disposition['deleted'] !== false) {\n continue;\n }\n\n $option['value'] = $disposition['id'];\n $option['id'] = $disposition['id'];\n $option['label'] = $disposition['label'];\n\n $options[] = $option;\n }\n\n return $options;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchOpportunityFieldOptions(Field $field): array\n {\n if ($field->isStageField()) {\n return $this->fetchOpportunityPipelineStages();\n }\n\n if ($field->isPipelineField()) {\n return $this->fetchOpportunityPipelines();\n }\n\n return $this->fetchPropertyOptions('deals', $field->getCrmProviderId());\n }\n\n /**\n * @throws BadRequest\n * @throws HubspotException\n */\n public function makeRequest(string $endpoint, $method = 'GET', $payload = [], ?string $queryString = null)\n {\n $endpoint = self::BASE_URL . $endpoint;\n\n if ($method === 'GET') {\n $response = $this->getInstance()->getClient()?->request(\n method: $method,\n endpoint: $endpoint,\n query_string: $queryString\n );\n } else {\n $response = $this->getInstance()->getClient()->request($method, $endpoint, [\n 'json' => ($payload),\n ]);\n }\n//\n// $max = $response->getHeaderLine('X-HubSpot-RateLimit-Max'); // \"110\"\n// $remaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'); // \"109\"\n// $interval = $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // \"10000\"\n// $body = json_decode((string) $response->getBody(), true);\n//\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$max ' . PHP_EOL . print_r($max, true));\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$remaining ' . PHP_EOL . print_r($remaining, true));\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$interval ' . PHP_EOL . print_r($interval, true));\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$body ' . PHP_EOL . print_r($body, true));\n\n return $response;\n }\n\n /**\n * @throws BadRequest\n * @throws HubspotException\n */\n public function createMeeting(array $payload): Response\n {\n $endpoint = '/crm/v3/objects/meetings';\n\n return $this->makeRequest($endpoint, 'POST', $payload);\n }\n\n /**\n * @throws BadRequest\n * @throws HubspotException\n */\n public function updateMeeting(string $meetingId, array $payload): Response\n {\n $endpoint = '/crm/v3/objects/meetings/' . $meetingId;\n\n return $this->makeRequest($endpoint, 'PATCH', $payload);\n }\n\n /**\n * @throws \\Exception\n */\n public function createNote(\n string $body,\n string $ownerId,\n int $timestamp,\n string $objectId,\n NoteObject $noteObject\n ): ?string {\n try {\n $noteInput = new SimplePublicObjectInput([\n 'properties' => [\n 'hs_note_body' => $body,\n 'hubspot_owner_id' => $ownerId,\n 'hs_timestamp' => $timestamp,\n ],\n ]);\n\n // Create note\n $note = $this->getNewInstance()->crm()->objects()->basicApi()->create('note', $noteInput);\n\n $this->getNewInstance()->crm()->objects()->associationsApi()->create(\n 'note',\n $note->getId(),\n $this->getNoteObject($noteObject),\n $objectId,\n $this->getNoteAssociationType($noteObject),\n );\n\n return $note->getId();\n } catch (\\Exception $e) {\n $this->log->error('[Hubspot] Failed to create note', [\n 'objectId' => $objectId,\n 'noteObject' => $noteObject->getObjectType(),\n 'reason' => $e->getMessage(),\n ]);\n\n \\Sentry::captureException($e);\n }\n\n return null;\n }\n\n public function updateEngagement(string $objectId, array $engagement, array $metadata): void\n {\n $this->getInstance()->engagements()->update($objectId, $engagement, $metadata);\n }\n\n public function getEngagementData(string $engagementId): array\n {\n $engagement = $this->getInstance()->engagements()->get($engagementId);\n\n return $engagement->toArray();\n }\n\n public function createEngagement(array $engagement, array $associations, array $metadata): Response\n {\n return $this->getInstance()\n ->engagements()\n ->create($engagement, $associations, $metadata);\n }\n\n public function isUnauthorizedException(\\Exception $e): bool\n {\n if ($e instanceof BadRequest\n || $e instanceof DealApiException\n || $e instanceof ContactApiException\n || $e instanceof CompanyApiException\n ) {\n return (int) $e->getCode() === 401;\n }\n\n if ($e instanceof \\GuzzleHttp\\Exception\\RequestException && $e->hasResponse()) {\n return $e->getResponse()?->getStatusCode() === 401;\n }\n\n $message = strtolower($e->getMessage());\n\n return str_contains($message, '401 unauthorized') ||\n str_contains($message, 'http 401') ||\n str_contains($message, 'status code 401') ||\n (preg_match('/\\b401\\b/', $message) === 1 && str_contains($message, 'unauthorized'));\n }\n\n /**\n * Validates and refreshes the access token if needed before API requests.\n * This ensures long-running processes don't fail due to token expiration.\n *\n * @throws SocialAccountTokenInvalidException\n */\n public function ensureValidToken(): void\n {\n if ($this->oauthAccount === null) {\n return;\n }\n\n $newToken = $this->tokenManager->ensureValidToken($this->oauthAccount);\n if ($newToken !== null) {\n $this->accessToken = $newToken;\n }\n }\n\n public function getConfig()\n {\n return $this->config;\n }\n\n // returns only active (archived=false)\n public function getOwners(): array\n {\n return $this->getNewInstance()->crm()->owners()->getAll();\n }\n\n /**\n * @param bool $archived\n *\n * @return array<Owner>|[]\n */\n public function getOwnersArchived(bool $archived = true): array\n {\n $endpoint = '/crm/v3/owners';\n $queryParams = [\n 'archived' => $archived ? 'true' : 'false',\n ];\n $queryString = http_build_query($queryParams);\n\n $owners = [];\n\n try {\n $response = $this->makeRequest(endpoint: $endpoint, queryString: $queryString);\n $responseData = $response?->toArray();\n\n foreach ($responseData['results'] as $result) {\n try {\n $owners[] = Owner::create($result);\n } catch (Throwable $e) {\n $this->log->error('[HubSpot] Failed to process owner data', [\n 'result' => $result,\n 'error' => $e->getMessage(),\n ]);\n\n continue;\n }\n }\n } catch (Throwable $e) {\n $this->log->error('HubSpot] Failed to fetch owners', [\n 'archived' => $archived,\n 'error' => $e->getMessage(),\n ]);\n\n return [];\n }\n\n return $owners;\n }\n\n public function getMeeting(string $engagementId): ObjectWithAssociations\n {\n return $this->getNewInstance()->crm()->objects()->basicApi()\n ->getById('meeting', $engagementId, null, 'contact,company,deal');\n }\n\n public function deleteEngagement(string $engagementId): void\n {\n $this->getInstance()->engagements()->delete((int) $engagementId);\n }\n\n public function getAssociationsData(array $ids, string $fromObject, string $toObject): array\n {\n $associationData = [];\n $idChunks = array_chunk($ids, self::ASSOCIATIONS_BATCH_SIZE_LIMIT);\n\n foreach ($idChunks as $idChunk) {\n try {\n $batchInput = new \\HubSpot\\Client\\Crm\\Associations\\Model\\BatchInputPublicObjectId();\n $batchInput->setInputs(array_map(function ($id) {\n $publicObjectId = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicObjectId();\n $publicObjectId->setId($id);\n\n return $publicObjectId;\n }, $idChunk));\n\n $associatedObjectsData = $this\n ->getNewInstance()\n ->crm()\n ->associations()\n ->batchApi()\n ->read($fromObject, $toObject, $batchInput);\n\n if ($associatedObjectsData instanceof \\HubSpot\\Client\\Crm\\Associations\\Model\\BatchResponsePublicAssociationMulti) {\n foreach ($associatedObjectsData->getResults() as $association) {\n $from = $association->getFrom()->getId();\n $toAssociations = $association->getTo();\n\n if (! empty($toAssociations)) {\n $associationData[$from] = array_map(function ($item) {\n return $item->getId();\n }, $toAssociations);\n }\n }\n }\n } catch (RateLimitException $e) {\n throw $e;\n } catch (\\Exception $e) {\n $this->log->error('[Hubspot] Failed to fetch associations', [\n 'from_object' => $fromObject,\n 'to_object' => $toObject,\n 'reason' => $e->getMessage(),\n ]);\n }\n }\n\n return $associationData;\n }\n\n /**\n * @throws \\Exception\n */\n private function getNoteAssociationType(NoteObject $noteObject): string\n {\n return match($noteObject) {\n NoteObject::Opportunity => 'note_to_deal',\n NoteObject::Lead, NoteObject::Contact => 'note_to_contact', // or 'note_to_lead' if your portal supports it\n NoteObject::Account => 'note_to_company',\n NoteObject::Call, NoteObject::Event => throw new \\Exception('Not supported'),\n };\n }\n\n /**\n * @throws \\Exception\n */\n private function getNoteObject(NoteObject $noteObject): string\n {\n return match($noteObject) {\n NoteObject::Opportunity => 'deal',\n NoteObject::Lead, NoteObject::Contact => 'contact',\n NoteObject::Account => 'company',\n NoteObject::Call, NoteObject::Event => throw new \\Exception('Not supported'),\n };\n }\n\n public function addAssociations(string $objectType, string $associationType, array $payload): Response\n {\n $endpoint = \"/crm/v4/associations/$objectType/$associationType/batch/create\";\n\n return $this->makeRequest($endpoint, 'POST', $payload);\n }\n\n public function removeAssociations(string $objectType, string $associationType, array $payload): Response\n {\n $endpoint = \"/crm/v4/associations/$objectType/$associationType/batch/archive\";\n\n return $this->makeRequest($endpoint, 'POST', $payload);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8042239561423386799
|
-2772555094162536346
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
19
Previous Highlighted Error
Next Highlighted Error
[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {
"headers":{
"Date":["Thu,07 May 2026 14:21:15 GMT"],
"Content-Type":["application/json;charset=utf-8"],
"Transfer-Encoding":["chunked"],
"Connection":["keep-alive"],
"CF-Ray":["9f80deb8db60dc3a-SOF"],
"CF-Cache-Status":["DYNAMIC"],
"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],
"Vary":["origin,
accept-encoding"],
"access-control-allow-credentials":["false"],
"server-timing":["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\",
cfr;desc=\"9f80deb8e7c6dc3a-IAD\""],
"x-content-type-options":["nosniff"],
"x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],
"Set-Cookie":["__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-[IP_ADDRESS]-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,
07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None"],
"Report-To":["{
\"endpoints\":[{
\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\"}],
\"group\":\"cf-nel\",
\"max_age\":604800}"],
"NEL":["{
\"success_fraction\":0.01,
\"report_to\":\"cf-nel\",
\"max_age\":604800}"],
"Server":["cloudflare"]}} {
"correlation_id":"95236535-ec98-4541-b92a-adfa73b69eab",
"trace_id":"c7ab8365-903f-46d4-9403-0e5b551e3545"}
Show Replace Field
Search History
doSer
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
0 results
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
2
64
1
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot;
use HubSpot\Client\Crm\Deals\ApiException as DealApiException;
use HubSpot\Client\Crm\Contacts\ApiException as ContactApiException;
use HubSpot\Client\Crm\Companies\ApiException as CompanyApiException;
use HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations as ContactsWithAssociations;
use HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations as CompaniesWithAssociations;
use HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations as DealWithAssociations;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations as ObjectWithAssociations;
use HubSpot\Client\Crm\Pipelines\Model\Error;
use HubSpot\Client\Crm\Pipelines\Model\PipelineStage;
use HubSpot\Client\Crm\Properties\Model\Property;
use HubSpot\Discovery\Discovery;
use Jiminny\Exceptions\CrmException;
use Jiminny\Exceptions\RateLimitException;
use Jiminny\Exceptions\SocialAccountTokenInvalidException;
use Jiminny\Jobs\Crm\NoteObject;
use Jiminny\Models\Crm\Field;
use Jiminny\Services\Crm\BaseClient;
use Jiminny\Services\Crm\Hubspot\DTO\Response\Owner;
use Jiminny\Services\SocialAccountService;
use SevenShores\Hubspot\Exceptions\BadRequest;
use SevenShores\Hubspot\Exceptions\HubspotException;
use SevenShores\Hubspot\Factory;
use SevenShores\Hubspot\Http\Response;
use Jiminny\Services\Crm\Hubspot\Pagination\HubspotPaginationService;
use Throwable;
/**
* @phpstan-type CrmFieldOption array{id:string, label:string, value?:string}
*/
class Client extends BaseClient implements HubspotClientInterface
{
public const string MIN_API_VERSION = '2';
public const string BASE_URL = '[URL_WITH_CREDENTIALS] T
* @param callable(): T $apiCall
* @return T
*
* @throws RateLimitException
*/
private function executeRequest(callable $apiCall)
{
try {
return $apiCall();
} catch (Throwable $e) {
if ($this->isHubspotRateLimit($e)) {
$retryAfter = $this->parseRetryAfter($e);
$this->log->warning('[Hubspot] Received 429 from API', [
'team_id' => $this->config->team_id,
'config_id' => $this->config->getId(),
'retry_after' => $retryAfter,
'reason' => $e->getMessage(),
]);
throw new RateLimitException('Hubspot returned 429', $retryAfter, $e);
}
throw $e;
}
}
public function isHubspotRateLimit(Throwable $e): bool
{
if ($e instanceof BadRequest
|| $e instanceof DealApiException
|| $e instanceof ContactApiException
|| $e instanceof CompanyApiException
|| $e instanceof \GuzzleHttp\Exception\RequestException
) {
return (int) $e->getCode() === 429;
}
return false;
}
public function parseRetryAfter(Throwable $e): int
{
// First try to get Retry-After from response headers
if (method_exists($e, 'getResponseHeaders')) {
$headers = $e->getResponseHeaders() ?: [];
$value = $headers['Retry-After'] ?? $headers['retry-after'] ?? null;
if (is_array($value)) {
$value = $value[0] ?? null;
}
if (is_numeric($value)) {
return (int) $value;
}
}
if (method_exists($e, 'getResponseBody')) {
$body = $e->getResponseBody();
if (is_string($body)) {
$body = json_decode($body, true) ?? [];
}
$policyName = $body['policyName'] ?? $body['policy'] ?? $body['context']['policyName'] ?? null;
if ($policyName === 'TEN_SECONDLY_ROLLING' || $policyName === 'ten_secondly_rolling') {
return 10;
}
if ($policyName === 'SECONDLY' || $policyName === 'secondly') {
return 1;
}
}
$this->log->warning('[Hubspot] No retry-after header or policy name found, using default', [
'exception_class' => get_class($e),
]);
return 10;
}
public function getMinimumApiVersion(): string
{
return self::MIN_API_VERSION;
}
public function getInstance(): Factory
{
return new Factory([
'key' => $this->accessToken,
'oauth2' => true,
'base_url' => $this->baseUrl,
]);
}
public function getNewInstance(): Discovery
{
return \HubSpot\Factory::createWithAccessToken($this->accessToken);
}
/**
* Secondly and daily limits for Hubspot API
*
* Product Tier: Free & Starter | Professional & Enterprise | API add-on (any tier)
* Burst: 100/10 seconds | 150/10 seconds | 200/10 seconds
* Daily: 250,000 | 500,000 | 1,000,000
*
* Official documentation states: The search endpoints are rate limited to five requests per second.
* Since with 5 RPS were still hitting secondly rate limits we lowered it to 4
*/
public function getPaginatedData(array $payload, string $type, int $offset = 0): array
{
$total = 0;
$lastId = null;
$rows = [];
foreach ($this->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastId) as $row) {
$rows[] = $row;
}
return ['results' => $rows, 'total' => $total, 'last_record' => $lastId];
}
/**
* @throws HubspotException
* @throws SocialAccountTokenInvalidException
* @throws BadRequest
*/
public function getPaginatedDataGenerator(
array $payload,
string $type,
int $offset = 0,
int &$total = 0,
?string &$lastRecordId = null
): \Generator {
return $this->paginationService->getPaginatedDataGenerator(
$this,
$payload,
$type,
$offset,
$total,
$lastRecordId
);
}
/**
* Execute a search request against HubSpot CRM objects with rate limiting.
*
* @param string $objectType The object type ('deals', 'companies', 'contacts', 'calls')
* @param array<string, mixed> $payload The search payload with filters, sorts, properties, etc.
* @return array The search response with 'results', 'total', 'paging' keys
* @throws RateLimitException When rate limit is hit
* @throws HubspotException On API errors
*/
public function search(string $objectType, array $payload): array
{
$endpoint = self::BASE_URL . "/crm/v3/objects/{$objectType}/search";
return $this->executeRequest(function () use ($endpoint, $payload) {
$response = $this->getInstance()->getClient()->request('POST', $endpoint, ['json' => $payload]);
return $response->toArray();
});
}
/**
* @throws DealApiException
* @throws CrmException
*/
public function getOpportunityById(string $crmId, array $fields): array
{
try {
// $deal = $this->executeRequest(fn () => $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$deal = $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$crmId,
implode(',', $fields),
'companies,contacts'
);
} catch (DealApiException $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $deal instanceof DealWithAssociations) {
throw new CrmException('Deal not found');
}
return [
'id' => $deal->getId(),
'properties' => $deal->getProperties(),
'associations' => $deal->getAssociations(),
];
}
/**
* Generic batch read method for HubSpot objects
*
* @param string $objectType The object type ('deals', 'companies', 'contacts')
* @param array<string> $crmIds Array of HubSpot object IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with object data
*/
private function batchReadObjects(string $objectType, array $crmIds, array $fields): array
{
if (empty($crmIds)) {
return [];
}
$this->validateBatchSize($objectType, $crmIds);
$this->ensureValidToken();
try {
$batchConfig = $this->createBatchConfiguration($objectType);
$batchReadRequest = $this->prepareBatchRequest($batchConfig, $crmIds, $fields);
$response = $batchConfig['api']->read($batchReadRequest);
$this->validateApiResponse($response, $objectType);
$results = $this->processApiResults($response);
$this->logBatchResults($objectType, $crmIds, $results);
return $results;
} catch (\Throwable $e) {
$this->handleBatchError($e, $objectType, $crmIds);
}
}
private function validateBatchSize(string $objectType, array $crmIds): void
{
if (count($crmIds) > 100) {
throw new \InvalidArgumentException("Batch size cannot exceed 100 {$objectType}");
}
}
private function createBatchConfiguration(string $objectType): array
{
$configurations = [
'deals' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->deals()->batchApi(),
],
'companies' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->companies()->batchApi(),
],
'contacts' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->contacts()->batchApi(),
],
];
if (! isset($configurations[$objectType])) {
throw new \InvalidArgumentException("Unsupported object type: {$objectType}");
}
return $configurations[$objectType];
}
private function prepareBatchRequest(array $batchConfig, array $crmIds, array $fields): object
{
$batchReadRequest = $batchConfig['batchReadRequest'];
$inputClass = $batchConfig['inputClass'];
$inputs = array_map(function ($crmId) use ($inputClass) {
$input = new $inputClass();
$input->setId($crmId);
return $input;
}, $crmIds);
$batchReadRequest->setInputs($inputs);
$batchReadRequest->setProperties($fields);
return $batchReadRequest;
}
private function validateApiResponse($response, string $objectType): void
{
if (! $response) {
throw new CrmException("HubSpot API returned null response for {$objectType} batch read");
}
}
private function processApiResults($response): array
{
$results = [];
$responseResults = $response->getResults();
if ($responseResults) {
foreach ($responseResults as $object) {
if ($object && $object->getId()) {
$results[$object->getId()] = [
'id' => $object->getId(),
'properties' => $object->getProperties() ?: [],
];
}
}
}
return $results;
}
private function logBatchResults(string $objectType, array $crmIds, array $results): void
{
$this->log->info("[HubSpot] Batch fetched {$objectType}", [
'requested_count' => count($crmIds),
'returned_count' => count($results),
'crm_ids' => $crmIds,
]);
}
private function handleBatchError(\Throwable $e, string $objectType, array $crmIds): void
{
$errorMessage = $e->getMessage() ?: 'Unknown error';
$errorTrace = $e->getTraceAsString() ?: 'No trace available';
$this->log->error("[HubSpot] Failed to batch fetch {$objectType}", [
'crm_ids' => $crmIds,
'error' => $errorMessage,
'trace' => $errorTrace,
]);
throw new CrmException("Failed to batch fetch {$objectType}: " . $errorMessage);
}
/**
* Batch read multiple opportunities by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot deal IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with opportunity data
*/
public function getOpportunitiesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('deals', $crmIds, $fields);
}
/**
* Batch read multiple companies by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot company IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with company data
*/
public function getCompaniesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('companies', $crmIds, $fields);
}
/**
* Batch read multiple contacts by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot contact IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with contact data
*/
public function getContactsByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('contacts', $crmIds, $fields);
}
/**
* @throws CompanyApiException
* @throws CrmException
*/
public function getAccountById(string $crmId, array $fields): array
{
try {
$company = $this->getNewInstance()->crm()->companies()->basicApi()->getById(
$crmId,
implode(',', $fields),
);
} catch (CompanyApiException $e) {
$this->log->info('[Hubspot] Failed to fetch account', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $company instanceof CompaniesWithAssociations) {
throw new CrmException('Account not found');
}
return [
'id' => $company->getId(),
'properties' => $company->getProperties(),
];
}
/**
* @throws ContactApiException
* @throws CrmException
*/
public function getContactById(string $crmId, array $fields): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$crmId,
implode(',', $fields)
);
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $contact instanceof ContactsWithAssociations) {
throw new CrmException('Contact not found');
}
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
}
/**
* This is email search request that Hubspot offers as GET (more generous quota)
*/
public function getContactByEmail(string $email, array $fields = []): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$email,
implode(',', $fields),
null,
false,
'email'
);
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'email' => $email,
'reason' => $e->getMessage(),
]);
return [];
}
}
/**
* @throws CrmException
*/
public function fetchProperty(string $objectType, string $propertyId): Property
{
$result = $this->getNewInstance()->crm()->properties()->coreApi()->getByName($objectType, $propertyId);
if (! $result instanceof Property) {
$this->log->error('[Hubspot] Failed to fetch property', [
'object_type' => $objectType,
'property_id' => $propertyId,
'reason' => $result->getMessage(),
]);
throw new CrmException('Failed to fetch property');
}
return $result;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchPropertyOptions(string $objectType, string $propertyId): array
{
/** @var array<CrmFieldOption> */
return $this->fetchProperty($objectType, $propertyId)->getOptions();
}
/**
* @return array<array{id:string, label:string, deleted:bool}>
*/
public function fetchCallDispositions(): array
{
/** @var Response $response */
$response = $this->getInstance()->engagements()->getCallDispositions();
/**
* @var array<array{
* id:string,
* label:string,
* deleted: bool
* }>
*/
return $response->toArray();
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityPipelineStages(): array
{
$stages = [];
$apiResponse = $this->getNewInstance()->crm()->pipelines()->pipelinesApi()->getAll('deals');
if ($apiResponse instanceof Error) {
$this->log->error('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $apiResponse->getMessage(),
]);
return [];
}
foreach ($apiResponse->getResults() as $pipeline) {
$pipelineStages = array_map(
static function (PipelineStage $stage) {
return [
'id' => $stage->getId(),
'label' => $stage->getLabel(),
];
},
$pipeline->getStages()
);
$stages = array_merge($stages, $pipelineStages);
}
return $stages;
}
public function fetchOpportunityPipelines(): array
{
$pipelines = [];
try {
$apiResponse = $this->makeRequest('/crm/v3/pipelines/deals');
} catch (\Exception $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $e->getMessage(),
]);
return [];
}
$response = $apiResponse->toArray();
foreach ($response['results'] as $pipeline) {
$pipelines[] = [
'id' => $pipeline['id'],
'label' => $pipeline['label'],
];
}
return $pipelines;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchMeetingOutcomeFieldOptions(Field $field): array
{
return $field->getCrmProviderId() === 'meetingOutcome'
? $this->fetchMeetingOutcomeTypes()
: $this->fetchCallActivityTypes();
}
public function fetchMeetingOutcomeTypes(): array
{
return $this->extractMeetingTypeOptions(
'[URL_WITH_CREDENTIALS] Response $response */
$response = $this->getInstance()
->getClient()
->request('GET', $endpoint);
/**
* @var array<array{
* value: string,
* label: string,
* displayOrder: int
* }> $optionData
*/
$optionData = $response->toArray()['options'] ?? [];
$options = [];
foreach ($optionData as $item) {
$options[] = [
'id' => $item['value'],
'value' => $item['value'],
'label' => $item['label'],
'display_order' => $item['displayOrder'],
];
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchDispositionFieldOptions(): array
{
$options = [];
$dispositions = $this->fetchCallDispositions();
foreach ($dispositions as $disposition) {
if ($disposition['deleted'] !== false) {
continue;
}
$option['value'] = $disposition['id'];
$option['id'] = $disposition['id'];
$option['label'] = $disposition['label'];
$options[] = $option;
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityFieldOptions(Field $field): array
{
if ($field->isStageField()) {
return $this->fetchOpportunityPipelineStages();
}
if ($field->isPipelineField()) {
return $this->fetchOpportunityPipelines();
}
return $this->fetchPropertyOptions('deals', $field->getCrmProviderId());
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function makeRequest(string $endpoint, $method = 'GET', $payload = [], ?string $queryString = null)
{
$endpoint = self::BASE_URL . $endpoint;
if ($method === 'GET') {
$response = $this->getInstance()->getClient()?->request(
method: $method,
endpoint: $endpoint,
query_string: $queryString
);
} else {
$response = $this->getInstance()->getClient()->request($method, $endpoint, [
'json' => ($payload),
]);
}
//
// $max = $response->getHeaderLine('X-HubSpot-RateLimit-Max'); // "110"
// $remaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'); // "109"
// $interval = $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // "10000"
// $body = json_decode((string) $response->getBody(), true);
//
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$max ' . PHP_EOL . print_r($max, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$remaining ' . PHP_EOL . print_r($remaining, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$interval ' . PHP_EOL . print_r($interval, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$body ' . PHP_EOL . print_r($body, true));
return $response;
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function createMeeting(array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings';
return $this->makeRequest($endpoint, 'POST', $payload);
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function updateMeeting(string $meetingId, array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings/' . $meetingId;
return $this->makeRequest($endpoint, 'PATCH', $payload);
}
/**
* @throws \Exception
*/
public function createNote(
string $body,
string $ownerId,
int $timestamp,
string $objectId,
NoteObject $noteObject
): ?string {
try {
$noteInput = new SimplePublicObjectInput([
'properties' => [
'hs_note_body' => $body,
'hubspot_owner_id' => $ownerId,
'hs_timestamp' => $timestamp,
],
]);
// Create note
$note = $this->getNewInstance()->crm()->objects()->basicApi()->create('note', $noteInput);
$this->getNewInstance()->crm()->objects()->associationsApi()->create(
'note',
$note->getId(),
$this->getNoteObject($noteObject),
$objectId,
$this->getNoteAssociationType($noteObject),
);
return $note->getId();
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to create note', [
'objectId' => $objectId,
'noteObject' => $noteObject->getObjectType(),
'reason' => $e->getMessage(),
]);
\Sentry::captureException($e);
}
return null;
}
public function updateEngagement(string $objectId, array $engagement, array $metadata): void
{
$this->getInstance()->engagements()->update($objectId, $engagement, $metadata);
}
public function getEngagementData(string $engagementId): array
{
$engagement = $this->getInstance()->engagements()->get($engagementId);
return $engagement->toArray();
}
public function createEngagement(array $engagement, array $associations, array $metadata): Response
{
return $this->getInstance()
->engagements()
->create($engagement, $associations, $metadata);
}
public function isUnauthorizedException(\Exception $e): bool
{
if ($e instanceof BadRequest
|| $e instanceof DealApiException
|| $e instanceof ContactApiException
|| $e instanceof CompanyApiException
) {
return (int) $e->getCode() === 401;
}
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
return $e->getResponse()?->getStatusCode() === 401;
}
$message = strtolower($e->getMessage());
return str_contains($message, '401 unauthorized') ||
str_contains($message, 'http 401') ||
str_contains($message, 'status code 401') ||
(preg_match('/\b401\b/', $message) === 1 && str_contains($message, 'unauthorized'));
}
/**
* Validates and refreshes the access token if needed before API requests.
* This ensures long-running processes don't fail due to token expiration.
*
* @throws SocialAccountTokenInvalidException
*/
public function ensureValidToken(): void
{
if ($this->oauthAccount === null) {
return;
}
$newToken = $this->tokenManager->ensureValidToken($this->oauthAccount);
if ($newToken !== null) {
$this->accessToken = $newToken;
}
}
public function getConfig()
{
return $this->config;
}
// returns only active (archived=false)
public function getOwners(): array
{
return $this->getNewInstance()->crm()->owners()->getAll();
}
/**
* @param bool $archived
*
* @return array<Owner>|[]
*/
public function getOwnersArchived(bool $archived = true): array
{
$endpoint = '/crm/v3/owners';
$queryParams = [
'archived' => $archived ? 'true' : 'false',
];
$queryString = http_build_query($queryParams);
$owners = [];
try {
$response = $this->makeRequest(endpoint: $endpoint, queryString: $queryString);
$responseData = $response?->toArray();
foreach ($responseData['results'] as $result) {
try {
$owners[] = Owner::create($result);
} catch (Throwable $e) {
$this->log->error('[HubSpot] Failed to process owner data', [
'result' => $result,
'error' => $e->getMessage(),
]);
continue;
}
}
} catch (Throwable $e) {
$this->log->error('HubSpot] Failed to fetch owners', [
'archived' => $archived,
'error' => $e->getMessage(),
]);
return [];
}
return $owners;
}
public function getMeeting(string $engagementId): ObjectWithAssociations
{
return $this->getNewInstance()->crm()->objects()->basicApi()
->getById('meeting', $engagementId, null, 'contact,company,deal');
}
public function deleteEngagement(string $engagementId): void
{
$this->getInstance()->engagements()->delete((int) $engagementId);
}
public function getAssociationsData(array $ids, string $fromObject, string $toObject): array
{
$associationData = [];
$idChunks = array_chunk($ids, self::ASSOCIATIONS_BATCH_SIZE_LIMIT);
foreach ($idChunks as $idChunk) {
try {
$batchInput = new \HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId();
$batchInput->setInputs(array_map(function ($id) {
$publicObjectId = new \HubSpot\Client\Crm\Associations\Model\PublicObjectId();
$publicObjectId->setId($id);
return $publicObjectId;
}, $idChunk));
$associatedObjectsData = $this
->getNewInstance()
->crm()
->associations()
->batchApi()
->read($fromObject, $toObject, $batchInput);
if ($associatedObjectsData instanceof \HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti) {
foreach ($associatedObjectsData->getResults() as $association) {
$from = $association->getFrom()->getId();
$toAssociations = $association->getTo();
if (! empty($toAssociations)) {
$associationData[$from] = array_map(function ($item) {
return $item->getId();
}, $toAssociations);
}
}
}
} catch (RateLimitException $e) {
throw $e;
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to fetch associations', [
'from_object' => $fromObject,
'to_object' => $toObject,
'reason' => $e->getMessage(),
]);
}
}
return $associationData;
}
/**
* @throws \Exception
*/
private function getNoteAssociationType(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'note_to_deal',
NoteObject::Lead, NoteObject::Contact => 'note_to_contact', // or 'note_to_lead' if your portal supports it
NoteObject::Account => 'note_to_company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
/**
* @throws \Exception
*/
private function getNoteObject(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'deal',
NoteObject::Lead, NoteObject::Contact => 'contact',
NoteObject::Account => 'company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
public function addAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/create";
return $this->makeRequest($endpoint, 'POST', $payload);
}
public function removeAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/archive";
return $this->makeRequest($endpoint, 'POST', $payload);
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
9887
|
NULL
|
NULL
|
NULL
|
|
3067
|
120
|
43
|
2026-05-07T11:58:57.975141+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778155137975_m2.jpg...
|
PhpStorm
|
faVsco.js – IntegrationApp/…/SyncCrmEntitiesTrait. faVsco.js – IntegrationApp/…/SyncCrmEntitiesTrait.php...
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
Analyzing…
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\IntegrationApp\ServiceTraits;
use Carbon\Carbon;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Support\Str;
use Jiminny\Events\Activities\Crm\LeadConverted;
use Jiminny\Models\Contact;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\LayoutEntity;
use Jiminny\Models\Lead;
use Jiminny\Models\Opportunity;
use Jiminny\Models\Stage;
use Jiminny\Models\Team;
use Jiminny\Models\Account;
use Jiminny\Jobs\Crm\MatchActivitiesToNewOpportunity;
use Jiminny\Repositories\Crm\CrmEntityRepository;
use Jiminny\Repositories\Crm\FieldDataRepository;
use Jiminny\Repositories\Crm\FieldRepository;
use Jiminny\Repositories\Crm\StageRepository;
use Jiminny\Services\Crm\IntegrationApp\Config\IntegrationConfigInterface as IntegrationConfig;
use Jiminny\Services\Crm\IntegrationApp\DTO;
use Jiminny\Services\Crm\IntegrationApp\DataClient;
use Jiminny\Services\Crm\OpportunitySyncStrategyResolver;
use Jiminny\Utils\CurrencyFormatter;
use Psr\Log\LoggerInterface;
/**
* This trait follows closely the contract SyncCrmEntitiesInterface
*/
trait SyncCrmEntitiesTrait
{
use ExternalMapsTrait;
private const int CHUNK_SIZE = 100;
public ?Team $team = null;
public ?Configuration $config;
public ?IntegrationConfig $editionConfig;
protected LoggerInterface $logger;
/**
* @var DataClient
*/
protected $client;
public function syncAllAccounts(): int
{
$count = 0;
foreach ($this->client->getAllAccounts() as $eachAccount) {
$this->importAccount($eachAccount);
$count++;
}
return $count;
}
public function syncAccounts(Carbon $since, ?Carbon $to = null): int
{
$count = 0;
$this->logger->info('[integration-app] Syncing accounts', [
'since' => $since,
'to' => $to,
'team_id' => $this->team?->getId(),
]);
$params = [
'since' => $since,
'to' => $to,
];
/** @var DTO\Account $eachAccount*/
foreach ($this->client->getFilteredAccounts($params) as $eachAccount) {
$this->importAccount($eachAccount);
$count++;
}
$this->logger->info('[integration-app] Syncing accounts finished successfully', [
'since' => $since,
'to' => $to,
'team_id' => $this->team?->getId(),
]);
return $count;
}
public function syncAccount(string $crmId): ?Account
{
try {
$accountDto = $this->client->getSingleAccount($crmId);
if ($accountDto === null) {
return null;
}
return $this->importAccount($accountDto);
} catch (RequestException) {
return null;
}
}
private function importAccount(DTO\Account $accountDto): Account
{
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$data = [
'crm_provider_id' => $accountDto->externalId,
'user_id' => $this->findMappedUserId($accountDto->ownerId),
'owner_id' => $accountDto->ownerId,
'name' => mb_substr($accountDto->name, 0, 191),
'phone' => $accountDto->phone !== null ? mb_substr($accountDto->phone, 0, 25) : null,
'industry' => $accountDto->industry !== null ? mb_substr($accountDto->industry, 0, 191) : null,
'domain' => $accountDto->websiteUrl !== null ? mb_substr($accountDto->websiteUrl, 0, 191) : null,
'country_code' => $accountDto->countryCode,
'remotely_created_at' => $accountDto->createdAt,
];
$this->logger->info('[integration-app] Importing account', [
'crm_provider_id' => $accountDto->externalId,
'team_id' => $this->team?->getId(),
]);
$account = $crmEntityRepo->importAccount($this->getConfiguration(), $data);
$this->mapExternalAccount($account);
return $account;
}
// Sync multiple records.
public function syncAllContacts(): int
{
$count = 0;
foreach ($this->client->getAllContacts() as $eachContact) {
// import contacts here
$this->importContact(contactDto: $eachContact);
$count++;
}
return $count;
}
public function syncContacts(Carbon $since, ?Carbon $to = null): int
{
$count = 0;
$this->logger->info('[integration-app] Syncing contacts', [
'since' => $since,
'to' => $to,
'team_id' => $this->team?->getId(),
]);
$params = [
'since' => $since,
'to' => $to,
];
foreach ($this->client->getFilteredContacts($params) as $eachContact) {
$this->importContact($eachContact);
$count++;
}
$this->logger->info('[integration-app] Syncing contacts finished successfully', [
'since' => $since,
'to' => $to,
'team_id' => $this->team?->getId(),
]);
return $count;
}
// Sync single records.
public function syncContact(string $crmId): ?Contact
{
try {
$contactRecord = $this->client->getSingleContact($crmId);
if ($contactRecord === null) {
return null;
}
return $this->importContact($contactRecord);
} catch (RequestException) {
return null;
}
}
private function importContact(DTO\Contact $contactDto): ?Contact
{
$createInternalAccount = false;
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$accountId = $this->findMappedAccountId(
pivotEntityId: $contactDto->externalId,
externalAccountId: $contactDto->accountId,
);
$userId = $this->findMappedUserId($contactDto->ownerId);
if ($accountId === null) {
$this->logger->info('[integration-app] Importing contact, but related account cannot be found', [
'crm_provider_id' => $contactDto->externalId,
'raw_account_id' => $contactDto->accountId,
'name' => $contactDto->fullName,
'user_id' => $userId,
]);
$createInternalAccount = true;
}
$data = [
'user_id' => $userId,
'account_id' => $accountId,
'crm_provider_id' => $contactDto->externalId,
'owner_id' => $contactDto->ownerId,
'name' => $contactDto->fullName !== null ? mb_substr($contactDto->fullName, 0, 100) : null,
'title' => $contactDto->title !== null ? mb_substr($contactDto->title, 0, 100) : null,
'email' => $contactDto->primaryEmail !== null ? mb_substr($contactDto->primaryEmail, 0, 191) : null,
'phone' => $contactDto->phone !== null ? mb_substr($contactDto->phone, 0, 25) : null,
'mobile_phone' => $contactDto->mobilePhone !== null ? mb_substr($contactDto->mobilePhone, 0, 25) : null,
'country_code' => $contactDto->countryCode !== null ? mb_substr($contactDto->countryCode, 0, 2) : null,
'remotely_created_at' => $contactDto->createdAt,
'photo_path' => '',
];
$this->logger->info('[integration-app] Importing contact', [
'crm_provider_id' => $contactDto->externalId,
'team_id' => $this->team?->getId(),
]);
$contact = $crmEntityRepo->importContact($this->getConfiguration(), $data);
$this->mapExternalContact($contact);
if ($createInternalAccount) {
$this->createInternalAccountFromContact($contact)->getId();
}
return $contact;
}
/**
* @param bool $matchFromOtherCrm - This parameter is intended to be manually used. It will help with
* matching older opportunities if the team is transitioning from one CRM provider to another.
*/
public function syncAllOpportunities(bool $matchFromOtherCrm = false): int
{
$count = 0;
foreach ($this->client->getAllOpportunities() as $eachDeal) {
$this->upsertOpportunity($eachDeal, $matchFromOtherCrm);
$count++;
}
return $count;
}
public function syncOpportunities(array $parameters, ?string $strategy = null): int
{
$parameters['strategy'] = $strategy ?? OpportunitySyncStrategyResolver::LAST_MODIFIED_SYNC_OPPORTUNITY_STRATEGY;
$count = 0;
$this->logger->info('[integration-app] Syncing opportunities', [
'parameters' => $parameters,
'team_id' => $this->team?->getId(),
]);
/** @var DTO\Opportunity[] $pageResultData */
foreach ($this->client->getFilteredOpportunities($parameters) as $pageResultData) {
$externalAccounts = [];
$externalContacts = [];
foreach ($pageResultData as $eachRecord) {
$externalAccounts[] = $eachRecord->accountId ?? null;
$externalContacts[] = $eachRecord->contactId ?? null;
}
// Import missing contacts and account as early as possible
$missingContacts = $this->identifyMissingContacts($externalContacts);
if (! empty($missingContacts)) {
$this->batchSyncContacts($missingContacts);
}
$missingAccounts = $this->identifyMissingAccounts($externalAccounts);
if (! empty($missingAccounts)) {
$this->batchSyncAccounts($missingAccounts);
}
foreach ($pageResultData as $eachRecord) {
$this->upsertOpportunity($eachRecord);
$count++;
}
}
$this->logger->info('[integration-app] Syncing opportunities finished successfully', [
'parameters' => $parameters,
'team_id' => $this->team?->getId(),
]);
return $count;
}
public function syncOpportunity(string $crmId): ?Opportunity
{
try {
$opportunityRecord = $this->client->getSingleOpportunity($crmId);
if ($opportunityRecord === null) {
return null;
}
return $this->upsertOpportunity($opportunityRecord);
} catch (RequestException) {
return null;
}
}
public function syncAllLeads(): int
{
if (isset($this->config->getSettings()['lead_sync_disabled'])) {
$this->logger->info('[integration-app] Syncing leads disabled for the client', [
'team_id' => $this->team?->getId(),
]);
return 0;
}
$count = 0;
foreach ($this->client->getAllLeads() as $eachLead) {
$this->importLead($eachLead);
$count++;
}
return $count;
}
public function syncLeads(Carbon $since, ?Carbon $to = null, ?string $crmProfileId = null): int
{
if (isset($this->config->getSettings()['lead_sync_disabled'])) {
$this->logger->info('[integration-app] Syncing leads disabled for the client', [
'team_id' => $this->team?->getId(),
'since' => $since,
'to' => $to,
'crm_profile_id' => $crmProfileId,
]);
return 0;
}
$count = 0;
$this->logger->info('[integration-app] Syncing leads', [
'since' => $since,
'to' => $to,
'crm_profile_id' => $crmProfileId,
'team_id' => $this->team?->getId(),
]);
$filterData = [
'since' => $since,
'to' => $to,
'crm_profile_id' => $crmProfileId,
'converted' => 'both',
];
foreach ($this->client->getFilteredLeads($filterData) as $eachLead) {
$this->importLead($eachLead);
$count++;
}
$this->logger->info('[integration-app] Syncing leads finished successfully', [
'since' => $since,
'to' => $to,
'team_id' => $this->team?->getId(),
]);
return $count;
}
public function syncLead(string $crmId): ?Lead
{
if (isset($this->config->getSettings()['lead_sync_disabled'])) {
$this->logger->info('[integration-app] Syncing leads disabled for the client', [
'team_id' => $this->team?->getId(),
'crm_id' => $crmId,
]);
return null;
}
try {
$leadRecord = $this->client->getSingleAndConvertLead($crmId);
if ($leadRecord === null) {
return null;
}
return $this->importLead($leadRecord);
} catch (RequestException) {
return null;
}
}
private function importLead(DTO\Lead $leadDto): ?Lead
{
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$userId = $this->findMappedUserId($leadDto->ownerId);
$stage = null;
if ($this->editionConfig->supportsStages()) {
// Get the current stage.
$stage = $crmEntityRepo->getStageForName(
configuration: $this->config,
name: $leadDto->status,
type: Stage::TYPE_LEAD
);
}
if ($stage === null && ! empty($leadDto->status)) {
// Try to sync and import the lead stage by name only
$stage = $this->syncStageByNameOnly($this->config, $leadDto->status, Stage::TYPE_LEAD);
}
$stageId = $stage?->id;
$leadData = [
'team_id' => $this->team->getId(),
'crm_configuration_id' => $this->config->getId(),
'crm_provider_id' => $leadDto->externalId,
'name' => $leadDto->fullName,
'company' => $leadDto->companyName,
'owner_id' => $leadDto->ownerId,
'user_id' => $userId,
'stage_id' => $stageId,
'email' => $leadDto->primaryEmail,
'phone' => $leadDto->primaryPhone,
'mobile_phone' => $leadDto->secondaryPhone,
'title' => $leadDto->jobTitle,
'remotely_created_at' => $leadDto->createdAt,
];
$convertedLeadData = $this->processConvertedLead($crmEntityRepo, $leadDto);
$leadData = array_merge($leadData, $convertedLeadData);
$this->logger->info('[integration-app] Importing lead', [
'crm_provider_id' => $leadDto->externalId,
'name' => $leadDto->primaryEmail,
'team_id' => $this->team?->getId(),
]);
$lead = $crmEntityRepo->importLead($this->config, $leadData);
$this->dispatchLeadConvertedEvent($lead);
return $lead;
}
private function processConvertedLead(CrmEntityRepository $crmEntityRepo, DTO\Lead $leadDto): array
{
if (! $leadDto->isConverted()) {
return [];
}
$leadData = [
'converted_at' => $leadDto->getConvertedAt(),
];
$this->decorateWithConvertedContact($crmEntityRepo, $leadDto, $leadData);
$this->decorateWithConvertedAccount($crmEntityRepo, $leadDto, $leadData);
$this->decorateWithConvertedOpportunity($crmEntityRepo, $leadDto, $leadData);
return $leadData;
}
private function dispatchLeadConvertedEvent(Lead $lead): void
{
if ($lead->wasChanged('converted_at') && $lead->getConvertedAt() !== null) {
event(new LeadConverted($lead));
}
}
private function decorateWithConvertedContact(
CrmEntityRepository $crmEntityRepo,
DTO\Lead $leadDto,
array &$leadData
): void {
if ($leadDto->getConvertedContactId() !== null) {
$convertedContact = $crmEntityRepo->findContactByExternalId(
$this->config,
$leadDto->getConvertedContactId()
);
if ($convertedContact === null) {
try {
$convertedContact = $this->syncContact($leadDto->getConvertedContactId());
} catch (\Exception $exception) {
$this->logger->error('[integration-app] Error syncing converted contact', [
'lead_id' => $leadDto->getExternalId(),
'crm_provider_id' => $leadDto->getConvertedContactId(),
'error' => $exception->getMessage(),
]);
}
}
$leadData['converted_contact_id'] = $convertedContact?->getId();
}
}
private function decorateWithConvertedAccount(
CrmEntityRepository $crmEntityRepo,
DTO\Lead $leadDto,
array &$leadData
): void {
if ($leadDto->getConvertedAccountId() !== null) {
$convertedAccount = $crmEntityRepo->findAccountByExternalId(
$this->config,
$leadDto->getConvertedAccountId()
);
if ($convertedAccount === null) {
try {
$convertedAccount = $this->syncAccount($leadDto->getConvertedAccountId());
} catch (\Exception $exception) {
$this->logger->error('[integration-app] Error syncing converted account', [
'lead_id' => $leadDto->getExternalId(),
'crm_provider_id' => $leadDto->getConvertedAccountId(),
'error' => $exception->getMessage(),
]);
}
}
$leadData['converted_account_id'] = $convertedAccount?->getId();
}
}
private function decorateWithConvertedOpportunity(
CrmEntityRepository $crmEntityRepo,
DTO\Lead $leadDto,
array &$leadData
): void {
if ($leadDto->getConvertedOpportunityId() !== null) {
$convertedOpportunity = $crmEntityRepo->findOpportunityByExternalId(
$this->config,
$leadDto->getConvertedOpportunityId()
);
if ($convertedOpportunity === null) {
try {
$convertedOpportunity = $this->syncOpportunity($leadDto->getConvertedOpportunityId());
} catch (\Exception $exception) {
$this->logger->error('[integration-app] Error syncing converted opportunity', [
'lead_id' => $leadDto->getExternalId(),
'crm_provider_id' => $leadDto->getConvertedOpportunityId(),
'error' => $exception->getMessage(),
]);
}
}
$leadData['converted_opportunity_id'] = $convertedOpportunity?->getId();
}
}
/**
* @throws GuzzleException
*/
public function importStages(?array $types = null, ?string $missingStageName = null): ?Stage
{
if (! $this->editionConfig->supportsStages()) {
return null;
}
$missingStage = null;
$stagesCollection = $this->client->getAllDealsStages();
foreach ($stagesCollection as $eachStage) {
$stage = $this->importStage($eachStage);
if ($stage->getName() === $missingStageName) {
$missingStage = $stage;
}
}
return $missingStage;
}
private function importStage(DTO\EntityStage $stageDto): Stage
{
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$objectType = $stageDto->type ?? Stage::TYPE_OPPORTUNITY;
$stageData = [
'crm_provider_id' => $stageDto->externalId,
'name' => mb_strimwidth($stageDto->apiName ?? $stageDto->name, 0, 50),
'label' => mb_strimwidth($stageDto->masterLabel ?? $stageDto->name, 0, 191),
'sequence' => $stageDto->sortOrder ?? 0,
'probability' => $stageDto->defaultProbability ?? null,
'is_selectable' => $stageDto->isActive ?? 0,
'type' => $objectType,
];
$this->logger->info('[integration-app] Importing stage', [
'crm_provider_id' => $stageDto->externalId,
'name' => $stageDto->name,
'team_id' => $this->team?->getId(),
]);
$stage = $crmEntityRepo->importStage($this->config, $objectType, $stageData);
// Include newly imported stages to the map
$this->mapExternalStage($stage);
return $stage;
}
/**
* Attach a stage to a default business process.
* This method is used only in Zoho implementation
* where both supportsPipelines and supportsPipelines are false
*/
public function syncBusinessProcessStages(int $stageId): void
{
/** @var StageRepository $stageRepository */
$stageRepository = app(StageRepository::class);
$processName = 'DefaultOpportunityProcess';
$data = [
'team_id' => $this->team->getId(),
'name' => $processName,
'type' => Stage::TYPE_OPPORTUNITY,
'is_selectable' => true,
];
$businessProcess = $stageRepository->findOrCreateBusinessProcess(
$this->config,
$processName,
$data
);
$businessProcess->stages()->attach($stageId);
}
/**
* bool $matchFromOtherCrm
* When inserting a deal match try to match it to an existing from other CRM within the same team.
* - This parameter is intended to be manually used only. It will help with
* matching older opportunities if the team is transitioning from one CRM provider to another.
*/
private function upsertOpportunity(DTO\Opportunity $opportunityDto, bool $matchFromOtherCrm = false): ?Opportunity
{
$this->logger->info('[integration-app] Importing opportunity', [
'crm_provider_id' => $opportunityDto->externalId,
'team_id' => $this->team->getId(),
]);
if ($this->config === null) {
$this->logger->warning('[integration-app] Opportunity missing config');
return null;
}
$stageId = $this->findOpportunityStageId(
externalStageId: $opportunityDto->stageId,
stageName: $opportunityDto->stageName
);
// temporary detect memory usage
$this->logger->info('[integration-app] Stage ID', [
'memory_usage' => memory_get_usage(),
'memory_real_usage' => memory_get_usage(true),
'crm_provider_id' => $opportunityDto->externalId,
'stage_id' => $stageId,
]);
$accountId = $this->findAccountId(
pivotEntityId: $opportunityDto->externalId,
externalAccountId: $opportunityDto->accountId,
externalContactId: $opportunityDto->contactId,
);
$this->logger->info('[integration-app] Account ID', [
'memory_usage' => memory_get_usage(),
'memory_real_usage' => memory_get_usage(true),
'crm_provider_id' => $opportunityDto->externalId,
'account_id' => $accountId,
]);
if ($stageId === null || $accountId === null) {
$this->logger->warning('[integration-app] Opportunity missing data', [
'stageId' => $stageId,
'accountId' => $accountId,
'externalId' => $opportunityDto->externalId,
]);
return null;
}
$userId = $this->findMappedUserId(externalUserId: $opportunityDto->ownerId);
$data = [
'crm_provider_id' => $opportunityDto->externalId,
'team_id' => $this->team->getId(),
'account_id' => $accountId,
'user_id' => $userId,
'owner_id' => $opportunityDto->ownerId,
'name' => mb_strimwidth($opportunityDto->name, 0, 128),
'value' => $opportunityDto->amount,
'currency_code' => CurrencyFormatter::formatCode($this->getCurrencyIso($opportunityDto)),
'close_date' => $opportunityDto->closeDate,
'is_closed' => $opportunityDto->closed,
'is_won' => $opportunityDto->won,
'stage_id' => $stageId,
'record_type_id' => null,
'remotely_created_at' => $opportunityDto->createdAt,
'probability' => $opportunityDto->probability,
];
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$opportunity = $crmEntityRepo->importOpportunity(
$this->config,
$data,
$matchFromOtherCrm,
$opportunityDto->name,
);
// Import external fields into crm_field_data if present
$crmFields = $this->getOpportunitySyncableFields();
$this->importOpportunityFieldData($opportunityDto, $crmFields, $opportunity->getId());
if ($opportunityDto->deleted === true) {
$opportunity->delete();
return $opportunity;
}
if ($opportunity->wasRecentlyCreated) {
MatchActivitiesToNewOpportunity::dispatch($opportunity->getId());
}
return $opportunity;
}
private function findOpportunityStageId(?string $externalStageId, ?string $stageName): ?int
{
$stageId = null;
if ($this->editionConfig->supportsStages()) {
$stageId = $this->findMappedStageId(externalStageId: $externalStageId, type: Stage::TYPE_OPPORTUNITY);
if ($stageId === null) {
$stageId = $this->importStages(types: [Stage::TYPE_OPPORTUNITY], missingStageName: $stageName)?->id;
}
}
if ($stageId === null && $stageName !== null) {
$stageId = $this->syncStageByNameOnly(
configuration: $this->config,
stageName: $stageName,
type: Stage::TYPE_OPPORTUNITY
)?->id;
}
return $stageId;
}
private function importOpportunityFieldData(
DTO\Opportunity $opportunityDto,
array $crmFields,
int $opportunityId
): void {
/** @var FieldRepository $fieldRepository */
$fieldRepository = app(FieldRepository::class);
/** @var FieldDataRepository $fieldDataRepository */
$fieldDataRepository = app(FieldDataRepository::class);
foreach ($crmFields as $crmField) {
if (! property_exists($opportunityDto, $crmField)) {
continue;
}
if ($opportunityDto->{$crmField} === null) {
continue;
}
$field = $fieldRepository->findFieldByCrmIdAndObjectType(
$this->config,
$crmField,
Field::OBJECT_OPPORTUNITY
);
if (! $field instanceof Field) {
$this->logger->info('Field not found', [
'field' => $crmField,
'config' => $this->config->getId(),
]);
continue;
}
$entities = $field->getEntities();
if ($entities->isEmpty()) {
$this->logger->info('Field has no entities', [
'field' => $crmField,
'config' => $this->config->getId(),
]);
continue;
}
if ($entities->count() > 1) {
$this->logger->info('Field has multiple entities', [
'field' => $crmField,
'config' => $this->config->getId(),
]);
continue;
}
/** @var LayoutEntity|null $entity */
$entity = $entities->first();
if (! $entity instanceof LayoutEntity) {
continue;
}
$value = (string) $opportunityDto->{$crmField};
$fieldDataRepository->updateOrCreateFieldData(
$entity,
$opportunityId,
$value,
);
}
}
private function getCurrencyIso(DTO\Opportunity $opportunityDto): ?string
{
if ($opportunityDto->currencyIso !== null) {
return $opportunityDto->currencyIso;
}
// Fallback to billing currency
return $this->config->getDefaultCurrency();
}
/**
* Some CRM providers do not support listing all stages.
* Additionally, they may not even supply us with a stage ID when the stage is supplied as a property of the deal.
* In that case, we will usually have only a stage name.
* In order to import such stages only once, we will slugify them and produce "external ID" on our own.
*/
private function syncStageByNameOnly(Configuration $configuration, string $stageName, ?string $type = null): ?Stage
{
// @TEMP For testing purposes only!!!
// Revert when we find suitable way to fetch the stage
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$stage = $crmEntityRepo->getStageForName($configuration, $stageName, $type);
if ($stage !== null) {
return $stage;
}
// if there is other legitimate way to fetch the stage skip.
if ($this->editionConfig->supportsPipelines() ||
$this->editionConfig->supportsStages()
) {
return null;
}
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$stage = $crmEntityRepo->getStageForName($configuration, $stageName, $type);
// Create the stage if it does not exist already
if ($stage === null) {
$stageDto = new DTO\EntityStage();
$stageDto->externalId = $stageName;
$stageDto->masterLabel = Str::slug($stageName);
$stageDto->name = $stageName;
$stageDto->type = $type;
$stage = $this->importStage($stageDto);
if ($type === Stage::TYPE_OPPORTUNITY) {
$this->syncBusinessProcessStages($stage->getId());
}
}
return $stage;
}
private function findAccountId(
string $pivotEntityId,
?string $externalAccountId = null,
?string $externalContactId = null,
bool $skipAccountSync = false,
): ?int {
$accountId = $this->findMappedAccountId(
pivotEntityId: $pivotEntityId,
externalAccountId: $externalAccountId,
skipAccountSync: $skipAccountSync,
);
if ($accountId !== null) {
return $accountId;
}
/**
* The deal probably does not have an Account assigned.
* In order to not break the existing import, we will try to find a contact
* and create an Account with the same data.
*/
if (! empty($externalContactId)) {
// In rare cases the contact's external id matches our account id, whe :(
$this->logger->info('[integration-app] fallback Account', ['contact_id' => $externalContactId]);
$accountId = $this->findMappedAccountId(
pivotEntityId: $pivotEntityId,
externalAccountId: $externalContactId,
skipAccountSync: true,
);
if ($accountId !== null) {
return $accountId;
}
$this->logger->info('[integration-app] create Account from Contact', ['contact_id' => $externalContactId]);
$crmEntityRepo = app(CrmEntityRepository::class);
$contact = $crmEntityRepo->findContactByExternalId($this->config, $externalContactId);
if ($contact !== null) {
return $this->createInternalAccountFromContact($contact)->getId();
}
}
return null;
}
private function createInternalAccountFromContact(Contact $contact): Account
{
$this->logger->info('[integration-app] Create internal account from contact', [
'team_id' => $this->team?->getId(),
'contact_id' => $contact->getId(),
'crm_provider_id' => $contact->getCrmProviderId(),
]);
$data = [
'crm_configuration_id' => $this->config->getId(),
'team_id' => $this->config->getTeamId(),
'crm_provider_id' => $contact->getCrmProviderId(),
'user_id' => $contact->getUserId(),
'owner_id' => $contact->getOwnerId(),
'name' => $contact->getName(),
'phone' => $contact->getPhone(),
'country_code' => $contact->getCountryCode(),
'remotely_created_at' => $contact->getRemotelyCreatedAt(),
'is_internal' => 1,
];
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$account = $crmEntityRepo->importAccount($this->config, $data);
if ($contact->account_id === null) {
$contact->account_id = $account->getId();
$contact->save();
}
$this->mapExternalAccount($account);
return $account;
}
private function batchSyncContacts(array $externalContactIds): void
{
$this->logger->info('[integration-app] Syncing batch contacts', [
'batch_contacts' => implode(',', $externalContactIds),
'team_id' => $this->team?->getId(),
]);
/** IntegrationApp allows up to 100 IDs passed as a batch. */
$chunkedContacts = array_chunk($externalContactIds, self::CHUNK_SIZE);
foreach ($chunkedContacts as $contactGroup) {
/** @var DTO\Contact[] $pageResultData */
foreach ($this->client->getBatchContactsById($contactGroup) as $pageResultData) {
$externalAccounts = [];
foreach ($pageResultData as $eachRecord) {
$externalAccounts[] = $eachRecord->accountId ?? null;
}
$missingAccounts = $this->identifyMissingAccounts($externalAccounts);
if (! empty($missingAccounts)) {
$this->batchSyncAccounts($missingAccounts);
}
foreach ($pageResultData as $eachRecord) {
$this->importContact($eachRecord);
}
}
}
}
private function batchSyncAccounts(array $externalAccountIds): void
{
$this->logger->info('[integration-app] Syncing batch accounts', [
'batch_contacts' => implode(',', $externalAccountIds),
'team_id' => $this->team?->getId(),
]);
/** IntegrationApp allows up to 100 IDs passed as a batch. */
$chunkedAccounts = array_chunk($externalAccountIds, self::CHUNK_SIZE);
foreach ($chunkedAccounts as $accountGroup) {
/** @var DTO\Account[] $pageResultData */
foreach ($this->client->getBatchAccountsById($accountGroup) as $pageResultData) {
foreach ($pageResultData as $eachRecord) {
$this->importAccount($eachRecord);
}
}
}
}
/**
* Identify all contacts Ids, that are not found in our database.
* Scoped to the current batch so memory and query cost scale with batch size,
* not with tenant size.
*
* @param array<?string> $contacts
*
* @return list<string>
*/
private function identifyMissingContacts(array $contacts): array
{
$wanted = array_values(array_unique(array_filter($contacts)));
if ($wanted === []) {
return [];
}
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$existing = $crmEntityRepo->getExistingContactCrmIds($this->config, $wanted);
return array_values(array_diff($wanted, $existing));
}
/**
* Identify all account Ids, that are not found in our database.
* Scoped to the current batch so memory and query cost scale with batch size,
* not with tenant size.
*
* @param array<?string> $accounts
*
* @return list<string>
*/
private function identifyMissingAccounts(array $accounts): array
{
$wanted = array_values(array_unique(array_filter($accounts)));
if ($wanted === []) {
return [];
}
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$existing = $crmEntityRepo->getExistingAccountCrmIds($this->config, $wanted);
return array_values(array_diff($wanted, $existing));
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide
app ~/jiminny/app
.circleci
.cursor
.github
.sonarlint
.vscode, folder
.windsurf
app, sources root
Actions
Component
Acl
ActionItems, folder
Activity, folder
ActivityAnalytics
ActivitySearch
AiActivityType, folder
AiAutomation, folder
AiCallScoring, folder
AskAnything
Dtos
Events
AskAnythingPromptService.php, class
HistoryService.php, class
AskJiminnyAi
AWS
BillingManagement
Cache
CoachingFeedback
Country, folder
CustomerApi, folder
Database, folder
Datadog, folder
DateTime, folder
DealInsights, folder
DealRisks
ElasticSearch
Eloquent
Encoding
Encryption
ES
Faker
FeatureFlags
FFMpeg
FileSystem
Gecko
Gong
GuzzleHttp
KeyPoints
Kiosk
LanguageDetection
LiveFeed
Locks
Math
MediaPipeline
MeetingBot
MobileSettings, folder
Model, folder
Notification, folder
Nudge
ParagraphBreaker
ParticipantSpeech
PartitionedCookie
PlaybackPage
Playlist
Prophet
ProphetAi, folder
ProsperWorks
Queue
Job
RateLimitAware.php, abstract class
RateLimitAwareWrapper.php, class
BotsQueueConstants.php
Constants.php
ProcessingQueueConstants.php
Router, folder
Saml2
SCIM
Seeder
Sentry
Serializer
Settings
Sidekick
Slack
TeamInsights, folder
TimeMemoryMapper, folder
Transcription
TranscriptionSummary
Twilio
Uploader
UrlGenerator
Utility
Exceptions
Service
BaseRateLimiter.php, class
EfficientJsonParser.php, class
ProviderRateLimiter.php, class
RateLimiterInstance.php, class
Uuid
Waveform
Webhooks
Workflow
Configuration
Console, folder
Commands
Activities
Analytics
Calendars
Crm
Hubspot
IntegrationApp
Traits
AddLayoutEntities.php, class
AutologDelayedCommand.php, class
BullhornCommandAbstract.php, abstract class
BullhornPingCommand.php, class
BullhornSearchCommand.php, class
BullhornSessionCommand.php, class
CheckActivityLoggableCommand.php, final class
CleanDuplicateFieldDataCommand.php, class
FullSyncOpportunityCommand.php, class
LogActivitiesCommand.php, final class
ManageSyncStrategyCommand.php, class
MatchCrmObjectsCommand.php, class
MatchOpportunityActivitiesCommand.php, class
MigrateProvider.php, class
ProcessHubspotObjectsSyncBatches.php, class
PurgeDeletedOpportunitiesCommand.php, class
ResetGovernorLimits.php, class
SendNotLogged.php, class
SetupActivityTypeForFollowUp.php, final class
SetupCloseCrm.php, class
SetupCopperCrm.php, class
SetupCrmCommand.php, abstract class
SetupLayouts.php, class
SyncAccount.php, class
SyncContact.php, class
SyncFieldMetadata.php, class
SyncHubspotActiveDeals.php, class
SyncHubspotObjects.php, class
SyncLead.php, class
SyncObjects.php, class
SyncOpportunitiesMissingFieldDataCommand.php, class
SyncOpportunity.php, class
SyncProfileMetadata.php, class
SyncTeamMetadata.php, class
UpdateOpportunitySpecifications.php, class
DealInsights
Dev
AddRateLimitCommand.php, class
FixHubSpotTokens.php, class
FixMissMatchedCrmActivitiesCommand.php, final class
ImportCallsCommand.php, class
MonitorSocialAccountsState.php, class
Dialers
DTOs
Elasticsearch
EngagementStats
GeckoExport
Livestream
Mailboxes
Migrate...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.034242023,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"","depth":4,"bounds":{"left":0.52859044,"top":0.0726257,"width":0.45977393,"height":0.9066241},"on_screen":true,"value":"","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Analyzing…","depth":4,"bounds":{"left":0.5053192,"top":0.17478053,"width":0.019946808,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\IntegrationApp\\ServiceTraits;\n\nuse Carbon\\Carbon;\nuse GuzzleHttp\\Exception\\GuzzleException;\nuse GuzzleHttp\\Exception\\RequestException;\nuse Illuminate\\Support\\Str;\nuse Jiminny\\Events\\Activities\\Crm\\LeadConverted;\nuse Jiminny\\Models\\Contact;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\LayoutEntity;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Opportunity;\nuse Jiminny\\Models\\Stage;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\Account;\nuse Jiminny\\Jobs\\Crm\\MatchActivitiesToNewOpportunity;\nuse Jiminny\\Repositories\\Crm\\CrmEntityRepository;\nuse Jiminny\\Repositories\\Crm\\FieldDataRepository;\nuse Jiminny\\Repositories\\Crm\\FieldRepository;\nuse Jiminny\\Repositories\\Crm\\StageRepository;\nuse Jiminny\\Services\\Crm\\IntegrationApp\\Config\\IntegrationConfigInterface as IntegrationConfig;\nuse Jiminny\\Services\\Crm\\IntegrationApp\\DTO;\nuse Jiminny\\Services\\Crm\\IntegrationApp\\DataClient;\nuse Jiminny\\Services\\Crm\\OpportunitySyncStrategyResolver;\nuse Jiminny\\Utils\\CurrencyFormatter;\nuse Psr\\Log\\LoggerInterface;\n\n/**\n * This trait follows closely the contract SyncCrmEntitiesInterface\n */\ntrait SyncCrmEntitiesTrait\n{\n use ExternalMapsTrait;\n\n private const int CHUNK_SIZE = 100;\n\n public ?Team $team = null;\n public ?Configuration $config;\n public ?IntegrationConfig $editionConfig;\n protected LoggerInterface $logger;\n /**\n * @var DataClient\n */\n protected $client;\n\n public function syncAllAccounts(): int\n {\n $count = 0;\n foreach ($this->client->getAllAccounts() as $eachAccount) {\n $this->importAccount($eachAccount);\n $count++;\n }\n\n return $count;\n }\n\n public function syncAccounts(Carbon $since, ?Carbon $to = null): int\n {\n $count = 0;\n $this->logger->info('[integration-app] Syncing accounts', [\n 'since' => $since,\n 'to' => $to,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $params = [\n 'since' => $since,\n 'to' => $to,\n ];\n\n /** @var DTO\\Account $eachAccount*/\n foreach ($this->client->getFilteredAccounts($params) as $eachAccount) {\n $this->importAccount($eachAccount);\n $count++;\n }\n\n $this->logger->info('[integration-app] Syncing accounts finished successfully', [\n 'since' => $since,\n 'to' => $to,\n 'team_id' => $this->team?->getId(),\n ]);\n\n return $count;\n }\n\n public function syncAccount(string $crmId): ?Account\n {\n try {\n $accountDto = $this->client->getSingleAccount($crmId);\n if ($accountDto === null) {\n return null;\n }\n\n return $this->importAccount($accountDto);\n } catch (RequestException) {\n return null;\n }\n }\n\n private function importAccount(DTO\\Account $accountDto): Account\n {\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $data = [\n 'crm_provider_id' => $accountDto->externalId,\n 'user_id' => $this->findMappedUserId($accountDto->ownerId),\n 'owner_id' => $accountDto->ownerId,\n 'name' => mb_substr($accountDto->name, 0, 191),\n 'phone' => $accountDto->phone !== null ? mb_substr($accountDto->phone, 0, 25) : null,\n 'industry' => $accountDto->industry !== null ? mb_substr($accountDto->industry, 0, 191) : null,\n 'domain' => $accountDto->websiteUrl !== null ? mb_substr($accountDto->websiteUrl, 0, 191) : null,\n 'country_code' => $accountDto->countryCode,\n 'remotely_created_at' => $accountDto->createdAt,\n ];\n\n $this->logger->info('[integration-app] Importing account', [\n 'crm_provider_id' => $accountDto->externalId,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $account = $crmEntityRepo->importAccount($this->getConfiguration(), $data);\n $this->mapExternalAccount($account);\n\n return $account;\n }\n\n // Sync multiple records.\n public function syncAllContacts(): int\n {\n $count = 0;\n foreach ($this->client->getAllContacts() as $eachContact) {\n // import contacts here\n $this->importContact(contactDto: $eachContact);\n $count++;\n }\n\n return $count;\n }\n\n public function syncContacts(Carbon $since, ?Carbon $to = null): int\n {\n $count = 0;\n $this->logger->info('[integration-app] Syncing contacts', [\n 'since' => $since,\n 'to' => $to,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $params = [\n 'since' => $since,\n 'to' => $to,\n ];\n\n foreach ($this->client->getFilteredContacts($params) as $eachContact) {\n $this->importContact($eachContact);\n $count++;\n }\n\n $this->logger->info('[integration-app] Syncing contacts finished successfully', [\n 'since' => $since,\n 'to' => $to,\n 'team_id' => $this->team?->getId(),\n ]);\n\n return $count;\n }\n\n // Sync single records.\n public function syncContact(string $crmId): ?Contact\n {\n try {\n $contactRecord = $this->client->getSingleContact($crmId);\n if ($contactRecord === null) {\n return null;\n }\n\n return $this->importContact($contactRecord);\n } catch (RequestException) {\n return null;\n }\n }\n\n private function importContact(DTO\\Contact $contactDto): ?Contact\n {\n $createInternalAccount = false;\n\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n\n $accountId = $this->findMappedAccountId(\n pivotEntityId: $contactDto->externalId,\n externalAccountId: $contactDto->accountId,\n );\n $userId = $this->findMappedUserId($contactDto->ownerId);\n\n if ($accountId === null) {\n $this->logger->info('[integration-app] Importing contact, but related account cannot be found', [\n 'crm_provider_id' => $contactDto->externalId,\n 'raw_account_id' => $contactDto->accountId,\n 'name' => $contactDto->fullName,\n 'user_id' => $userId,\n ]);\n\n $createInternalAccount = true;\n }\n\n $data = [\n 'user_id' => $userId,\n 'account_id' => $accountId,\n 'crm_provider_id' => $contactDto->externalId,\n 'owner_id' => $contactDto->ownerId,\n 'name' => $contactDto->fullName !== null ? mb_substr($contactDto->fullName, 0, 100) : null,\n 'title' => $contactDto->title !== null ? mb_substr($contactDto->title, 0, 100) : null,\n 'email' => $contactDto->primaryEmail !== null ? mb_substr($contactDto->primaryEmail, 0, 191) : null,\n 'phone' => $contactDto->phone !== null ? mb_substr($contactDto->phone, 0, 25) : null,\n 'mobile_phone' => $contactDto->mobilePhone !== null ? mb_substr($contactDto->mobilePhone, 0, 25) : null,\n 'country_code' => $contactDto->countryCode !== null ? mb_substr($contactDto->countryCode, 0, 2) : null,\n 'remotely_created_at' => $contactDto->createdAt,\n 'photo_path' => '',\n ];\n\n $this->logger->info('[integration-app] Importing contact', [\n 'crm_provider_id' => $contactDto->externalId,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $contact = $crmEntityRepo->importContact($this->getConfiguration(), $data);\n $this->mapExternalContact($contact);\n\n if ($createInternalAccount) {\n $this->createInternalAccountFromContact($contact)->getId();\n }\n\n return $contact;\n }\n\n /**\n * @param bool $matchFromOtherCrm - This parameter is intended to be manually used. It will help with\n * matching older opportunities if the team is transitioning from one CRM provider to another.\n */\n public function syncAllOpportunities(bool $matchFromOtherCrm = false): int\n {\n $count = 0;\n foreach ($this->client->getAllOpportunities() as $eachDeal) {\n $this->upsertOpportunity($eachDeal, $matchFromOtherCrm);\n $count++;\n }\n\n return $count;\n }\n\n public function syncOpportunities(array $parameters, ?string $strategy = null): int\n {\n $parameters['strategy'] = $strategy ?? OpportunitySyncStrategyResolver::LAST_MODIFIED_SYNC_OPPORTUNITY_STRATEGY;\n $count = 0;\n\n $this->logger->info('[integration-app] Syncing opportunities', [\n 'parameters' => $parameters,\n 'team_id' => $this->team?->getId(),\n ]);\n\n /** @var DTO\\Opportunity[] $pageResultData */\n foreach ($this->client->getFilteredOpportunities($parameters) as $pageResultData) {\n $externalAccounts = [];\n $externalContacts = [];\n\n foreach ($pageResultData as $eachRecord) {\n $externalAccounts[] = $eachRecord->accountId ?? null;\n $externalContacts[] = $eachRecord->contactId ?? null;\n }\n\n // Import missing contacts and account as early as possible\n $missingContacts = $this->identifyMissingContacts($externalContacts);\n if (! empty($missingContacts)) {\n $this->batchSyncContacts($missingContacts);\n }\n\n $missingAccounts = $this->identifyMissingAccounts($externalAccounts);\n if (! empty($missingAccounts)) {\n $this->batchSyncAccounts($missingAccounts);\n }\n\n foreach ($pageResultData as $eachRecord) {\n $this->upsertOpportunity($eachRecord);\n $count++;\n }\n }\n\n $this->logger->info('[integration-app] Syncing opportunities finished successfully', [\n 'parameters' => $parameters,\n 'team_id' => $this->team?->getId(),\n ]);\n\n return $count;\n }\n\n public function syncOpportunity(string $crmId): ?Opportunity\n {\n try {\n $opportunityRecord = $this->client->getSingleOpportunity($crmId);\n if ($opportunityRecord === null) {\n return null;\n }\n\n return $this->upsertOpportunity($opportunityRecord);\n } catch (RequestException) {\n return null;\n }\n }\n\n public function syncAllLeads(): int\n {\n if (isset($this->config->getSettings()['lead_sync_disabled'])) {\n $this->logger->info('[integration-app] Syncing leads disabled for the client', [\n 'team_id' => $this->team?->getId(),\n ]);\n\n return 0;\n }\n\n $count = 0;\n foreach ($this->client->getAllLeads() as $eachLead) {\n $this->importLead($eachLead);\n $count++;\n }\n\n return $count;\n }\n\n public function syncLeads(Carbon $since, ?Carbon $to = null, ?string $crmProfileId = null): int\n {\n if (isset($this->config->getSettings()['lead_sync_disabled'])) {\n $this->logger->info('[integration-app] Syncing leads disabled for the client', [\n 'team_id' => $this->team?->getId(),\n 'since' => $since,\n 'to' => $to,\n 'crm_profile_id' => $crmProfileId,\n ]);\n\n return 0;\n }\n\n $count = 0;\n $this->logger->info('[integration-app] Syncing leads', [\n 'since' => $since,\n 'to' => $to,\n 'crm_profile_id' => $crmProfileId,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $filterData = [\n 'since' => $since,\n 'to' => $to,\n 'crm_profile_id' => $crmProfileId,\n 'converted' => 'both',\n ];\n\n foreach ($this->client->getFilteredLeads($filterData) as $eachLead) {\n $this->importLead($eachLead);\n $count++;\n }\n\n $this->logger->info('[integration-app] Syncing leads finished successfully', [\n 'since' => $since,\n 'to' => $to,\n 'team_id' => $this->team?->getId(),\n ]);\n\n return $count;\n }\n\n public function syncLead(string $crmId): ?Lead\n {\n if (isset($this->config->getSettings()['lead_sync_disabled'])) {\n $this->logger->info('[integration-app] Syncing leads disabled for the client', [\n 'team_id' => $this->team?->getId(),\n 'crm_id' => $crmId,\n ]);\n\n return null;\n }\n\n try {\n $leadRecord = $this->client->getSingleAndConvertLead($crmId);\n if ($leadRecord === null) {\n return null;\n }\n\n return $this->importLead($leadRecord);\n } catch (RequestException) {\n return null;\n }\n }\n\n private function importLead(DTO\\Lead $leadDto): ?Lead\n {\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $userId = $this->findMappedUserId($leadDto->ownerId);\n\n $stage = null;\n if ($this->editionConfig->supportsStages()) {\n // Get the current stage.\n $stage = $crmEntityRepo->getStageForName(\n configuration: $this->config,\n name: $leadDto->status,\n type: Stage::TYPE_LEAD\n );\n }\n\n if ($stage === null && ! empty($leadDto->status)) {\n // Try to sync and import the lead stage by name only\n $stage = $this->syncStageByNameOnly($this->config, $leadDto->status, Stage::TYPE_LEAD);\n }\n\n $stageId = $stage?->id;\n\n $leadData = [\n 'team_id' => $this->team->getId(),\n 'crm_configuration_id' => $this->config->getId(),\n 'crm_provider_id' => $leadDto->externalId,\n 'name' => $leadDto->fullName,\n 'company' => $leadDto->companyName,\n 'owner_id' => $leadDto->ownerId,\n 'user_id' => $userId,\n 'stage_id' => $stageId,\n 'email' => $leadDto->primaryEmail,\n 'phone' => $leadDto->primaryPhone,\n 'mobile_phone' => $leadDto->secondaryPhone,\n 'title' => $leadDto->jobTitle,\n 'remotely_created_at' => $leadDto->createdAt,\n ];\n\n $convertedLeadData = $this->processConvertedLead($crmEntityRepo, $leadDto);\n $leadData = array_merge($leadData, $convertedLeadData);\n\n $this->logger->info('[integration-app] Importing lead', [\n 'crm_provider_id' => $leadDto->externalId,\n 'name' => $leadDto->primaryEmail,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $lead = $crmEntityRepo->importLead($this->config, $leadData);\n\n $this->dispatchLeadConvertedEvent($lead);\n\n return $lead;\n }\n\n private function processConvertedLead(CrmEntityRepository $crmEntityRepo, DTO\\Lead $leadDto): array\n {\n if (! $leadDto->isConverted()) {\n return [];\n }\n\n $leadData = [\n 'converted_at' => $leadDto->getConvertedAt(),\n ];\n\n $this->decorateWithConvertedContact($crmEntityRepo, $leadDto, $leadData);\n $this->decorateWithConvertedAccount($crmEntityRepo, $leadDto, $leadData);\n $this->decorateWithConvertedOpportunity($crmEntityRepo, $leadDto, $leadData);\n\n return $leadData;\n }\n\n private function dispatchLeadConvertedEvent(Lead $lead): void\n {\n if ($lead->wasChanged('converted_at') && $lead->getConvertedAt() !== null) {\n event(new LeadConverted($lead));\n }\n }\n\n private function decorateWithConvertedContact(\n CrmEntityRepository $crmEntityRepo,\n DTO\\Lead $leadDto,\n array &$leadData\n ): void {\n if ($leadDto->getConvertedContactId() !== null) {\n $convertedContact = $crmEntityRepo->findContactByExternalId(\n $this->config,\n $leadDto->getConvertedContactId()\n );\n\n if ($convertedContact === null) {\n try {\n $convertedContact = $this->syncContact($leadDto->getConvertedContactId());\n } catch (\\Exception $exception) {\n $this->logger->error('[integration-app] Error syncing converted contact', [\n 'lead_id' => $leadDto->getExternalId(),\n 'crm_provider_id' => $leadDto->getConvertedContactId(),\n 'error' => $exception->getMessage(),\n ]);\n }\n }\n\n $leadData['converted_contact_id'] = $convertedContact?->getId();\n }\n }\n\n private function decorateWithConvertedAccount(\n CrmEntityRepository $crmEntityRepo,\n DTO\\Lead $leadDto,\n array &$leadData\n ): void {\n if ($leadDto->getConvertedAccountId() !== null) {\n $convertedAccount = $crmEntityRepo->findAccountByExternalId(\n $this->config,\n $leadDto->getConvertedAccountId()\n );\n\n if ($convertedAccount === null) {\n try {\n $convertedAccount = $this->syncAccount($leadDto->getConvertedAccountId());\n } catch (\\Exception $exception) {\n $this->logger->error('[integration-app] Error syncing converted account', [\n 'lead_id' => $leadDto->getExternalId(),\n 'crm_provider_id' => $leadDto->getConvertedAccountId(),\n 'error' => $exception->getMessage(),\n ]);\n }\n }\n\n $leadData['converted_account_id'] = $convertedAccount?->getId();\n }\n }\n\n private function decorateWithConvertedOpportunity(\n CrmEntityRepository $crmEntityRepo,\n DTO\\Lead $leadDto,\n array &$leadData\n ): void {\n if ($leadDto->getConvertedOpportunityId() !== null) {\n $convertedOpportunity = $crmEntityRepo->findOpportunityByExternalId(\n $this->config,\n $leadDto->getConvertedOpportunityId()\n );\n\n if ($convertedOpportunity === null) {\n try {\n $convertedOpportunity = $this->syncOpportunity($leadDto->getConvertedOpportunityId());\n } catch (\\Exception $exception) {\n $this->logger->error('[integration-app] Error syncing converted opportunity', [\n 'lead_id' => $leadDto->getExternalId(),\n 'crm_provider_id' => $leadDto->getConvertedOpportunityId(),\n 'error' => $exception->getMessage(),\n ]);\n }\n }\n\n $leadData['converted_opportunity_id'] = $convertedOpportunity?->getId();\n }\n }\n\n /**\n * @throws GuzzleException\n */\n public function importStages(?array $types = null, ?string $missingStageName = null): ?Stage\n {\n if (! $this->editionConfig->supportsStages()) {\n return null;\n }\n\n $missingStage = null;\n $stagesCollection = $this->client->getAllDealsStages();\n foreach ($stagesCollection as $eachStage) {\n $stage = $this->importStage($eachStage);\n\n if ($stage->getName() === $missingStageName) {\n $missingStage = $stage;\n }\n }\n\n return $missingStage;\n }\n\n private function importStage(DTO\\EntityStage $stageDto): Stage\n {\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $objectType = $stageDto->type ?? Stage::TYPE_OPPORTUNITY;\n\n $stageData = [\n 'crm_provider_id' => $stageDto->externalId,\n 'name' => mb_strimwidth($stageDto->apiName ?? $stageDto->name, 0, 50),\n 'label' => mb_strimwidth($stageDto->masterLabel ?? $stageDto->name, 0, 191),\n 'sequence' => $stageDto->sortOrder ?? 0,\n 'probability' => $stageDto->defaultProbability ?? null,\n 'is_selectable' => $stageDto->isActive ?? 0,\n 'type' => $objectType,\n ];\n\n $this->logger->info('[integration-app] Importing stage', [\n 'crm_provider_id' => $stageDto->externalId,\n 'name' => $stageDto->name,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $stage = $crmEntityRepo->importStage($this->config, $objectType, $stageData);\n\n // Include newly imported stages to the map\n $this->mapExternalStage($stage);\n\n return $stage;\n }\n\n /**\n * Attach a stage to a default business process.\n * This method is used only in Zoho implementation\n * where both supportsPipelines and supportsPipelines are false\n */\n public function syncBusinessProcessStages(int $stageId): void\n {\n /** @var StageRepository $stageRepository */\n $stageRepository = app(StageRepository::class);\n $processName = 'DefaultOpportunityProcess';\n $data = [\n 'team_id' => $this->team->getId(),\n 'name' => $processName,\n 'type' => Stage::TYPE_OPPORTUNITY,\n 'is_selectable' => true,\n ];\n\n $businessProcess = $stageRepository->findOrCreateBusinessProcess(\n $this->config,\n $processName,\n $data\n );\n\n $businessProcess->stages()->attach($stageId);\n }\n\n /**\n * bool $matchFromOtherCrm\n * When inserting a deal match try to match it to an existing from other CRM within the same team.\n * - This parameter is intended to be manually used only. It will help with\n * matching older opportunities if the team is transitioning from one CRM provider to another.\n */\n private function upsertOpportunity(DTO\\Opportunity $opportunityDto, bool $matchFromOtherCrm = false): ?Opportunity\n {\n $this->logger->info('[integration-app] Importing opportunity', [\n 'crm_provider_id' => $opportunityDto->externalId,\n 'team_id' => $this->team->getId(),\n ]);\n\n if ($this->config === null) {\n $this->logger->warning('[integration-app] Opportunity missing config');\n\n return null;\n }\n\n $stageId = $this->findOpportunityStageId(\n externalStageId: $opportunityDto->stageId,\n stageName: $opportunityDto->stageName\n );\n\n // temporary detect memory usage\n $this->logger->info('[integration-app] Stage ID', [\n 'memory_usage' => memory_get_usage(),\n 'memory_real_usage' => memory_get_usage(true),\n 'crm_provider_id' => $opportunityDto->externalId,\n 'stage_id' => $stageId,\n ]);\n\n $accountId = $this->findAccountId(\n pivotEntityId: $opportunityDto->externalId,\n externalAccountId: $opportunityDto->accountId,\n externalContactId: $opportunityDto->contactId,\n );\n\n $this->logger->info('[integration-app] Account ID', [\n 'memory_usage' => memory_get_usage(),\n 'memory_real_usage' => memory_get_usage(true),\n 'crm_provider_id' => $opportunityDto->externalId,\n 'account_id' => $accountId,\n ]);\n\n if ($stageId === null || $accountId === null) {\n $this->logger->warning('[integration-app] Opportunity missing data', [\n 'stageId' => $stageId,\n 'accountId' => $accountId,\n 'externalId' => $opportunityDto->externalId,\n ]);\n\n return null;\n }\n\n $userId = $this->findMappedUserId(externalUserId: $opportunityDto->ownerId);\n\n $data = [\n 'crm_provider_id' => $opportunityDto->externalId,\n 'team_id' => $this->team->getId(),\n 'account_id' => $accountId,\n 'user_id' => $userId,\n 'owner_id' => $opportunityDto->ownerId,\n 'name' => mb_strimwidth($opportunityDto->name, 0, 128),\n 'value' => $opportunityDto->amount,\n 'currency_code' => CurrencyFormatter::formatCode($this->getCurrencyIso($opportunityDto)),\n 'close_date' => $opportunityDto->closeDate,\n 'is_closed' => $opportunityDto->closed,\n 'is_won' => $opportunityDto->won,\n 'stage_id' => $stageId,\n 'record_type_id' => null,\n 'remotely_created_at' => $opportunityDto->createdAt,\n 'probability' => $opportunityDto->probability,\n ];\n\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $opportunity = $crmEntityRepo->importOpportunity(\n $this->config,\n $data,\n $matchFromOtherCrm,\n $opportunityDto->name,\n );\n\n // Import external fields into crm_field_data if present\n $crmFields = $this->getOpportunitySyncableFields();\n $this->importOpportunityFieldData($opportunityDto, $crmFields, $opportunity->getId());\n\n if ($opportunityDto->deleted === true) {\n $opportunity->delete();\n\n return $opportunity;\n }\n\n if ($opportunity->wasRecentlyCreated) {\n MatchActivitiesToNewOpportunity::dispatch($opportunity->getId());\n }\n\n return $opportunity;\n }\n\n private function findOpportunityStageId(?string $externalStageId, ?string $stageName): ?int\n {\n $stageId = null;\n\n if ($this->editionConfig->supportsStages()) {\n $stageId = $this->findMappedStageId(externalStageId: $externalStageId, type: Stage::TYPE_OPPORTUNITY);\n\n if ($stageId === null) {\n $stageId = $this->importStages(types: [Stage::TYPE_OPPORTUNITY], missingStageName: $stageName)?->id;\n }\n }\n\n if ($stageId === null && $stageName !== null) {\n $stageId = $this->syncStageByNameOnly(\n configuration: $this->config,\n stageName: $stageName,\n type: Stage::TYPE_OPPORTUNITY\n )?->id;\n }\n\n return $stageId;\n }\n\n private function importOpportunityFieldData(\n DTO\\Opportunity $opportunityDto,\n array $crmFields,\n int $opportunityId\n ): void {\n /** @var FieldRepository $fieldRepository */\n $fieldRepository = app(FieldRepository::class);\n /** @var FieldDataRepository $fieldDataRepository */\n $fieldDataRepository = app(FieldDataRepository::class);\n\n foreach ($crmFields as $crmField) {\n if (! property_exists($opportunityDto, $crmField)) {\n continue;\n }\n\n if ($opportunityDto->{$crmField} === null) {\n continue;\n }\n\n $field = $fieldRepository->findFieldByCrmIdAndObjectType(\n $this->config,\n $crmField,\n Field::OBJECT_OPPORTUNITY\n );\n\n if (! $field instanceof Field) {\n $this->logger->info('Field not found', [\n 'field' => $crmField,\n 'config' => $this->config->getId(),\n ]);\n\n continue;\n }\n\n $entities = $field->getEntities();\n if ($entities->isEmpty()) {\n $this->logger->info('Field has no entities', [\n 'field' => $crmField,\n 'config' => $this->config->getId(),\n ]);\n\n continue;\n }\n\n if ($entities->count() > 1) {\n $this->logger->info('Field has multiple entities', [\n 'field' => $crmField,\n 'config' => $this->config->getId(),\n ]);\n\n continue;\n }\n\n /** @var LayoutEntity|null $entity */\n $entity = $entities->first();\n if (! $entity instanceof LayoutEntity) {\n continue;\n }\n\n $value = (string) $opportunityDto->{$crmField};\n\n $fieldDataRepository->updateOrCreateFieldData(\n $entity,\n $opportunityId,\n $value,\n );\n }\n }\n\n private function getCurrencyIso(DTO\\Opportunity $opportunityDto): ?string\n {\n if ($opportunityDto->currencyIso !== null) {\n return $opportunityDto->currencyIso;\n }\n\n // Fallback to billing currency\n return $this->config->getDefaultCurrency();\n }\n\n /**\n * Some CRM providers do not support listing all stages.\n * Additionally, they may not even supply us with a stage ID when the stage is supplied as a property of the deal.\n * In that case, we will usually have only a stage name.\n * In order to import such stages only once, we will slugify them and produce \"external ID\" on our own.\n */\n private function syncStageByNameOnly(Configuration $configuration, string $stageName, ?string $type = null): ?Stage\n {\n // @TEMP For testing purposes only!!!\n // Revert when we find suitable way to fetch the stage\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $stage = $crmEntityRepo->getStageForName($configuration, $stageName, $type);\n if ($stage !== null) {\n return $stage;\n }\n\n // if there is other legitimate way to fetch the stage skip.\n if ($this->editionConfig->supportsPipelines() ||\n $this->editionConfig->supportsStages()\n ) {\n return null;\n }\n\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $stage = $crmEntityRepo->getStageForName($configuration, $stageName, $type);\n\n // Create the stage if it does not exist already\n if ($stage === null) {\n $stageDto = new DTO\\EntityStage();\n $stageDto->externalId = $stageName;\n $stageDto->masterLabel = Str::slug($stageName);\n $stageDto->name = $stageName;\n\n $stageDto->type = $type;\n\n $stage = $this->importStage($stageDto);\n\n if ($type === Stage::TYPE_OPPORTUNITY) {\n $this->syncBusinessProcessStages($stage->getId());\n }\n }\n\n return $stage;\n }\n\n private function findAccountId(\n string $pivotEntityId,\n ?string $externalAccountId = null,\n ?string $externalContactId = null,\n bool $skipAccountSync = false,\n ): ?int {\n $accountId = $this->findMappedAccountId(\n pivotEntityId: $pivotEntityId,\n externalAccountId: $externalAccountId,\n skipAccountSync: $skipAccountSync,\n );\n\n if ($accountId !== null) {\n return $accountId;\n }\n\n /**\n * The deal probably does not have an Account assigned.\n * In order to not break the existing import, we will try to find a contact\n * and create an Account with the same data.\n */\n if (! empty($externalContactId)) {\n // In rare cases the contact's external id matches our account id, whe :(\n $this->logger->info('[integration-app] fallback Account', ['contact_id' => $externalContactId]);\n\n $accountId = $this->findMappedAccountId(\n pivotEntityId: $pivotEntityId,\n externalAccountId: $externalContactId,\n skipAccountSync: true,\n );\n\n if ($accountId !== null) {\n return $accountId;\n }\n\n $this->logger->info('[integration-app] create Account from Contact', ['contact_id' => $externalContactId]);\n $crmEntityRepo = app(CrmEntityRepository::class);\n\n $contact = $crmEntityRepo->findContactByExternalId($this->config, $externalContactId);\n if ($contact !== null) {\n return $this->createInternalAccountFromContact($contact)->getId();\n }\n }\n\n return null;\n }\n\n private function createInternalAccountFromContact(Contact $contact): Account\n {\n $this->logger->info('[integration-app] Create internal account from contact', [\n 'team_id' => $this->team?->getId(),\n 'contact_id' => $contact->getId(),\n 'crm_provider_id' => $contact->getCrmProviderId(),\n ]);\n\n $data = [\n 'crm_configuration_id' => $this->config->getId(),\n 'team_id' => $this->config->getTeamId(),\n 'crm_provider_id' => $contact->getCrmProviderId(),\n 'user_id' => $contact->getUserId(),\n 'owner_id' => $contact->getOwnerId(),\n 'name' => $contact->getName(),\n 'phone' => $contact->getPhone(),\n 'country_code' => $contact->getCountryCode(),\n 'remotely_created_at' => $contact->getRemotelyCreatedAt(),\n 'is_internal' => 1,\n ];\n\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $account = $crmEntityRepo->importAccount($this->config, $data);\n\n if ($contact->account_id === null) {\n $contact->account_id = $account->getId();\n $contact->save();\n }\n\n $this->mapExternalAccount($account);\n\n return $account;\n }\n\n private function batchSyncContacts(array $externalContactIds): void\n {\n $this->logger->info('[integration-app] Syncing batch contacts', [\n 'batch_contacts' => implode(',', $externalContactIds),\n 'team_id' => $this->team?->getId(),\n ]);\n\n /** IntegrationApp allows up to 100 IDs passed as a batch. */\n $chunkedContacts = array_chunk($externalContactIds, self::CHUNK_SIZE);\n foreach ($chunkedContacts as $contactGroup) {\n /** @var DTO\\Contact[] $pageResultData */\n foreach ($this->client->getBatchContactsById($contactGroup) as $pageResultData) {\n $externalAccounts = [];\n foreach ($pageResultData as $eachRecord) {\n $externalAccounts[] = $eachRecord->accountId ?? null;\n }\n\n $missingAccounts = $this->identifyMissingAccounts($externalAccounts);\n if (! empty($missingAccounts)) {\n $this->batchSyncAccounts($missingAccounts);\n }\n\n foreach ($pageResultData as $eachRecord) {\n $this->importContact($eachRecord);\n }\n }\n }\n }\n\n private function batchSyncAccounts(array $externalAccountIds): void\n {\n $this->logger->info('[integration-app] Syncing batch accounts', [\n 'batch_contacts' => implode(',', $externalAccountIds),\n 'team_id' => $this->team?->getId(),\n ]);\n\n /** IntegrationApp allows up to 100 IDs passed as a batch. */\n $chunkedAccounts = array_chunk($externalAccountIds, self::CHUNK_SIZE);\n foreach ($chunkedAccounts as $accountGroup) {\n /** @var DTO\\Account[] $pageResultData */\n foreach ($this->client->getBatchAccountsById($accountGroup) as $pageResultData) {\n foreach ($pageResultData as $eachRecord) {\n $this->importAccount($eachRecord);\n }\n }\n }\n }\n\n /**\n * Identify all contacts Ids, that are not found in our database.\n * Scoped to the current batch so memory and query cost scale with batch size,\n * not with tenant size.\n *\n * @param array<?string> $contacts\n *\n * @return list<string>\n */\n private function identifyMissingContacts(array $contacts): array\n {\n $wanted = array_values(array_unique(array_filter($contacts)));\n if ($wanted === []) {\n return [];\n }\n\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $existing = $crmEntityRepo->getExistingContactCrmIds($this->config, $wanted);\n\n return array_values(array_diff($wanted, $existing));\n }\n\n /**\n * Identify all account Ids, that are not found in our database.\n * Scoped to the current batch so memory and query cost scale with batch size,\n * not with tenant size.\n *\n * @param array<?string> $accounts\n *\n * @return list<string>\n */\n private function identifyMissingAccounts(array $accounts): array\n {\n $wanted = array_values(array_unique(array_filter($accounts)));\n if ($wanted === []) {\n return [];\n }\n\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $existing = $crmEntityRepo->getExistingAccountCrmIds($this->config, $wanted);\n\n return array_values(array_diff($wanted, $existing));\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\IntegrationApp\\ServiceTraits;\n\nuse Carbon\\Carbon;\nuse GuzzleHttp\\Exception\\GuzzleException;\nuse GuzzleHttp\\Exception\\RequestException;\nuse Illuminate\\Support\\Str;\nuse Jiminny\\Events\\Activities\\Crm\\LeadConverted;\nuse Jiminny\\Models\\Contact;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\LayoutEntity;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Opportunity;\nuse Jiminny\\Models\\Stage;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\Account;\nuse Jiminny\\Jobs\\Crm\\MatchActivitiesToNewOpportunity;\nuse Jiminny\\Repositories\\Crm\\CrmEntityRepository;\nuse Jiminny\\Repositories\\Crm\\FieldDataRepository;\nuse Jiminny\\Repositories\\Crm\\FieldRepository;\nuse Jiminny\\Repositories\\Crm\\StageRepository;\nuse Jiminny\\Services\\Crm\\IntegrationApp\\Config\\IntegrationConfigInterface as IntegrationConfig;\nuse Jiminny\\Services\\Crm\\IntegrationApp\\DTO;\nuse Jiminny\\Services\\Crm\\IntegrationApp\\DataClient;\nuse Jiminny\\Services\\Crm\\OpportunitySyncStrategyResolver;\nuse Jiminny\\Utils\\CurrencyFormatter;\nuse Psr\\Log\\LoggerInterface;\n\n/**\n * This trait follows closely the contract SyncCrmEntitiesInterface\n */\ntrait SyncCrmEntitiesTrait\n{\n use ExternalMapsTrait;\n\n private const int CHUNK_SIZE = 100;\n\n public ?Team $team = null;\n public ?Configuration $config;\n public ?IntegrationConfig $editionConfig;\n protected LoggerInterface $logger;\n /**\n * @var DataClient\n */\n protected $client;\n\n public function syncAllAccounts(): int\n {\n $count = 0;\n foreach ($this->client->getAllAccounts() as $eachAccount) {\n $this->importAccount($eachAccount);\n $count++;\n }\n\n return $count;\n }\n\n public function syncAccounts(Carbon $since, ?Carbon $to = null): int\n {\n $count = 0;\n $this->logger->info('[integration-app] Syncing accounts', [\n 'since' => $since,\n 'to' => $to,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $params = [\n 'since' => $since,\n 'to' => $to,\n ];\n\n /** @var DTO\\Account $eachAccount*/\n foreach ($this->client->getFilteredAccounts($params) as $eachAccount) {\n $this->importAccount($eachAccount);\n $count++;\n }\n\n $this->logger->info('[integration-app] Syncing accounts finished successfully', [\n 'since' => $since,\n 'to' => $to,\n 'team_id' => $this->team?->getId(),\n ]);\n\n return $count;\n }\n\n public function syncAccount(string $crmId): ?Account\n {\n try {\n $accountDto = $this->client->getSingleAccount($crmId);\n if ($accountDto === null) {\n return null;\n }\n\n return $this->importAccount($accountDto);\n } catch (RequestException) {\n return null;\n }\n }\n\n private function importAccount(DTO\\Account $accountDto): Account\n {\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $data = [\n 'crm_provider_id' => $accountDto->externalId,\n 'user_id' => $this->findMappedUserId($accountDto->ownerId),\n 'owner_id' => $accountDto->ownerId,\n 'name' => mb_substr($accountDto->name, 0, 191),\n 'phone' => $accountDto->phone !== null ? mb_substr($accountDto->phone, 0, 25) : null,\n 'industry' => $accountDto->industry !== null ? mb_substr($accountDto->industry, 0, 191) : null,\n 'domain' => $accountDto->websiteUrl !== null ? mb_substr($accountDto->websiteUrl, 0, 191) : null,\n 'country_code' => $accountDto->countryCode,\n 'remotely_created_at' => $accountDto->createdAt,\n ];\n\n $this->logger->info('[integration-app] Importing account', [\n 'crm_provider_id' => $accountDto->externalId,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $account = $crmEntityRepo->importAccount($this->getConfiguration(), $data);\n $this->mapExternalAccount($account);\n\n return $account;\n }\n\n // Sync multiple records.\n public function syncAllContacts(): int\n {\n $count = 0;\n foreach ($this->client->getAllContacts() as $eachContact) {\n // import contacts here\n $this->importContact(contactDto: $eachContact);\n $count++;\n }\n\n return $count;\n }\n\n public function syncContacts(Carbon $since, ?Carbon $to = null): int\n {\n $count = 0;\n $this->logger->info('[integration-app] Syncing contacts', [\n 'since' => $since,\n 'to' => $to,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $params = [\n 'since' => $since,\n 'to' => $to,\n ];\n\n foreach ($this->client->getFilteredContacts($params) as $eachContact) {\n $this->importContact($eachContact);\n $count++;\n }\n\n $this->logger->info('[integration-app] Syncing contacts finished successfully', [\n 'since' => $since,\n 'to' => $to,\n 'team_id' => $this->team?->getId(),\n ]);\n\n return $count;\n }\n\n // Sync single records.\n public function syncContact(string $crmId): ?Contact\n {\n try {\n $contactRecord = $this->client->getSingleContact($crmId);\n if ($contactRecord === null) {\n return null;\n }\n\n return $this->importContact($contactRecord);\n } catch (RequestException) {\n return null;\n }\n }\n\n private function importContact(DTO\\Contact $contactDto): ?Contact\n {\n $createInternalAccount = false;\n\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n\n $accountId = $this->findMappedAccountId(\n pivotEntityId: $contactDto->externalId,\n externalAccountId: $contactDto->accountId,\n );\n $userId = $this->findMappedUserId($contactDto->ownerId);\n\n if ($accountId === null) {\n $this->logger->info('[integration-app] Importing contact, but related account cannot be found', [\n 'crm_provider_id' => $contactDto->externalId,\n 'raw_account_id' => $contactDto->accountId,\n 'name' => $contactDto->fullName,\n 'user_id' => $userId,\n ]);\n\n $createInternalAccount = true;\n }\n\n $data = [\n 'user_id' => $userId,\n 'account_id' => $accountId,\n 'crm_provider_id' => $contactDto->externalId,\n 'owner_id' => $contactDto->ownerId,\n 'name' => $contactDto->fullName !== null ? mb_substr($contactDto->fullName, 0, 100) : null,\n 'title' => $contactDto->title !== null ? mb_substr($contactDto->title, 0, 100) : null,\n 'email' => $contactDto->primaryEmail !== null ? mb_substr($contactDto->primaryEmail, 0, 191) : null,\n 'phone' => $contactDto->phone !== null ? mb_substr($contactDto->phone, 0, 25) : null,\n 'mobile_phone' => $contactDto->mobilePhone !== null ? mb_substr($contactDto->mobilePhone, 0, 25) : null,\n 'country_code' => $contactDto->countryCode !== null ? mb_substr($contactDto->countryCode, 0, 2) : null,\n 'remotely_created_at' => $contactDto->createdAt,\n 'photo_path' => '',\n ];\n\n $this->logger->info('[integration-app] Importing contact', [\n 'crm_provider_id' => $contactDto->externalId,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $contact = $crmEntityRepo->importContact($this->getConfiguration(), $data);\n $this->mapExternalContact($contact);\n\n if ($createInternalAccount) {\n $this->createInternalAccountFromContact($contact)->getId();\n }\n\n return $contact;\n }\n\n /**\n * @param bool $matchFromOtherCrm - This parameter is intended to be manually used. It will help with\n * matching older opportunities if the team is transitioning from one CRM provider to another.\n */\n public function syncAllOpportunities(bool $matchFromOtherCrm = false): int\n {\n $count = 0;\n foreach ($this->client->getAllOpportunities() as $eachDeal) {\n $this->upsertOpportunity($eachDeal, $matchFromOtherCrm);\n $count++;\n }\n\n return $count;\n }\n\n public function syncOpportunities(array $parameters, ?string $strategy = null): int\n {\n $parameters['strategy'] = $strategy ?? OpportunitySyncStrategyResolver::LAST_MODIFIED_SYNC_OPPORTUNITY_STRATEGY;\n $count = 0;\n\n $this->logger->info('[integration-app] Syncing opportunities', [\n 'parameters' => $parameters,\n 'team_id' => $this->team?->getId(),\n ]);\n\n /** @var DTO\\Opportunity[] $pageResultData */\n foreach ($this->client->getFilteredOpportunities($parameters) as $pageResultData) {\n $externalAccounts = [];\n $externalContacts = [];\n\n foreach ($pageResultData as $eachRecord) {\n $externalAccounts[] = $eachRecord->accountId ?? null;\n $externalContacts[] = $eachRecord->contactId ?? null;\n }\n\n // Import missing contacts and account as early as possible\n $missingContacts = $this->identifyMissingContacts($externalContacts);\n if (! empty($missingContacts)) {\n $this->batchSyncContacts($missingContacts);\n }\n\n $missingAccounts = $this->identifyMissingAccounts($externalAccounts);\n if (! empty($missingAccounts)) {\n $this->batchSyncAccounts($missingAccounts);\n }\n\n foreach ($pageResultData as $eachRecord) {\n $this->upsertOpportunity($eachRecord);\n $count++;\n }\n }\n\n $this->logger->info('[integration-app] Syncing opportunities finished successfully', [\n 'parameters' => $parameters,\n 'team_id' => $this->team?->getId(),\n ]);\n\n return $count;\n }\n\n public function syncOpportunity(string $crmId): ?Opportunity\n {\n try {\n $opportunityRecord = $this->client->getSingleOpportunity($crmId);\n if ($opportunityRecord === null) {\n return null;\n }\n\n return $this->upsertOpportunity($opportunityRecord);\n } catch (RequestException) {\n return null;\n }\n }\n\n public function syncAllLeads(): int\n {\n if (isset($this->config->getSettings()['lead_sync_disabled'])) {\n $this->logger->info('[integration-app] Syncing leads disabled for the client', [\n 'team_id' => $this->team?->getId(),\n ]);\n\n return 0;\n }\n\n $count = 0;\n foreach ($this->client->getAllLeads() as $eachLead) {\n $this->importLead($eachLead);\n $count++;\n }\n\n return $count;\n }\n\n public function syncLeads(Carbon $since, ?Carbon $to = null, ?string $crmProfileId = null): int\n {\n if (isset($this->config->getSettings()['lead_sync_disabled'])) {\n $this->logger->info('[integration-app] Syncing leads disabled for the client', [\n 'team_id' => $this->team?->getId(),\n 'since' => $since,\n 'to' => $to,\n 'crm_profile_id' => $crmProfileId,\n ]);\n\n return 0;\n }\n\n $count = 0;\n $this->logger->info('[integration-app] Syncing leads', [\n 'since' => $since,\n 'to' => $to,\n 'crm_profile_id' => $crmProfileId,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $filterData = [\n 'since' => $since,\n 'to' => $to,\n 'crm_profile_id' => $crmProfileId,\n 'converted' => 'both',\n ];\n\n foreach ($this->client->getFilteredLeads($filterData) as $eachLead) {\n $this->importLead($eachLead);\n $count++;\n }\n\n $this->logger->info('[integration-app] Syncing leads finished successfully', [\n 'since' => $since,\n 'to' => $to,\n 'team_id' => $this->team?->getId(),\n ]);\n\n return $count;\n }\n\n public function syncLead(string $crmId): ?Lead\n {\n if (isset($this->config->getSettings()['lead_sync_disabled'])) {\n $this->logger->info('[integration-app] Syncing leads disabled for the client', [\n 'team_id' => $this->team?->getId(),\n 'crm_id' => $crmId,\n ]);\n\n return null;\n }\n\n try {\n $leadRecord = $this->client->getSingleAndConvertLead($crmId);\n if ($leadRecord === null) {\n return null;\n }\n\n return $this->importLead($leadRecord);\n } catch (RequestException) {\n return null;\n }\n }\n\n private function importLead(DTO\\Lead $leadDto): ?Lead\n {\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $userId = $this->findMappedUserId($leadDto->ownerId);\n\n $stage = null;\n if ($this->editionConfig->supportsStages()) {\n // Get the current stage.\n $stage = $crmEntityRepo->getStageForName(\n configuration: $this->config,\n name: $leadDto->status,\n type: Stage::TYPE_LEAD\n );\n }\n\n if ($stage === null && ! empty($leadDto->status)) {\n // Try to sync and import the lead stage by name only\n $stage = $this->syncStageByNameOnly($this->config, $leadDto->status, Stage::TYPE_LEAD);\n }\n\n $stageId = $stage?->id;\n\n $leadData = [\n 'team_id' => $this->team->getId(),\n 'crm_configuration_id' => $this->config->getId(),\n 'crm_provider_id' => $leadDto->externalId,\n 'name' => $leadDto->fullName,\n 'company' => $leadDto->companyName,\n 'owner_id' => $leadDto->ownerId,\n 'user_id' => $userId,\n 'stage_id' => $stageId,\n 'email' => $leadDto->primaryEmail,\n 'phone' => $leadDto->primaryPhone,\n 'mobile_phone' => $leadDto->secondaryPhone,\n 'title' => $leadDto->jobTitle,\n 'remotely_created_at' => $leadDto->createdAt,\n ];\n\n $convertedLeadData = $this->processConvertedLead($crmEntityRepo, $leadDto);\n $leadData = array_merge($leadData, $convertedLeadData);\n\n $this->logger->info('[integration-app] Importing lead', [\n 'crm_provider_id' => $leadDto->externalId,\n 'name' => $leadDto->primaryEmail,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $lead = $crmEntityRepo->importLead($this->config, $leadData);\n\n $this->dispatchLeadConvertedEvent($lead);\n\n return $lead;\n }\n\n private function processConvertedLead(CrmEntityRepository $crmEntityRepo, DTO\\Lead $leadDto): array\n {\n if (! $leadDto->isConverted()) {\n return [];\n }\n\n $leadData = [\n 'converted_at' => $leadDto->getConvertedAt(),\n ];\n\n $this->decorateWithConvertedContact($crmEntityRepo, $leadDto, $leadData);\n $this->decorateWithConvertedAccount($crmEntityRepo, $leadDto, $leadData);\n $this->decorateWithConvertedOpportunity($crmEntityRepo, $leadDto, $leadData);\n\n return $leadData;\n }\n\n private function dispatchLeadConvertedEvent(Lead $lead): void\n {\n if ($lead->wasChanged('converted_at') && $lead->getConvertedAt() !== null) {\n event(new LeadConverted($lead));\n }\n }\n\n private function decorateWithConvertedContact(\n CrmEntityRepository $crmEntityRepo,\n DTO\\Lead $leadDto,\n array &$leadData\n ): void {\n if ($leadDto->getConvertedContactId() !== null) {\n $convertedContact = $crmEntityRepo->findContactByExternalId(\n $this->config,\n $leadDto->getConvertedContactId()\n );\n\n if ($convertedContact === null) {\n try {\n $convertedContact = $this->syncContact($leadDto->getConvertedContactId());\n } catch (\\Exception $exception) {\n $this->logger->error('[integration-app] Error syncing converted contact', [\n 'lead_id' => $leadDto->getExternalId(),\n 'crm_provider_id' => $leadDto->getConvertedContactId(),\n 'error' => $exception->getMessage(),\n ]);\n }\n }\n\n $leadData['converted_contact_id'] = $convertedContact?->getId();\n }\n }\n\n private function decorateWithConvertedAccount(\n CrmEntityRepository $crmEntityRepo,\n DTO\\Lead $leadDto,\n array &$leadData\n ): void {\n if ($leadDto->getConvertedAccountId() !== null) {\n $convertedAccount = $crmEntityRepo->findAccountByExternalId(\n $this->config,\n $leadDto->getConvertedAccountId()\n );\n\n if ($convertedAccount === null) {\n try {\n $convertedAccount = $this->syncAccount($leadDto->getConvertedAccountId());\n } catch (\\Exception $exception) {\n $this->logger->error('[integration-app] Error syncing converted account', [\n 'lead_id' => $leadDto->getExternalId(),\n 'crm_provider_id' => $leadDto->getConvertedAccountId(),\n 'error' => $exception->getMessage(),\n ]);\n }\n }\n\n $leadData['converted_account_id'] = $convertedAccount?->getId();\n }\n }\n\n private function decorateWithConvertedOpportunity(\n CrmEntityRepository $crmEntityRepo,\n DTO\\Lead $leadDto,\n array &$leadData\n ): void {\n if ($leadDto->getConvertedOpportunityId() !== null) {\n $convertedOpportunity = $crmEntityRepo->findOpportunityByExternalId(\n $this->config,\n $leadDto->getConvertedOpportunityId()\n );\n\n if ($convertedOpportunity === null) {\n try {\n $convertedOpportunity = $this->syncOpportunity($leadDto->getConvertedOpportunityId());\n } catch (\\Exception $exception) {\n $this->logger->error('[integration-app] Error syncing converted opportunity', [\n 'lead_id' => $leadDto->getExternalId(),\n 'crm_provider_id' => $leadDto->getConvertedOpportunityId(),\n 'error' => $exception->getMessage(),\n ]);\n }\n }\n\n $leadData['converted_opportunity_id'] = $convertedOpportunity?->getId();\n }\n }\n\n /**\n * @throws GuzzleException\n */\n public function importStages(?array $types = null, ?string $missingStageName = null): ?Stage\n {\n if (! $this->editionConfig->supportsStages()) {\n return null;\n }\n\n $missingStage = null;\n $stagesCollection = $this->client->getAllDealsStages();\n foreach ($stagesCollection as $eachStage) {\n $stage = $this->importStage($eachStage);\n\n if ($stage->getName() === $missingStageName) {\n $missingStage = $stage;\n }\n }\n\n return $missingStage;\n }\n\n private function importStage(DTO\\EntityStage $stageDto): Stage\n {\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $objectType = $stageDto->type ?? Stage::TYPE_OPPORTUNITY;\n\n $stageData = [\n 'crm_provider_id' => $stageDto->externalId,\n 'name' => mb_strimwidth($stageDto->apiName ?? $stageDto->name, 0, 50),\n 'label' => mb_strimwidth($stageDto->masterLabel ?? $stageDto->name, 0, 191),\n 'sequence' => $stageDto->sortOrder ?? 0,\n 'probability' => $stageDto->defaultProbability ?? null,\n 'is_selectable' => $stageDto->isActive ?? 0,\n 'type' => $objectType,\n ];\n\n $this->logger->info('[integration-app] Importing stage', [\n 'crm_provider_id' => $stageDto->externalId,\n 'name' => $stageDto->name,\n 'team_id' => $this->team?->getId(),\n ]);\n\n $stage = $crmEntityRepo->importStage($this->config, $objectType, $stageData);\n\n // Include newly imported stages to the map\n $this->mapExternalStage($stage);\n\n return $stage;\n }\n\n /**\n * Attach a stage to a default business process.\n * This method is used only in Zoho implementation\n * where both supportsPipelines and supportsPipelines are false\n */\n public function syncBusinessProcessStages(int $stageId): void\n {\n /** @var StageRepository $stageRepository */\n $stageRepository = app(StageRepository::class);\n $processName = 'DefaultOpportunityProcess';\n $data = [\n 'team_id' => $this->team->getId(),\n 'name' => $processName,\n 'type' => Stage::TYPE_OPPORTUNITY,\n 'is_selectable' => true,\n ];\n\n $businessProcess = $stageRepository->findOrCreateBusinessProcess(\n $this->config,\n $processName,\n $data\n );\n\n $businessProcess->stages()->attach($stageId);\n }\n\n /**\n * bool $matchFromOtherCrm\n * When inserting a deal match try to match it to an existing from other CRM within the same team.\n * - This parameter is intended to be manually used only. It will help with\n * matching older opportunities if the team is transitioning from one CRM provider to another.\n */\n private function upsertOpportunity(DTO\\Opportunity $opportunityDto, bool $matchFromOtherCrm = false): ?Opportunity\n {\n $this->logger->info('[integration-app] Importing opportunity', [\n 'crm_provider_id' => $opportunityDto->externalId,\n 'team_id' => $this->team->getId(),\n ]);\n\n if ($this->config === null) {\n $this->logger->warning('[integration-app] Opportunity missing config');\n\n return null;\n }\n\n $stageId = $this->findOpportunityStageId(\n externalStageId: $opportunityDto->stageId,\n stageName: $opportunityDto->stageName\n );\n\n // temporary detect memory usage\n $this->logger->info('[integration-app] Stage ID', [\n 'memory_usage' => memory_get_usage(),\n 'memory_real_usage' => memory_get_usage(true),\n 'crm_provider_id' => $opportunityDto->externalId,\n 'stage_id' => $stageId,\n ]);\n\n $accountId = $this->findAccountId(\n pivotEntityId: $opportunityDto->externalId,\n externalAccountId: $opportunityDto->accountId,\n externalContactId: $opportunityDto->contactId,\n );\n\n $this->logger->info('[integration-app] Account ID', [\n 'memory_usage' => memory_get_usage(),\n 'memory_real_usage' => memory_get_usage(true),\n 'crm_provider_id' => $opportunityDto->externalId,\n 'account_id' => $accountId,\n ]);\n\n if ($stageId === null || $accountId === null) {\n $this->logger->warning('[integration-app] Opportunity missing data', [\n 'stageId' => $stageId,\n 'accountId' => $accountId,\n 'externalId' => $opportunityDto->externalId,\n ]);\n\n return null;\n }\n\n $userId = $this->findMappedUserId(externalUserId: $opportunityDto->ownerId);\n\n $data = [\n 'crm_provider_id' => $opportunityDto->externalId,\n 'team_id' => $this->team->getId(),\n 'account_id' => $accountId,\n 'user_id' => $userId,\n 'owner_id' => $opportunityDto->ownerId,\n 'name' => mb_strimwidth($opportunityDto->name, 0, 128),\n 'value' => $opportunityDto->amount,\n 'currency_code' => CurrencyFormatter::formatCode($this->getCurrencyIso($opportunityDto)),\n 'close_date' => $opportunityDto->closeDate,\n 'is_closed' => $opportunityDto->closed,\n 'is_won' => $opportunityDto->won,\n 'stage_id' => $stageId,\n 'record_type_id' => null,\n 'remotely_created_at' => $opportunityDto->createdAt,\n 'probability' => $opportunityDto->probability,\n ];\n\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $opportunity = $crmEntityRepo->importOpportunity(\n $this->config,\n $data,\n $matchFromOtherCrm,\n $opportunityDto->name,\n );\n\n // Import external fields into crm_field_data if present\n $crmFields = $this->getOpportunitySyncableFields();\n $this->importOpportunityFieldData($opportunityDto, $crmFields, $opportunity->getId());\n\n if ($opportunityDto->deleted === true) {\n $opportunity->delete();\n\n return $opportunity;\n }\n\n if ($opportunity->wasRecentlyCreated) {\n MatchActivitiesToNewOpportunity::dispatch($opportunity->getId());\n }\n\n return $opportunity;\n }\n\n private function findOpportunityStageId(?string $externalStageId, ?string $stageName): ?int\n {\n $stageId = null;\n\n if ($this->editionConfig->supportsStages()) {\n $stageId = $this->findMappedStageId(externalStageId: $externalStageId, type: Stage::TYPE_OPPORTUNITY);\n\n if ($stageId === null) {\n $stageId = $this->importStages(types: [Stage::TYPE_OPPORTUNITY], missingStageName: $stageName)?->id;\n }\n }\n\n if ($stageId === null && $stageName !== null) {\n $stageId = $this->syncStageByNameOnly(\n configuration: $this->config,\n stageName: $stageName,\n type: Stage::TYPE_OPPORTUNITY\n )?->id;\n }\n\n return $stageId;\n }\n\n private function importOpportunityFieldData(\n DTO\\Opportunity $opportunityDto,\n array $crmFields,\n int $opportunityId\n ): void {\n /** @var FieldRepository $fieldRepository */\n $fieldRepository = app(FieldRepository::class);\n /** @var FieldDataRepository $fieldDataRepository */\n $fieldDataRepository = app(FieldDataRepository::class);\n\n foreach ($crmFields as $crmField) {\n if (! property_exists($opportunityDto, $crmField)) {\n continue;\n }\n\n if ($opportunityDto->{$crmField} === null) {\n continue;\n }\n\n $field = $fieldRepository->findFieldByCrmIdAndObjectType(\n $this->config,\n $crmField,\n Field::OBJECT_OPPORTUNITY\n );\n\n if (! $field instanceof Field) {\n $this->logger->info('Field not found', [\n 'field' => $crmField,\n 'config' => $this->config->getId(),\n ]);\n\n continue;\n }\n\n $entities = $field->getEntities();\n if ($entities->isEmpty()) {\n $this->logger->info('Field has no entities', [\n 'field' => $crmField,\n 'config' => $this->config->getId(),\n ]);\n\n continue;\n }\n\n if ($entities->count() > 1) {\n $this->logger->info('Field has multiple entities', [\n 'field' => $crmField,\n 'config' => $this->config->getId(),\n ]);\n\n continue;\n }\n\n /** @var LayoutEntity|null $entity */\n $entity = $entities->first();\n if (! $entity instanceof LayoutEntity) {\n continue;\n }\n\n $value = (string) $opportunityDto->{$crmField};\n\n $fieldDataRepository->updateOrCreateFieldData(\n $entity,\n $opportunityId,\n $value,\n );\n }\n }\n\n private function getCurrencyIso(DTO\\Opportunity $opportunityDto): ?string\n {\n if ($opportunityDto->currencyIso !== null) {\n return $opportunityDto->currencyIso;\n }\n\n // Fallback to billing currency\n return $this->config->getDefaultCurrency();\n }\n\n /**\n * Some CRM providers do not support listing all stages.\n * Additionally, they may not even supply us with a stage ID when the stage is supplied as a property of the deal.\n * In that case, we will usually have only a stage name.\n * In order to import such stages only once, we will slugify them and produce \"external ID\" on our own.\n */\n private function syncStageByNameOnly(Configuration $configuration, string $stageName, ?string $type = null): ?Stage\n {\n // @TEMP For testing purposes only!!!\n // Revert when we find suitable way to fetch the stage\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $stage = $crmEntityRepo->getStageForName($configuration, $stageName, $type);\n if ($stage !== null) {\n return $stage;\n }\n\n // if there is other legitimate way to fetch the stage skip.\n if ($this->editionConfig->supportsPipelines() ||\n $this->editionConfig->supportsStages()\n ) {\n return null;\n }\n\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $stage = $crmEntityRepo->getStageForName($configuration, $stageName, $type);\n\n // Create the stage if it does not exist already\n if ($stage === null) {\n $stageDto = new DTO\\EntityStage();\n $stageDto->externalId = $stageName;\n $stageDto->masterLabel = Str::slug($stageName);\n $stageDto->name = $stageName;\n\n $stageDto->type = $type;\n\n $stage = $this->importStage($stageDto);\n\n if ($type === Stage::TYPE_OPPORTUNITY) {\n $this->syncBusinessProcessStages($stage->getId());\n }\n }\n\n return $stage;\n }\n\n private function findAccountId(\n string $pivotEntityId,\n ?string $externalAccountId = null,\n ?string $externalContactId = null,\n bool $skipAccountSync = false,\n ): ?int {\n $accountId = $this->findMappedAccountId(\n pivotEntityId: $pivotEntityId,\n externalAccountId: $externalAccountId,\n skipAccountSync: $skipAccountSync,\n );\n\n if ($accountId !== null) {\n return $accountId;\n }\n\n /**\n * The deal probably does not have an Account assigned.\n * In order to not break the existing import, we will try to find a contact\n * and create an Account with the same data.\n */\n if (! empty($externalContactId)) {\n // In rare cases the contact's external id matches our account id, whe :(\n $this->logger->info('[integration-app] fallback Account', ['contact_id' => $externalContactId]);\n\n $accountId = $this->findMappedAccountId(\n pivotEntityId: $pivotEntityId,\n externalAccountId: $externalContactId,\n skipAccountSync: true,\n );\n\n if ($accountId !== null) {\n return $accountId;\n }\n\n $this->logger->info('[integration-app] create Account from Contact', ['contact_id' => $externalContactId]);\n $crmEntityRepo = app(CrmEntityRepository::class);\n\n $contact = $crmEntityRepo->findContactByExternalId($this->config, $externalContactId);\n if ($contact !== null) {\n return $this->createInternalAccountFromContact($contact)->getId();\n }\n }\n\n return null;\n }\n\n private function createInternalAccountFromContact(Contact $contact): Account\n {\n $this->logger->info('[integration-app] Create internal account from contact', [\n 'team_id' => $this->team?->getId(),\n 'contact_id' => $contact->getId(),\n 'crm_provider_id' => $contact->getCrmProviderId(),\n ]);\n\n $data = [\n 'crm_configuration_id' => $this->config->getId(),\n 'team_id' => $this->config->getTeamId(),\n 'crm_provider_id' => $contact->getCrmProviderId(),\n 'user_id' => $contact->getUserId(),\n 'owner_id' => $contact->getOwnerId(),\n 'name' => $contact->getName(),\n 'phone' => $contact->getPhone(),\n 'country_code' => $contact->getCountryCode(),\n 'remotely_created_at' => $contact->getRemotelyCreatedAt(),\n 'is_internal' => 1,\n ];\n\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $account = $crmEntityRepo->importAccount($this->config, $data);\n\n if ($contact->account_id === null) {\n $contact->account_id = $account->getId();\n $contact->save();\n }\n\n $this->mapExternalAccount($account);\n\n return $account;\n }\n\n private function batchSyncContacts(array $externalContactIds): void\n {\n $this->logger->info('[integration-app] Syncing batch contacts', [\n 'batch_contacts' => implode(',', $externalContactIds),\n 'team_id' => $this->team?->getId(),\n ]);\n\n /** IntegrationApp allows up to 100 IDs passed as a batch. */\n $chunkedContacts = array_chunk($externalContactIds, self::CHUNK_SIZE);\n foreach ($chunkedContacts as $contactGroup) {\n /** @var DTO\\Contact[] $pageResultData */\n foreach ($this->client->getBatchContactsById($contactGroup) as $pageResultData) {\n $externalAccounts = [];\n foreach ($pageResultData as $eachRecord) {\n $externalAccounts[] = $eachRecord->accountId ?? null;\n }\n\n $missingAccounts = $this->identifyMissingAccounts($externalAccounts);\n if (! empty($missingAccounts)) {\n $this->batchSyncAccounts($missingAccounts);\n }\n\n foreach ($pageResultData as $eachRecord) {\n $this->importContact($eachRecord);\n }\n }\n }\n }\n\n private function batchSyncAccounts(array $externalAccountIds): void\n {\n $this->logger->info('[integration-app] Syncing batch accounts', [\n 'batch_contacts' => implode(',', $externalAccountIds),\n 'team_id' => $this->team?->getId(),\n ]);\n\n /** IntegrationApp allows up to 100 IDs passed as a batch. */\n $chunkedAccounts = array_chunk($externalAccountIds, self::CHUNK_SIZE);\n foreach ($chunkedAccounts as $accountGroup) {\n /** @var DTO\\Account[] $pageResultData */\n foreach ($this->client->getBatchAccountsById($accountGroup) as $pageResultData) {\n foreach ($pageResultData as $eachRecord) {\n $this->importAccount($eachRecord);\n }\n }\n }\n }\n\n /**\n * Identify all contacts Ids, that are not found in our database.\n * Scoped to the current batch so memory and query cost scale with batch size,\n * not with tenant size.\n *\n * @param array<?string> $contacts\n *\n * @return list<string>\n */\n private function identifyMissingContacts(array $contacts): array\n {\n $wanted = array_values(array_unique(array_filter($contacts)));\n if ($wanted === []) {\n return [];\n }\n\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $existing = $crmEntityRepo->getExistingContactCrmIds($this->config, $wanted);\n\n return array_values(array_diff($wanted, $existing));\n }\n\n /**\n * Identify all account Ids, that are not found in our database.\n * Scoped to the current batch so memory and query cost scale with batch size,\n * not with tenant size.\n *\n * @param array<?string> $accounts\n *\n * @return list<string>\n */\n private function identifyMissingAccounts(array $accounts): array\n {\n $wanted = array_values(array_unique(array_filter($accounts)));\n if ($wanted === []) {\n return [];\n }\n\n /** @var CrmEntityRepository $crmEntityRepo */\n $crmEntityRepo = app(CrmEntityRepository::class);\n $existing = $crmEntityRepo->getExistingAccountCrmIds($this->config, $wanted);\n\n return array_values(array_diff($wanted, $existing));\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"app ~/jiminny/app","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".circleci","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".cursor","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".github","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".sonarlint","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".vscode, folder","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".windsurf","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"app, sources root","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Actions","depth":8,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Component","depth":8,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Acl","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ActionItems, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Activity, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ActivityAnalytics","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ActivitySearch","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AiActivityType, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AiAutomation, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AiCallScoring, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AskAnything","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Dtos","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Events","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AskAnythingPromptService.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"HistoryService.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AskJiminnyAi","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AWS","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BillingManagement","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Cache","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CoachingFeedback","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Country, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CustomerApi, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Database, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Datadog, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DateTime, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DealInsights, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DealRisks","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ElasticSearch","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Eloquent","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Encoding","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Encryption","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ES","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Faker","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FeatureFlags","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FFMpeg","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FileSystem","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Gecko","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Gong","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"GuzzleHttp","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"KeyPoints","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Kiosk","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"LanguageDetection","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"LiveFeed","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Locks","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Math","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MediaPipeline","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MeetingBot","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MobileSettings, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Model, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Notification, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Nudge","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ParagraphBreaker","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ParticipantSpeech","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"PartitionedCookie","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"PlaybackPage","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Playlist","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Prophet","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ProphetAi, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ProsperWorks","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Queue","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Job","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RateLimitAware.php, abstract class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RateLimitAwareWrapper.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BotsQueueConstants.php","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Constants.php","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ProcessingQueueConstants.php","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Router, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Saml2","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SCIM","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Seeder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Sentry","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Serializer","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Settings","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Sidekick","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Slack","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"TeamInsights, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"TimeMemoryMapper, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Transcription","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"TranscriptionSummary","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Twilio","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Uploader","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"UrlGenerator","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Utility","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Exceptions","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Service","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BaseRateLimiter.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"EfficientJsonParser.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ProviderRateLimiter.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RateLimiterInstance.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Uuid","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Waveform","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Webhooks","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Workflow","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Configuration","depth":8,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Console, folder","depth":8,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Commands","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Activities","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Analytics","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Calendars","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Crm","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Hubspot","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IntegrationApp","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Traits","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AddLayoutEntities.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AutologDelayedCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BullhornCommandAbstract.php, abstract class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BullhornPingCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BullhornSearchCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BullhornSessionCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CheckActivityLoggableCommand.php, final class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CleanDuplicateFieldDataCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FullSyncOpportunityCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"LogActivitiesCommand.php, final class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ManageSyncStrategyCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MatchCrmObjectsCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MatchOpportunityActivitiesCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MigrateProvider.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ProcessHubspotObjectsSyncBatches.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"PurgeDeletedOpportunitiesCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ResetGovernorLimits.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SendNotLogged.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SetupActivityTypeForFollowUp.php, final class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SetupCloseCrm.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SetupCopperCrm.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SetupCrmCommand.php, abstract class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SetupLayouts.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncAccount.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncContact.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncFieldMetadata.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncHubspotActiveDeals.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncHubspotObjects.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncLead.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncObjects.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncOpportunitiesMissingFieldDataCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncOpportunity.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncProfileMetadata.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncTeamMetadata.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"UpdateOpportunitySpecifications.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DealInsights","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Dev","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AddRateLimitCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FixHubSpotTokens.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FixMissMatchedCrmActivitiesCommand.php, final class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ImportCallsCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MonitorSocialAccountsState.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Dialers","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DTOs","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Elasticsearch","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"EngagementStats","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"GeckoExport","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Livestream","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Mailboxes","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Migrate","depth":10,"on_screen":false,"role_description":"text"}]...
|
-8041922121792796695
|
4110884608029145632
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
Analyzing…
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\IntegrationApp\ServiceTraits;
use Carbon\Carbon;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Support\Str;
use Jiminny\Events\Activities\Crm\LeadConverted;
use Jiminny\Models\Contact;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\LayoutEntity;
use Jiminny\Models\Lead;
use Jiminny\Models\Opportunity;
use Jiminny\Models\Stage;
use Jiminny\Models\Team;
use Jiminny\Models\Account;
use Jiminny\Jobs\Crm\MatchActivitiesToNewOpportunity;
use Jiminny\Repositories\Crm\CrmEntityRepository;
use Jiminny\Repositories\Crm\FieldDataRepository;
use Jiminny\Repositories\Crm\FieldRepository;
use Jiminny\Repositories\Crm\StageRepository;
use Jiminny\Services\Crm\IntegrationApp\Config\IntegrationConfigInterface as IntegrationConfig;
use Jiminny\Services\Crm\IntegrationApp\DTO;
use Jiminny\Services\Crm\IntegrationApp\DataClient;
use Jiminny\Services\Crm\OpportunitySyncStrategyResolver;
use Jiminny\Utils\CurrencyFormatter;
use Psr\Log\LoggerInterface;
/**
* This trait follows closely the contract SyncCrmEntitiesInterface
*/
trait SyncCrmEntitiesTrait
{
use ExternalMapsTrait;
private const int CHUNK_SIZE = 100;
public ?Team $team = null;
public ?Configuration $config;
public ?IntegrationConfig $editionConfig;
protected LoggerInterface $logger;
/**
* @var DataClient
*/
protected $client;
public function syncAllAccounts(): int
{
$count = 0;
foreach ($this->client->getAllAccounts() as $eachAccount) {
$this->importAccount($eachAccount);
$count++;
}
return $count;
}
public function syncAccounts(Carbon $since, ?Carbon $to = null): int
{
$count = 0;
$this->logger->info('[integration-app] Syncing accounts', [
'since' => $since,
'to' => $to,
'team_id' => $this->team?->getId(),
]);
$params = [
'since' => $since,
'to' => $to,
];
/** @var DTO\Account $eachAccount*/
foreach ($this->client->getFilteredAccounts($params) as $eachAccount) {
$this->importAccount($eachAccount);
$count++;
}
$this->logger->info('[integration-app] Syncing accounts finished successfully', [
'since' => $since,
'to' => $to,
'team_id' => $this->team?->getId(),
]);
return $count;
}
public function syncAccount(string $crmId): ?Account
{
try {
$accountDto = $this->client->getSingleAccount($crmId);
if ($accountDto === null) {
return null;
}
return $this->importAccount($accountDto);
} catch (RequestException) {
return null;
}
}
private function importAccount(DTO\Account $accountDto): Account
{
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$data = [
'crm_provider_id' => $accountDto->externalId,
'user_id' => $this->findMappedUserId($accountDto->ownerId),
'owner_id' => $accountDto->ownerId,
'name' => mb_substr($accountDto->name, 0, 191),
'phone' => $accountDto->phone !== null ? mb_substr($accountDto->phone, 0, 25) : null,
'industry' => $accountDto->industry !== null ? mb_substr($accountDto->industry, 0, 191) : null,
'domain' => $accountDto->websiteUrl !== null ? mb_substr($accountDto->websiteUrl, 0, 191) : null,
'country_code' => $accountDto->countryCode,
'remotely_created_at' => $accountDto->createdAt,
];
$this->logger->info('[integration-app] Importing account', [
'crm_provider_id' => $accountDto->externalId,
'team_id' => $this->team?->getId(),
]);
$account = $crmEntityRepo->importAccount($this->getConfiguration(), $data);
$this->mapExternalAccount($account);
return $account;
}
// Sync multiple records.
public function syncAllContacts(): int
{
$count = 0;
foreach ($this->client->getAllContacts() as $eachContact) {
// import contacts here
$this->importContact(contactDto: $eachContact);
$count++;
}
return $count;
}
public function syncContacts(Carbon $since, ?Carbon $to = null): int
{
$count = 0;
$this->logger->info('[integration-app] Syncing contacts', [
'since' => $since,
'to' => $to,
'team_id' => $this->team?->getId(),
]);
$params = [
'since' => $since,
'to' => $to,
];
foreach ($this->client->getFilteredContacts($params) as $eachContact) {
$this->importContact($eachContact);
$count++;
}
$this->logger->info('[integration-app] Syncing contacts finished successfully', [
'since' => $since,
'to' => $to,
'team_id' => $this->team?->getId(),
]);
return $count;
}
// Sync single records.
public function syncContact(string $crmId): ?Contact
{
try {
$contactRecord = $this->client->getSingleContact($crmId);
if ($contactRecord === null) {
return null;
}
return $this->importContact($contactRecord);
} catch (RequestException) {
return null;
}
}
private function importContact(DTO\Contact $contactDto): ?Contact
{
$createInternalAccount = false;
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$accountId = $this->findMappedAccountId(
pivotEntityId: $contactDto->externalId,
externalAccountId: $contactDto->accountId,
);
$userId = $this->findMappedUserId($contactDto->ownerId);
if ($accountId === null) {
$this->logger->info('[integration-app] Importing contact, but related account cannot be found', [
'crm_provider_id' => $contactDto->externalId,
'raw_account_id' => $contactDto->accountId,
'name' => $contactDto->fullName,
'user_id' => $userId,
]);
$createInternalAccount = true;
}
$data = [
'user_id' => $userId,
'account_id' => $accountId,
'crm_provider_id' => $contactDto->externalId,
'owner_id' => $contactDto->ownerId,
'name' => $contactDto->fullName !== null ? mb_substr($contactDto->fullName, 0, 100) : null,
'title' => $contactDto->title !== null ? mb_substr($contactDto->title, 0, 100) : null,
'email' => $contactDto->primaryEmail !== null ? mb_substr($contactDto->primaryEmail, 0, 191) : null,
'phone' => $contactDto->phone !== null ? mb_substr($contactDto->phone, 0, 25) : null,
'mobile_phone' => $contactDto->mobilePhone !== null ? mb_substr($contactDto->mobilePhone, 0, 25) : null,
'country_code' => $contactDto->countryCode !== null ? mb_substr($contactDto->countryCode, 0, 2) : null,
'remotely_created_at' => $contactDto->createdAt,
'photo_path' => '',
];
$this->logger->info('[integration-app] Importing contact', [
'crm_provider_id' => $contactDto->externalId,
'team_id' => $this->team?->getId(),
]);
$contact = $crmEntityRepo->importContact($this->getConfiguration(), $data);
$this->mapExternalContact($contact);
if ($createInternalAccount) {
$this->createInternalAccountFromContact($contact)->getId();
}
return $contact;
}
/**
* @param bool $matchFromOtherCrm - This parameter is intended to be manually used. It will help with
* matching older opportunities if the team is transitioning from one CRM provider to another.
*/
public function syncAllOpportunities(bool $matchFromOtherCrm = false): int
{
$count = 0;
foreach ($this->client->getAllOpportunities() as $eachDeal) {
$this->upsertOpportunity($eachDeal, $matchFromOtherCrm);
$count++;
}
return $count;
}
public function syncOpportunities(array $parameters, ?string $strategy = null): int
{
$parameters['strategy'] = $strategy ?? OpportunitySyncStrategyResolver::LAST_MODIFIED_SYNC_OPPORTUNITY_STRATEGY;
$count = 0;
$this->logger->info('[integration-app] Syncing opportunities', [
'parameters' => $parameters,
'team_id' => $this->team?->getId(),
]);
/** @var DTO\Opportunity[] $pageResultData */
foreach ($this->client->getFilteredOpportunities($parameters) as $pageResultData) {
$externalAccounts = [];
$externalContacts = [];
foreach ($pageResultData as $eachRecord) {
$externalAccounts[] = $eachRecord->accountId ?? null;
$externalContacts[] = $eachRecord->contactId ?? null;
}
// Import missing contacts and account as early as possible
$missingContacts = $this->identifyMissingContacts($externalContacts);
if (! empty($missingContacts)) {
$this->batchSyncContacts($missingContacts);
}
$missingAccounts = $this->identifyMissingAccounts($externalAccounts);
if (! empty($missingAccounts)) {
$this->batchSyncAccounts($missingAccounts);
}
foreach ($pageResultData as $eachRecord) {
$this->upsertOpportunity($eachRecord);
$count++;
}
}
$this->logger->info('[integration-app] Syncing opportunities finished successfully', [
'parameters' => $parameters,
'team_id' => $this->team?->getId(),
]);
return $count;
}
public function syncOpportunity(string $crmId): ?Opportunity
{
try {
$opportunityRecord = $this->client->getSingleOpportunity($crmId);
if ($opportunityRecord === null) {
return null;
}
return $this->upsertOpportunity($opportunityRecord);
} catch (RequestException) {
return null;
}
}
public function syncAllLeads(): int
{
if (isset($this->config->getSettings()['lead_sync_disabled'])) {
$this->logger->info('[integration-app] Syncing leads disabled for the client', [
'team_id' => $this->team?->getId(),
]);
return 0;
}
$count = 0;
foreach ($this->client->getAllLeads() as $eachLead) {
$this->importLead($eachLead);
$count++;
}
return $count;
}
public function syncLeads(Carbon $since, ?Carbon $to = null, ?string $crmProfileId = null): int
{
if (isset($this->config->getSettings()['lead_sync_disabled'])) {
$this->logger->info('[integration-app] Syncing leads disabled for the client', [
'team_id' => $this->team?->getId(),
'since' => $since,
'to' => $to,
'crm_profile_id' => $crmProfileId,
]);
return 0;
}
$count = 0;
$this->logger->info('[integration-app] Syncing leads', [
'since' => $since,
'to' => $to,
'crm_profile_id' => $crmProfileId,
'team_id' => $this->team?->getId(),
]);
$filterData = [
'since' => $since,
'to' => $to,
'crm_profile_id' => $crmProfileId,
'converted' => 'both',
];
foreach ($this->client->getFilteredLeads($filterData) as $eachLead) {
$this->importLead($eachLead);
$count++;
}
$this->logger->info('[integration-app] Syncing leads finished successfully', [
'since' => $since,
'to' => $to,
'team_id' => $this->team?->getId(),
]);
return $count;
}
public function syncLead(string $crmId): ?Lead
{
if (isset($this->config->getSettings()['lead_sync_disabled'])) {
$this->logger->info('[integration-app] Syncing leads disabled for the client', [
'team_id' => $this->team?->getId(),
'crm_id' => $crmId,
]);
return null;
}
try {
$leadRecord = $this->client->getSingleAndConvertLead($crmId);
if ($leadRecord === null) {
return null;
}
return $this->importLead($leadRecord);
} catch (RequestException) {
return null;
}
}
private function importLead(DTO\Lead $leadDto): ?Lead
{
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$userId = $this->findMappedUserId($leadDto->ownerId);
$stage = null;
if ($this->editionConfig->supportsStages()) {
// Get the current stage.
$stage = $crmEntityRepo->getStageForName(
configuration: $this->config,
name: $leadDto->status,
type: Stage::TYPE_LEAD
);
}
if ($stage === null && ! empty($leadDto->status)) {
// Try to sync and import the lead stage by name only
$stage = $this->syncStageByNameOnly($this->config, $leadDto->status, Stage::TYPE_LEAD);
}
$stageId = $stage?->id;
$leadData = [
'team_id' => $this->team->getId(),
'crm_configuration_id' => $this->config->getId(),
'crm_provider_id' => $leadDto->externalId,
'name' => $leadDto->fullName,
'company' => $leadDto->companyName,
'owner_id' => $leadDto->ownerId,
'user_id' => $userId,
'stage_id' => $stageId,
'email' => $leadDto->primaryEmail,
'phone' => $leadDto->primaryPhone,
'mobile_phone' => $leadDto->secondaryPhone,
'title' => $leadDto->jobTitle,
'remotely_created_at' => $leadDto->createdAt,
];
$convertedLeadData = $this->processConvertedLead($crmEntityRepo, $leadDto);
$leadData = array_merge($leadData, $convertedLeadData);
$this->logger->info('[integration-app] Importing lead', [
'crm_provider_id' => $leadDto->externalId,
'name' => $leadDto->primaryEmail,
'team_id' => $this->team?->getId(),
]);
$lead = $crmEntityRepo->importLead($this->config, $leadData);
$this->dispatchLeadConvertedEvent($lead);
return $lead;
}
private function processConvertedLead(CrmEntityRepository $crmEntityRepo, DTO\Lead $leadDto): array
{
if (! $leadDto->isConverted()) {
return [];
}
$leadData = [
'converted_at' => $leadDto->getConvertedAt(),
];
$this->decorateWithConvertedContact($crmEntityRepo, $leadDto, $leadData);
$this->decorateWithConvertedAccount($crmEntityRepo, $leadDto, $leadData);
$this->decorateWithConvertedOpportunity($crmEntityRepo, $leadDto, $leadData);
return $leadData;
}
private function dispatchLeadConvertedEvent(Lead $lead): void
{
if ($lead->wasChanged('converted_at') && $lead->getConvertedAt() !== null) {
event(new LeadConverted($lead));
}
}
private function decorateWithConvertedContact(
CrmEntityRepository $crmEntityRepo,
DTO\Lead $leadDto,
array &$leadData
): void {
if ($leadDto->getConvertedContactId() !== null) {
$convertedContact = $crmEntityRepo->findContactByExternalId(
$this->config,
$leadDto->getConvertedContactId()
);
if ($convertedContact === null) {
try {
$convertedContact = $this->syncContact($leadDto->getConvertedContactId());
} catch (\Exception $exception) {
$this->logger->error('[integration-app] Error syncing converted contact', [
'lead_id' => $leadDto->getExternalId(),
'crm_provider_id' => $leadDto->getConvertedContactId(),
'error' => $exception->getMessage(),
]);
}
}
$leadData['converted_contact_id'] = $convertedContact?->getId();
}
}
private function decorateWithConvertedAccount(
CrmEntityRepository $crmEntityRepo,
DTO\Lead $leadDto,
array &$leadData
): void {
if ($leadDto->getConvertedAccountId() !== null) {
$convertedAccount = $crmEntityRepo->findAccountByExternalId(
$this->config,
$leadDto->getConvertedAccountId()
);
if ($convertedAccount === null) {
try {
$convertedAccount = $this->syncAccount($leadDto->getConvertedAccountId());
} catch (\Exception $exception) {
$this->logger->error('[integration-app] Error syncing converted account', [
'lead_id' => $leadDto->getExternalId(),
'crm_provider_id' => $leadDto->getConvertedAccountId(),
'error' => $exception->getMessage(),
]);
}
}
$leadData['converted_account_id'] = $convertedAccount?->getId();
}
}
private function decorateWithConvertedOpportunity(
CrmEntityRepository $crmEntityRepo,
DTO\Lead $leadDto,
array &$leadData
): void {
if ($leadDto->getConvertedOpportunityId() !== null) {
$convertedOpportunity = $crmEntityRepo->findOpportunityByExternalId(
$this->config,
$leadDto->getConvertedOpportunityId()
);
if ($convertedOpportunity === null) {
try {
$convertedOpportunity = $this->syncOpportunity($leadDto->getConvertedOpportunityId());
} catch (\Exception $exception) {
$this->logger->error('[integration-app] Error syncing converted opportunity', [
'lead_id' => $leadDto->getExternalId(),
'crm_provider_id' => $leadDto->getConvertedOpportunityId(),
'error' => $exception->getMessage(),
]);
}
}
$leadData['converted_opportunity_id'] = $convertedOpportunity?->getId();
}
}
/**
* @throws GuzzleException
*/
public function importStages(?array $types = null, ?string $missingStageName = null): ?Stage
{
if (! $this->editionConfig->supportsStages()) {
return null;
}
$missingStage = null;
$stagesCollection = $this->client->getAllDealsStages();
foreach ($stagesCollection as $eachStage) {
$stage = $this->importStage($eachStage);
if ($stage->getName() === $missingStageName) {
$missingStage = $stage;
}
}
return $missingStage;
}
private function importStage(DTO\EntityStage $stageDto): Stage
{
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$objectType = $stageDto->type ?? Stage::TYPE_OPPORTUNITY;
$stageData = [
'crm_provider_id' => $stageDto->externalId,
'name' => mb_strimwidth($stageDto->apiName ?? $stageDto->name, 0, 50),
'label' => mb_strimwidth($stageDto->masterLabel ?? $stageDto->name, 0, 191),
'sequence' => $stageDto->sortOrder ?? 0,
'probability' => $stageDto->defaultProbability ?? null,
'is_selectable' => $stageDto->isActive ?? 0,
'type' => $objectType,
];
$this->logger->info('[integration-app] Importing stage', [
'crm_provider_id' => $stageDto->externalId,
'name' => $stageDto->name,
'team_id' => $this->team?->getId(),
]);
$stage = $crmEntityRepo->importStage($this->config, $objectType, $stageData);
// Include newly imported stages to the map
$this->mapExternalStage($stage);
return $stage;
}
/**
* Attach a stage to a default business process.
* This method is used only in Zoho implementation
* where both supportsPipelines and supportsPipelines are false
*/
public function syncBusinessProcessStages(int $stageId): void
{
/** @var StageRepository $stageRepository */
$stageRepository = app(StageRepository::class);
$processName = 'DefaultOpportunityProcess';
$data = [
'team_id' => $this->team->getId(),
'name' => $processName,
'type' => Stage::TYPE_OPPORTUNITY,
'is_selectable' => true,
];
$businessProcess = $stageRepository->findOrCreateBusinessProcess(
$this->config,
$processName,
$data
);
$businessProcess->stages()->attach($stageId);
}
/**
* bool $matchFromOtherCrm
* When inserting a deal match try to match it to an existing from other CRM within the same team.
* - This parameter is intended to be manually used only. It will help with
* matching older opportunities if the team is transitioning from one CRM provider to another.
*/
private function upsertOpportunity(DTO\Opportunity $opportunityDto, bool $matchFromOtherCrm = false): ?Opportunity
{
$this->logger->info('[integration-app] Importing opportunity', [
'crm_provider_id' => $opportunityDto->externalId,
'team_id' => $this->team->getId(),
]);
if ($this->config === null) {
$this->logger->warning('[integration-app] Opportunity missing config');
return null;
}
$stageId = $this->findOpportunityStageId(
externalStageId: $opportunityDto->stageId,
stageName: $opportunityDto->stageName
);
// temporary detect memory usage
$this->logger->info('[integration-app] Stage ID', [
'memory_usage' => memory_get_usage(),
'memory_real_usage' => memory_get_usage(true),
'crm_provider_id' => $opportunityDto->externalId,
'stage_id' => $stageId,
]);
$accountId = $this->findAccountId(
pivotEntityId: $opportunityDto->externalId,
externalAccountId: $opportunityDto->accountId,
externalContactId: $opportunityDto->contactId,
);
$this->logger->info('[integration-app] Account ID', [
'memory_usage' => memory_get_usage(),
'memory_real_usage' => memory_get_usage(true),
'crm_provider_id' => $opportunityDto->externalId,
'account_id' => $accountId,
]);
if ($stageId === null || $accountId === null) {
$this->logger->warning('[integration-app] Opportunity missing data', [
'stageId' => $stageId,
'accountId' => $accountId,
'externalId' => $opportunityDto->externalId,
]);
return null;
}
$userId = $this->findMappedUserId(externalUserId: $opportunityDto->ownerId);
$data = [
'crm_provider_id' => $opportunityDto->externalId,
'team_id' => $this->team->getId(),
'account_id' => $accountId,
'user_id' => $userId,
'owner_id' => $opportunityDto->ownerId,
'name' => mb_strimwidth($opportunityDto->name, 0, 128),
'value' => $opportunityDto->amount,
'currency_code' => CurrencyFormatter::formatCode($this->getCurrencyIso($opportunityDto)),
'close_date' => $opportunityDto->closeDate,
'is_closed' => $opportunityDto->closed,
'is_won' => $opportunityDto->won,
'stage_id' => $stageId,
'record_type_id' => null,
'remotely_created_at' => $opportunityDto->createdAt,
'probability' => $opportunityDto->probability,
];
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$opportunity = $crmEntityRepo->importOpportunity(
$this->config,
$data,
$matchFromOtherCrm,
$opportunityDto->name,
);
// Import external fields into crm_field_data if present
$crmFields = $this->getOpportunitySyncableFields();
$this->importOpportunityFieldData($opportunityDto, $crmFields, $opportunity->getId());
if ($opportunityDto->deleted === true) {
$opportunity->delete();
return $opportunity;
}
if ($opportunity->wasRecentlyCreated) {
MatchActivitiesToNewOpportunity::dispatch($opportunity->getId());
}
return $opportunity;
}
private function findOpportunityStageId(?string $externalStageId, ?string $stageName): ?int
{
$stageId = null;
if ($this->editionConfig->supportsStages()) {
$stageId = $this->findMappedStageId(externalStageId: $externalStageId, type: Stage::TYPE_OPPORTUNITY);
if ($stageId === null) {
$stageId = $this->importStages(types: [Stage::TYPE_OPPORTUNITY], missingStageName: $stageName)?->id;
}
}
if ($stageId === null && $stageName !== null) {
$stageId = $this->syncStageByNameOnly(
configuration: $this->config,
stageName: $stageName,
type: Stage::TYPE_OPPORTUNITY
)?->id;
}
return $stageId;
}
private function importOpportunityFieldData(
DTO\Opportunity $opportunityDto,
array $crmFields,
int $opportunityId
): void {
/** @var FieldRepository $fieldRepository */
$fieldRepository = app(FieldRepository::class);
/** @var FieldDataRepository $fieldDataRepository */
$fieldDataRepository = app(FieldDataRepository::class);
foreach ($crmFields as $crmField) {
if (! property_exists($opportunityDto, $crmField)) {
continue;
}
if ($opportunityDto->{$crmField} === null) {
continue;
}
$field = $fieldRepository->findFieldByCrmIdAndObjectType(
$this->config,
$crmField,
Field::OBJECT_OPPORTUNITY
);
if (! $field instanceof Field) {
$this->logger->info('Field not found', [
'field' => $crmField,
'config' => $this->config->getId(),
]);
continue;
}
$entities = $field->getEntities();
if ($entities->isEmpty()) {
$this->logger->info('Field has no entities', [
'field' => $crmField,
'config' => $this->config->getId(),
]);
continue;
}
if ($entities->count() > 1) {
$this->logger->info('Field has multiple entities', [
'field' => $crmField,
'config' => $this->config->getId(),
]);
continue;
}
/** @var LayoutEntity|null $entity */
$entity = $entities->first();
if (! $entity instanceof LayoutEntity) {
continue;
}
$value = (string) $opportunityDto->{$crmField};
$fieldDataRepository->updateOrCreateFieldData(
$entity,
$opportunityId,
$value,
);
}
}
private function getCurrencyIso(DTO\Opportunity $opportunityDto): ?string
{
if ($opportunityDto->currencyIso !== null) {
return $opportunityDto->currencyIso;
}
// Fallback to billing currency
return $this->config->getDefaultCurrency();
}
/**
* Some CRM providers do not support listing all stages.
* Additionally, they may not even supply us with a stage ID when the stage is supplied as a property of the deal.
* In that case, we will usually have only a stage name.
* In order to import such stages only once, we will slugify them and produce "external ID" on our own.
*/
private function syncStageByNameOnly(Configuration $configuration, string $stageName, ?string $type = null): ?Stage
{
// @TEMP For testing purposes only!!!
// Revert when we find suitable way to fetch the stage
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$stage = $crmEntityRepo->getStageForName($configuration, $stageName, $type);
if ($stage !== null) {
return $stage;
}
// if there is other legitimate way to fetch the stage skip.
if ($this->editionConfig->supportsPipelines() ||
$this->editionConfig->supportsStages()
) {
return null;
}
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$stage = $crmEntityRepo->getStageForName($configuration, $stageName, $type);
// Create the stage if it does not exist already
if ($stage === null) {
$stageDto = new DTO\EntityStage();
$stageDto->externalId = $stageName;
$stageDto->masterLabel = Str::slug($stageName);
$stageDto->name = $stageName;
$stageDto->type = $type;
$stage = $this->importStage($stageDto);
if ($type === Stage::TYPE_OPPORTUNITY) {
$this->syncBusinessProcessStages($stage->getId());
}
}
return $stage;
}
private function findAccountId(
string $pivotEntityId,
?string $externalAccountId = null,
?string $externalContactId = null,
bool $skipAccountSync = false,
): ?int {
$accountId = $this->findMappedAccountId(
pivotEntityId: $pivotEntityId,
externalAccountId: $externalAccountId,
skipAccountSync: $skipAccountSync,
);
if ($accountId !== null) {
return $accountId;
}
/**
* The deal probably does not have an Account assigned.
* In order to not break the existing import, we will try to find a contact
* and create an Account with the same data.
*/
if (! empty($externalContactId)) {
// In rare cases the contact's external id matches our account id, whe :(
$this->logger->info('[integration-app] fallback Account', ['contact_id' => $externalContactId]);
$accountId = $this->findMappedAccountId(
pivotEntityId: $pivotEntityId,
externalAccountId: $externalContactId,
skipAccountSync: true,
);
if ($accountId !== null) {
return $accountId;
}
$this->logger->info('[integration-app] create Account from Contact', ['contact_id' => $externalContactId]);
$crmEntityRepo = app(CrmEntityRepository::class);
$contact = $crmEntityRepo->findContactByExternalId($this->config, $externalContactId);
if ($contact !== null) {
return $this->createInternalAccountFromContact($contact)->getId();
}
}
return null;
}
private function createInternalAccountFromContact(Contact $contact): Account
{
$this->logger->info('[integration-app] Create internal account from contact', [
'team_id' => $this->team?->getId(),
'contact_id' => $contact->getId(),
'crm_provider_id' => $contact->getCrmProviderId(),
]);
$data = [
'crm_configuration_id' => $this->config->getId(),
'team_id' => $this->config->getTeamId(),
'crm_provider_id' => $contact->getCrmProviderId(),
'user_id' => $contact->getUserId(),
'owner_id' => $contact->getOwnerId(),
'name' => $contact->getName(),
'phone' => $contact->getPhone(),
'country_code' => $contact->getCountryCode(),
'remotely_created_at' => $contact->getRemotelyCreatedAt(),
'is_internal' => 1,
];
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$account = $crmEntityRepo->importAccount($this->config, $data);
if ($contact->account_id === null) {
$contact->account_id = $account->getId();
$contact->save();
}
$this->mapExternalAccount($account);
return $account;
}
private function batchSyncContacts(array $externalContactIds): void
{
$this->logger->info('[integration-app] Syncing batch contacts', [
'batch_contacts' => implode(',', $externalContactIds),
'team_id' => $this->team?->getId(),
]);
/** IntegrationApp allows up to 100 IDs passed as a batch. */
$chunkedContacts = array_chunk($externalContactIds, self::CHUNK_SIZE);
foreach ($chunkedContacts as $contactGroup) {
/** @var DTO\Contact[] $pageResultData */
foreach ($this->client->getBatchContactsById($contactGroup) as $pageResultData) {
$externalAccounts = [];
foreach ($pageResultData as $eachRecord) {
$externalAccounts[] = $eachRecord->accountId ?? null;
}
$missingAccounts = $this->identifyMissingAccounts($externalAccounts);
if (! empty($missingAccounts)) {
$this->batchSyncAccounts($missingAccounts);
}
foreach ($pageResultData as $eachRecord) {
$this->importContact($eachRecord);
}
}
}
}
private function batchSyncAccounts(array $externalAccountIds): void
{
$this->logger->info('[integration-app] Syncing batch accounts', [
'batch_contacts' => implode(',', $externalAccountIds),
'team_id' => $this->team?->getId(),
]);
/** IntegrationApp allows up to 100 IDs passed as a batch. */
$chunkedAccounts = array_chunk($externalAccountIds, self::CHUNK_SIZE);
foreach ($chunkedAccounts as $accountGroup) {
/** @var DTO\Account[] $pageResultData */
foreach ($this->client->getBatchAccountsById($accountGroup) as $pageResultData) {
foreach ($pageResultData as $eachRecord) {
$this->importAccount($eachRecord);
}
}
}
}
/**
* Identify all contacts Ids, that are not found in our database.
* Scoped to the current batch so memory and query cost scale with batch size,
* not with tenant size.
*
* @param array<?string> $contacts
*
* @return list<string>
*/
private function identifyMissingContacts(array $contacts): array
{
$wanted = array_values(array_unique(array_filter($contacts)));
if ($wanted === []) {
return [];
}
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$existing = $crmEntityRepo->getExistingContactCrmIds($this->config, $wanted);
return array_values(array_diff($wanted, $existing));
}
/**
* Identify all account Ids, that are not found in our database.
* Scoped to the current batch so memory and query cost scale with batch size,
* not with tenant size.
*
* @param array<?string> $accounts
*
* @return list<string>
*/
private function identifyMissingAccounts(array $accounts): array
{
$wanted = array_values(array_unique(array_filter($accounts)));
if ($wanted === []) {
return [];
}
/** @var CrmEntityRepository $crmEntityRepo */
$crmEntityRepo = app(CrmEntityRepository::class);
$existing = $crmEntityRepo->getExistingAccountCrmIds($this->config, $wanted);
return array_values(array_diff($wanted, $existing));
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide
app ~/jiminny/app
.circleci
.cursor
.github
.sonarlint
.vscode, folder
.windsurf
app, sources root
Actions
Component
Acl
ActionItems, folder
Activity, folder
ActivityAnalytics
ActivitySearch
AiActivityType, folder
AiAutomation, folder
AiCallScoring, folder
AskAnything
Dtos
Events
AskAnythingPromptService.php, class
HistoryService.php, class
AskJiminnyAi
AWS
BillingManagement
Cache
CoachingFeedback
Country, folder
CustomerApi, folder
Database, folder
Datadog, folder
DateTime, folder
DealInsights, folder
DealRisks
ElasticSearch
Eloquent
Encoding
Encryption
ES
Faker
FeatureFlags
FFMpeg
FileSystem
Gecko
Gong
GuzzleHttp
KeyPoints
Kiosk
LanguageDetection
LiveFeed
Locks
Math
MediaPipeline
MeetingBot
MobileSettings, folder
Model, folder
Notification, folder
Nudge
ParagraphBreaker
ParticipantSpeech
PartitionedCookie
PlaybackPage
Playlist
Prophet
ProphetAi, folder
ProsperWorks
Queue
Job
RateLimitAware.php, abstract class
RateLimitAwareWrapper.php, class
BotsQueueConstants.php
Constants.php
ProcessingQueueConstants.php
Router, folder
Saml2
SCIM
Seeder
Sentry
Serializer
Settings
Sidekick
Slack
TeamInsights, folder
TimeMemoryMapper, folder
Transcription
TranscriptionSummary
Twilio
Uploader
UrlGenerator
Utility
Exceptions
Service
BaseRateLimiter.php, class
EfficientJsonParser.php, class
ProviderRateLimiter.php, class
RateLimiterInstance.php, class
Uuid
Waveform
Webhooks
Workflow
Configuration
Console, folder
Commands
Activities
Analytics
Calendars
Crm
Hubspot
IntegrationApp
Traits
AddLayoutEntities.php, class
AutologDelayedCommand.php, class
BullhornCommandAbstract.php, abstract class
BullhornPingCommand.php, class
BullhornSearchCommand.php, class
BullhornSessionCommand.php, class
CheckActivityLoggableCommand.php, final class
CleanDuplicateFieldDataCommand.php, class
FullSyncOpportunityCommand.php, class
LogActivitiesCommand.php, final class
ManageSyncStrategyCommand.php, class
MatchCrmObjectsCommand.php, class
MatchOpportunityActivitiesCommand.php, class
MigrateProvider.php, class
ProcessHubspotObjectsSyncBatches.php, class
PurgeDeletedOpportunitiesCommand.php, class
ResetGovernorLimits.php, class
SendNotLogged.php, class
SetupActivityTypeForFollowUp.php, final class
SetupCloseCrm.php, class
SetupCopperCrm.php, class
SetupCrmCommand.php, abstract class
SetupLayouts.php, class
SyncAccount.php, class
SyncContact.php, class
SyncFieldMetadata.php, class
SyncHubspotActiveDeals.php, class
SyncHubspotObjects.php, class
SyncLead.php, class
SyncObjects.php, class
SyncOpportunitiesMissingFieldDataCommand.php, class
SyncOpportunity.php, class
SyncProfileMetadata.php, class
SyncTeamMetadata.php, class
UpdateOpportunitySpecifications.php, class
DealInsights
Dev
AddRateLimitCommand.php, class
FixHubSpotTokens.php, class
FixMissMatchedCrmActivitiesCommand.php, final class
ImportCallsCommand.php, class
MonitorSocialAccountsState.php, class
Dialers
DTOs
Elasticsearch
EngagementStats
GeckoExport
Livestream
Mailboxes
Migrate...
|
3065
|
NULL
|
NULL
|
NULL
|
|
21734
|
949
|
29
|
2026-05-11T18:20:15.454770+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778523615454_m2.jpg...
|
Finder
|
screenpipe
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
db.sqlite-shm
Today at 21:19
33 KB
Document
#recycle
Today at 20:55
62,68 GB
Folder
archive.db...
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Favourites","depth":6,"bounds":{"left":0.004654255,"top":0.061452515,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"jiminny","depth":6,"bounds":{"left":0.012632979,"top":0.08140463,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"AirDrop","depth":6,"bounds":{"left":0.012632979,"top":0.103751,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Recents","depth":6,"bounds":{"left":0.012632979,"top":0.12609737,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Applications","depth":6,"bounds":{"left":0.012632979,"top":0.14844373,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Documents","depth":6,"bounds":{"left":0.012632979,"top":0.1707901,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Downloads","depth":6,"bounds":{"left":0.012632979,"top":0.19313647,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"lukas","depth":6,"bounds":{"left":0.012632979,"top":0.21548285,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"iCloud","depth":6,"bounds":{"left":0.004654255,"top":0.2434158,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"iCloud Drive","depth":6,"bounds":{"left":0.012632979,"top":0.26336792,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sync folder","depth":6,"bounds":{"left":0.012632979,"top":0.2857143,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Locations","depth":6,"bounds":{"left":0.004654255,"top":0.31364724,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":6,"bounds":{"left":0.012632979,"top":0.33359936,"width":0.043218084,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Eject","depth":6,"bounds":{"left":0.05651596,"top":0.33519554,"width":0.0043218085,"height":0.009577015},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Network","depth":6,"bounds":{"left":0.012632979,"top":0.35594574,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Tags","depth":6,"bounds":{"left":0.004654255,"top":0.38387868,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"CRM","depth":6,"bounds":{"left":0.012632979,"top":0.4038308,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Orange","depth":6,"bounds":{"left":0.012632979,"top":0.42617717,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Red","depth":6,"bounds":{"left":0.012632979,"top":0.44852355,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Yellow","depth":6,"bounds":{"left":0.012632979,"top":0.4708699,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Green","depth":6,"bounds":{"left":0.012632979,"top":0.49321628,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Blue","depth":6,"bounds":{"left":0.012632979,"top":0.51556265,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Purple","depth":6,"bounds":{"left":0.012632979,"top":0.53790903,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"All Tags…","depth":6,"bounds":{"left":0.012632979,"top":0.5602554,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Name","depth":7,"bounds":{"left":0.08277926,"top":0.06624102,"width":0.011635638,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Date Modified","depth":7,"bounds":{"left":0.36569148,"top":0.06624102,"width":0.026928192,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Size","depth":7,"bounds":{"left":0.42586437,"top":0.06624102,"width":0.008976064,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Kind","depth":7,"bounds":{"left":0.4581117,"top":0.06624102,"width":0.00930851,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXTextField","text":"db.sqlite-shm","depth":7,"bounds":{"left":0.08277926,"top":0.08938547,"width":0.030585106,"height":0.012769354},"on_screen":true,"value":"db.sqlite-shm","role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Today at 21:19","depth":7,"bounds":{"left":0.36569148,"top":0.08938547,"width":0.056848403,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"33 KB","depth":7,"bounds":{"left":0.44115692,"top":0.08938547,"width":0.013630319,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Document","depth":7,"bounds":{"left":0.4581117,"top":0.08938547,"width":0.023603724,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXTextField","text":"#recycle","depth":7,"bounds":{"left":0.08277926,"top":0.105347164,"width":0.019946808,"height":0.012769354},"on_screen":true,"value":"#recycle","role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Today at 20:55","depth":7,"bounds":{"left":0.36569148,"top":0.105347164,"width":0.056848403,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"62,68 GB","depth":7,"bounds":{"left":0.43417552,"top":0.105347164,"width":0.020611702,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":7,"bounds":{"left":0.4581117,"top":0.105347164,"width":0.014295213,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXTextField","text":"archive.db","depth":7,"bounds":{"left":0.08277926,"top":0.121308856,"width":0.023936171,"height":0.012769354},"on_screen":true,"value":"archive.db","role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false}]...
|
-8040258568523007862
|
-2126766882572435556
|
visual_change
|
accessibility
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
db.sqlite-shm
Today at 21:19
33 KB
Document
#recycle
Today at 20:55
62,68 GB
Folder
archive.db...
|
21733
|
NULL
|
NULL
|
NULL
|
|
1515
|
60
|
8
|
2026-05-07T08:50:35.220553+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778143835220_m2.jpg...
|
PhpStorm
|
faVsco.js – DeleteCrmEntityTrait.php
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Code changed:
Hide
Sync Changes
Hide This Notification
37
1
35
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
Sync Changes
Hide This Notification
Code changed:
Hide
2
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Jobs\Crm\Delete;
use Illuminate\Events\Dispatcher;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Jiminny\Enums\CrmObject;
use Jiminny\Events\Crm\DetachActivityObject;
use Jiminny\Models\Activity;
use Psr\Log\LoggerInterface;
use Throwable;
trait DeleteCrmEntityTrait
{
public int $tries = 3;
public function timeout(): int
{
return 300; // 5 minutes
}
public function backoff(): array
{
return [30, 90, 180]; // 30 seconds, 1.5 minutes, 3 minutes
}
protected function handleActivities(
Collection $activities,
Dispatcher $dispatcher,
LoggerInterface $logger,
bool $emitEvent = true,
): void {
if ($activities->isEmpty()) {
return;
}
$crmObject = $this->getEntityType();
$entityIdField = $crmObject->value . '_id';
$activities->each(
function (Activity $activity) use ($dispatcher, $logger, $entityIdField, $crmObject, $emitEvent): void {
$stageId = $activity->getStage()?->getId();
$logData = [
$crmObject->value => $this->id,
'activity' => $activity->getId(),
'emitEvent' => $emitEvent,
];
$updateData = [
$entityIdField => null,
];
// For leads and opportunities, also nullify the stage_id
if ($stageId && in_array($crmObject, [CrmObject::LEAD, CrmObject::OPPORTUNITY], true)) {
$updateData['stage_id'] = null;
$logData['stage_id'] = $stageId;
}
$activity->update($updateData);
if ($emitEvent) {
$dispatcher->dispatch(new DetachActivityObject($activity, $crmObject));
}
$logger->info($this->getLogPrefix() . ' Detach from activity', $logData);
// Dispatch job to verify if CRM task/event still exists
if ($activity->hasCrmProviderId()) {
VerifyActivityCrmTaskJob::dispatch($activity->getId());
}
}
);
}
public function failed(Throwable $exception): void
{
$crmObject = $this->getEntityType();
Log::critical($this->getLogPrefix() . ' Job failed permanently', [
$crmObject->value => $this->id,
'exception' => $exception->getMessage(),
]);
}
// Abstract methods that must be implemented by the using class
abstract protected function getLogPrefix(): string;
abstract protected function getEntityType(): CrmObject;
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide
app ~/jiminny/app
.circleci
.cursor
.github
.sonarlint
.vscode
.windsurf
app, sources root
Actions
Component
Acl, folder
ActionItems, folder
Activity, folder
ActivityAnalytics, folder
ActivitySearch, folder
AiActivityType, folder
AiAutomation, folder
AiCallScoring, folder
AskAnything, folder
Dtos, folder
Events, folder
AskAnythingPromptService.php, class
HistoryService.php, class
AskJiminnyAi, folder
AWS, folder
BillingManagement, folder
Cache, folder
CoachingFeedback, folder
Country, folder
CustomerApi, folder
Database, folder
Datadog, folder
DateTime, folder
DealInsights, folder
DealRisks, folder
ElasticSearch, folder
Eloquent, folder
Encoding, folder
Encryption, folder
ES, folder
Faker, folder
FeatureFlags, folder
FFMpeg, folder
FileSystem, folder
Gecko, folder
Gong, folder
GuzzleHttp, folder
KeyPoints, folder
Kiosk, folder
LanguageDetection, folder
LiveFeed, folder
Locks, folder
Math, folder
MediaPipeline, folder
MeetingBot, folder
MobileSettings, folder
Model, folder
Notification, folder
Nudge, folder
ParagraphBreaker, folder
ParticipantSpeech, folder
PartitionedCookie, folder
PlaybackPage, folder
Playlist, folder
Prophet, folder
ProphetAi, folder
ProsperWorks, folder
Queue
Job
RateLimitAware.php, abstract class
RateLimitAwareWrapper.php, class
BotsQueueConstants.php, class
Constants.php, class
ProcessingQueueConstants.php, class
Router
Saml2
SCIM
Seeder
Sentry
Serializer
Settings
Sidekick
Slack
TeamInsights
TimeMemoryMapper
Transcription
TranscriptionSummary
Twilio
Uploader
UrlGenerator
Utility
Exceptions
Service
BaseRateLimiter.php, class
EfficientJsonParser.php, class
ProviderRateLimiter.php, class
RateLimiterInstance.php, class
Uuid
Waveform
Webhooks
Workflow
Configuration
Console
Commands
Activities
Analytics
Calendars
Crm
Hubspot
IntegrationApp
Traits
AddLayoutEntities.php, class
AutologDelayedCommand.php, class
BullhornCommandAbstract.php, abstract class
BullhornPingCommand.php, class
BullhornSearchCommand.php, class
BullhornSessionCommand.php, class
CheckActivityLoggableCommand.php, final class
CleanDuplicateFieldDataCommand.php, class
FullSyncOpportunityCommand.php, class
LogActivitiesCommand.php, final class
ManageSyncStrategyCommand.php, class
MatchCrmObjectsCommand.php, class
MatchOpportunityActivitiesCommand.php, class
MigrateProvider.php, class
ProcessHubspotObjectsSyncBatches.php, class
PurgeDeletedOpportunitiesCommand.php, class
ResetGovernorLimits.php, class
SendNotLogged.php, class
SetupActivityTypeForFollowUp.php, final class
SetupCloseCrm.php, class
SetupCopperCrm.php, class
SetupCrmCommand.php, abstract class
SetupLayouts.php, class
SyncAccount.php, class
SyncContact.php, class
SyncFieldMetadata.php, class
SyncHubspotActiveDeals.php, class
SyncHubspotObjects.php, class
SyncLead.php, class
SyncObjects.php, class
SyncOpportunitiesMissingFieldDataCommand.php, class
SyncOpportunity.php, class
SyncProfileMetadata.php, class
SyncTeamMetadata.php, class
UpdateOpportunitySpecifications.php, class
DealInsights
Dev
AddRateLimitCommand.php, class
FixHubSpotTokens.php, class
FixMissMatchedCrmActivitiesCommand.php, final class
ImportCallsCommand.php, class
MonitorSocialAccountsState.php, class
Dialers
DTOs
Elasticsearch
EngagementStats
GeckoExport
Livestream
Mailboxes
Migrate
PlaybackThemes
Playbooks
Playlists
Postmark
ProphetAi
Reports
AutomatedReportsCommand.php, class
AutomatedReportsRetentionPolicyCommand.php, class
AutomatedReportsSendCommand.php, class
CreateMockAskJiminnyReportResultCommand.php, class
DeleteReportCommand.php, class
GenerateMarketingReport.php, class
Team.php, class
Usage.php, class
Slack
Teams
Tracks
Transcription
Twilio
Users
Vocabulary
Zoom
Command.php, class
CreateDatabaseUsers.php, class
DatabaseTableCount.php, class
DeleteOldAiCrmNotesCommand.php, class
DeleteS3LeftoversCommand.php, class
DevPostmanCommand.php, final class
DiarizeViaAiParticipantIdentificationCommand.php, class
EncryptTokensCommand.php, class
EngagementStatsRegenerateCommand.php, class
FeatureFlagsHelper.php
FixCrossTenantIssues.php, class
FlushRolesPermissionsCache.php, class
GenerateInternalWebhookToken.php, class
GroupSetDefaultLanguageCommand.php, final class
HelperTruncateCoachingTables.php, class
HubspotJournalPollingCommand.php, class
HubspotWebhookServiceCommand.php, class
ImportRecording.php, class
ImportUsersFromCsvFile.php, final class
IterateUsersCommand.php, abstract class
JiminnyCacheClearCommand.php, class
JiminnyDebugCommand.php, class
JiminnySetEncryptedTokenManagerModeCommand.php, class
JiminnyTokenInfoCommand.php, class
MakeSlackLiveCoachingChatNotesOn.php, class
ManageScimForTeam.php, class
MarkBranchForEnvironmentPipelineCommand.php, class
MuteOrganizerChannel.php, class
PhpApm.php, class
PropagateCoachingFeedbackCreatedAtToSectionFeedbacks.php, class
PurgeConferences.php, class
PurgeSoftDeletedOpportunitiesCommand.php, class
PurgeSyncBatchesCommand.php, class
RecalculateDealRisksCommand.php, class
RemoveDeleteMarkersCommand.php, class
RemoveExpiredNudgesCommand.php, class
RemoveUnusedParticipantSpeechesCommand.php, class
ResetElasticSearch.php, class
RestoreActivityCrmProviderIdCommand.php, class
RestoreActivityTypeCommand.php, class
RunAiCallScoringForUntypedActivitiesCommand.php, class
SeedActivities.php, class
SendNudgeExpirationWarningsCommand.php, class
SyncActivity.php, class
TrackImported.php, class
WhichWorkerIsWorkingOnWhichJob.php, class
Scheduling
Kernel.php, class
Contracts
Acl
ActivitySearch
AiAutomation
Crm
DateTime
ES
Http
Requests
ApiResponse.php, interface
RateLimited.php, interface
RateLimitInterface.php, interface...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.034242023,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.38297874,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.39162233,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.40259308,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.4112367,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.41988033,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.43085107,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.4418218,"top":0.09896249,"width":0.024268618,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.46841756,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.4793883,"top":0.09896249,"width":0.029587766,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.65359044,"top":0.09896249,"width":0.02825798,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"37","depth":4,"bounds":{"left":0.62333775,"top":0.123703115,"width":0.009973404,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.6353058,"top":0.123703115,"width":0.00731383,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"35","depth":4,"bounds":{"left":0.64461434,"top":0.123703115,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"64","depth":4,"bounds":{"left":0.6569149,"top":0.123703115,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.66888297,"top":0.12210695,"width":0.00731383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.6761968,"top":0.12210695,"width":0.006981383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;","depth":4,"on_screen":true,"value":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2","depth":4,"bounds":{"left":0.35738033,"top":0.17478053,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.36702126,"top":0.17318435,"width":0.00731383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.3743351,"top":0.17318435,"width":0.006981383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Jobs\\Crm\\Delete;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Enums\\CrmObject;\nuse Jiminny\\Events\\Crm\\DetachActivityObject;\nuse Jiminny\\Models\\Activity;\nuse Psr\\Log\\LoggerInterface;\nuse Throwable;\n\ntrait DeleteCrmEntityTrait\n{\n public int $tries = 3;\n\n public function timeout(): int\n {\n return 300; // 5 minutes\n }\n\n public function backoff(): array\n {\n return [30, 90, 180]; // 30 seconds, 1.5 minutes, 3 minutes\n }\n\n protected function handleActivities(\n Collection $activities,\n Dispatcher $dispatcher,\n LoggerInterface $logger,\n bool $emitEvent = true,\n ): void {\n if ($activities->isEmpty()) {\n return;\n }\n\n $crmObject = $this->getEntityType();\n $entityIdField = $crmObject->value . '_id';\n\n $activities->each(\n function (Activity $activity) use ($dispatcher, $logger, $entityIdField, $crmObject, $emitEvent): void {\n $stageId = $activity->getStage()?->getId();\n\n $logData = [\n $crmObject->value => $this->id,\n 'activity' => $activity->getId(),\n 'emitEvent' => $emitEvent,\n ];\n\n $updateData = [\n $entityIdField => null,\n ];\n\n // For leads and opportunities, also nullify the stage_id\n if ($stageId && in_array($crmObject, [CrmObject::LEAD, CrmObject::OPPORTUNITY], true)) {\n $updateData['stage_id'] = null;\n $logData['stage_id'] = $stageId;\n }\n\n $activity->update($updateData);\n\n if ($emitEvent) {\n $dispatcher->dispatch(new DetachActivityObject($activity, $crmObject));\n }\n\n $logger->info($this->getLogPrefix() . ' Detach from activity', $logData);\n\n // Dispatch job to verify if CRM task/event still exists\n if ($activity->hasCrmProviderId()) {\n VerifyActivityCrmTaskJob::dispatch($activity->getId());\n }\n }\n );\n }\n\n public function failed(Throwable $exception): void\n {\n $crmObject = $this->getEntityType();\n\n Log::critical($this->getLogPrefix() . ' Job failed permanently', [\n $crmObject->value => $this->id,\n 'exception' => $exception->getMessage(),\n ]);\n }\n\n // Abstract methods that must be implemented by the using class\n abstract protected function getLogPrefix(): string;\n abstract protected function getEntityType(): CrmObject;\n}","depth":4,"bounds":{"left":0.11968085,"top":0.17158818,"width":0.3081782,"height":0.8284118},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Jobs\\Crm\\Delete;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Enums\\CrmObject;\nuse Jiminny\\Events\\Crm\\DetachActivityObject;\nuse Jiminny\\Models\\Activity;\nuse Psr\\Log\\LoggerInterface;\nuse Throwable;\n\ntrait DeleteCrmEntityTrait\n{\n public int $tries = 3;\n\n public function timeout(): int\n {\n return 300; // 5 minutes\n }\n\n public function backoff(): array\n {\n return [30, 90, 180]; // 30 seconds, 1.5 minutes, 3 minutes\n }\n\n protected function handleActivities(\n Collection $activities,\n Dispatcher $dispatcher,\n LoggerInterface $logger,\n bool $emitEvent = true,\n ): void {\n if ($activities->isEmpty()) {\n return;\n }\n\n $crmObject = $this->getEntityType();\n $entityIdField = $crmObject->value . '_id';\n\n $activities->each(\n function (Activity $activity) use ($dispatcher, $logger, $entityIdField, $crmObject, $emitEvent): void {\n $stageId = $activity->getStage()?->getId();\n\n $logData = [\n $crmObject->value => $this->id,\n 'activity' => $activity->getId(),\n 'emitEvent' => $emitEvent,\n ];\n\n $updateData = [\n $entityIdField => null,\n ];\n\n // For leads and opportunities, also nullify the stage_id\n if ($stageId && in_array($crmObject, [CrmObject::LEAD, CrmObject::OPPORTUNITY], true)) {\n $updateData['stage_id'] = null;\n $logData['stage_id'] = $stageId;\n }\n\n $activity->update($updateData);\n\n if ($emitEvent) {\n $dispatcher->dispatch(new DetachActivityObject($activity, $crmObject));\n }\n\n $logger->info($this->getLogPrefix() . ' Detach from activity', $logData);\n\n // Dispatch job to verify if CRM task/event still exists\n if ($activity->hasCrmProviderId()) {\n VerifyActivityCrmTaskJob::dispatch($activity->getId());\n }\n }\n );\n }\n\n public function failed(Throwable $exception): void\n {\n $crmObject = $this->getEntityType();\n\n Log::critical($this->getLogPrefix() . ' Job failed permanently', [\n $crmObject->value => $this->id,\n 'exception' => $exception->getMessage(),\n ]);\n }\n\n // Abstract methods that must be implemented by the using class\n abstract protected function getLogPrefix(): string;\n abstract protected function getEntityType(): CrmObject;\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"app ~/jiminny/app","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".circleci","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".cursor","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".github","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".sonarlint","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".vscode","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":".windsurf","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"app, sources root","depth":7,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Actions","depth":8,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Component","depth":8,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Acl, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ActionItems, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Activity, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ActivityAnalytics, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ActivitySearch, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AiActivityType, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AiAutomation, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AiCallScoring, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AskAnything, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Dtos, folder","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Events, folder","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AskAnythingPromptService.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"HistoryService.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AskJiminnyAi, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AWS, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BillingManagement, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Cache, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CoachingFeedback, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Country, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CustomerApi, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Database, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Datadog, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DateTime, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DealInsights, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DealRisks, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ElasticSearch, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Eloquent, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Encoding, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Encryption, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ES, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Faker, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FeatureFlags, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FFMpeg, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FileSystem, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Gecko, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Gong, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"GuzzleHttp, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"KeyPoints, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Kiosk, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"LanguageDetection, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"LiveFeed, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Locks, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Math, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MediaPipeline, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MeetingBot, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MobileSettings, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Model, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Notification, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Nudge, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ParagraphBreaker, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ParticipantSpeech, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"PartitionedCookie, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"PlaybackPage, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Playlist, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Prophet, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ProphetAi, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ProsperWorks, folder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Queue","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Job","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RateLimitAware.php, abstract class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RateLimitAwareWrapper.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BotsQueueConstants.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Constants.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ProcessingQueueConstants.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Router","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Saml2","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SCIM","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Seeder","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Sentry","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Serializer","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Settings","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Sidekick","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Slack","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"TeamInsights","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"TimeMemoryMapper","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Transcription","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"TranscriptionSummary","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Twilio","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Uploader","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"UrlGenerator","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Utility","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Exceptions","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Service","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BaseRateLimiter.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"EfficientJsonParser.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ProviderRateLimiter.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RateLimiterInstance.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Uuid","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Waveform","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Webhooks","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Workflow","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Configuration","depth":8,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Console","depth":8,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Commands","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Activities","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Analytics","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Calendars","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Crm","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Hubspot","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IntegrationApp","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Traits","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AddLayoutEntities.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AutologDelayedCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BullhornCommandAbstract.php, abstract class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BullhornPingCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BullhornSearchCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"BullhornSessionCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CheckActivityLoggableCommand.php, final class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CleanDuplicateFieldDataCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FullSyncOpportunityCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"LogActivitiesCommand.php, final class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ManageSyncStrategyCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MatchCrmObjectsCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MatchOpportunityActivitiesCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MigrateProvider.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ProcessHubspotObjectsSyncBatches.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"PurgeDeletedOpportunitiesCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ResetGovernorLimits.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SendNotLogged.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SetupActivityTypeForFollowUp.php, final class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SetupCloseCrm.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SetupCopperCrm.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SetupCrmCommand.php, abstract class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SetupLayouts.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncAccount.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncContact.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncFieldMetadata.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncHubspotActiveDeals.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncHubspotObjects.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncLead.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncObjects.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncOpportunitiesMissingFieldDataCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncOpportunity.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncProfileMetadata.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncTeamMetadata.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"UpdateOpportunitySpecifications.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DealInsights","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Dev","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AddRateLimitCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FixHubSpotTokens.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FixMissMatchedCrmActivitiesCommand.php, final class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ImportCallsCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MonitorSocialAccountsState.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Dialers","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DTOs","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Elasticsearch","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"EngagementStats","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"GeckoExport","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Livestream","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Mailboxes","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Migrate","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"PlaybackThemes","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Playbooks","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Playlists","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Postmark","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ProphetAi","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Reports","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AutomatedReportsCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AutomatedReportsRetentionPolicyCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AutomatedReportsSendCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CreateMockAskJiminnyReportResultCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DeleteReportCommand.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"GenerateMarketingReport.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Team.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Usage.php, class","depth":11,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Slack","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Teams","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Tracks","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Transcription","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Twilio","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Users","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Vocabulary","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Zoom","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Command.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CreateDatabaseUsers.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DatabaseTableCount.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DeleteOldAiCrmNotesCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DeleteS3LeftoversCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DevPostmanCommand.php, final class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DiarizeViaAiParticipantIdentificationCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"EncryptTokensCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"EngagementStatsRegenerateCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FeatureFlagsHelper.php","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FixCrossTenantIssues.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"FlushRolesPermissionsCache.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"GenerateInternalWebhookToken.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"GroupSetDefaultLanguageCommand.php, final class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"HelperTruncateCoachingTables.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"HubspotJournalPollingCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"HubspotWebhookServiceCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ImportRecording.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ImportUsersFromCsvFile.php, final class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"IterateUsersCommand.php, abstract class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"JiminnyCacheClearCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"JiminnyDebugCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"JiminnySetEncryptedTokenManagerModeCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"JiminnyTokenInfoCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MakeSlackLiveCoachingChatNotesOn.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ManageScimForTeam.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MarkBranchForEnvironmentPipelineCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"MuteOrganizerChannel.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"PhpApm.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"PropagateCoachingFeedbackCreatedAtToSectionFeedbacks.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"PurgeConferences.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"PurgeSoftDeletedOpportunitiesCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"PurgeSyncBatchesCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RecalculateDealRisksCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RemoveDeleteMarkersCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RemoveExpiredNudgesCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RemoveUnusedParticipantSpeechesCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ResetElasticSearch.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RestoreActivityCrmProviderIdCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RestoreActivityTypeCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RunAiCallScoringForUntypedActivitiesCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SeedActivities.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SendNudgeExpirationWarningsCommand.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"SyncActivity.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"TrackImported.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"WhichWorkerIsWorkingOnWhichJob.php, class","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Scheduling","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Kernel.php, class","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Contracts","depth":8,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Acl","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ActivitySearch","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"AiAutomation","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Crm","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"DateTime","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ES","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Http","depth":9,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Requests","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ApiResponse.php, interface","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RateLimited.php, interface","depth":10,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"RateLimitInterface.php, interface","depth":10,"on_screen":false,"role_description":"text"}]...
|
-8039648987878855662
|
1065731447188764229
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Code changed:
Hide
Sync Changes
Hide This Notification
37
1
35
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
Sync Changes
Hide This Notification
Code changed:
Hide
2
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Jobs\Crm\Delete;
use Illuminate\Events\Dispatcher;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Jiminny\Enums\CrmObject;
use Jiminny\Events\Crm\DetachActivityObject;
use Jiminny\Models\Activity;
use Psr\Log\LoggerInterface;
use Throwable;
trait DeleteCrmEntityTrait
{
public int $tries = 3;
public function timeout(): int
{
return 300; // 5 minutes
}
public function backoff(): array
{
return [30, 90, 180]; // 30 seconds, 1.5 minutes, 3 minutes
}
protected function handleActivities(
Collection $activities,
Dispatcher $dispatcher,
LoggerInterface $logger,
bool $emitEvent = true,
): void {
if ($activities->isEmpty()) {
return;
}
$crmObject = $this->getEntityType();
$entityIdField = $crmObject->value . '_id';
$activities->each(
function (Activity $activity) use ($dispatcher, $logger, $entityIdField, $crmObject, $emitEvent): void {
$stageId = $activity->getStage()?->getId();
$logData = [
$crmObject->value => $this->id,
'activity' => $activity->getId(),
'emitEvent' => $emitEvent,
];
$updateData = [
$entityIdField => null,
];
// For leads and opportunities, also nullify the stage_id
if ($stageId && in_array($crmObject, [CrmObject::LEAD, CrmObject::OPPORTUNITY], true)) {
$updateData['stage_id'] = null;
$logData['stage_id'] = $stageId;
}
$activity->update($updateData);
if ($emitEvent) {
$dispatcher->dispatch(new DetachActivityObject($activity, $crmObject));
}
$logger->info($this->getLogPrefix() . ' Detach from activity', $logData);
// Dispatch job to verify if CRM task/event still exists
if ($activity->hasCrmProviderId()) {
VerifyActivityCrmTaskJob::dispatch($activity->getId());
}
}
);
}
public function failed(Throwable $exception): void
{
$crmObject = $this->getEntityType();
Log::critical($this->getLogPrefix() . ' Job failed permanently', [
$crmObject->value => $this->id,
'exception' => $exception->getMessage(),
]);
}
// Abstract methods that must be implemented by the using class
abstract protected function getLogPrefix(): string;
abstract protected function getEntityType(): CrmObject;
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide
app ~/jiminny/app
.circleci
.cursor
.github
.sonarlint
.vscode
.windsurf
app, sources root
Actions
Component
Acl, folder
ActionItems, folder
Activity, folder
ActivityAnalytics, folder
ActivitySearch, folder
AiActivityType, folder
AiAutomation, folder
AiCallScoring, folder
AskAnything, folder
Dtos, folder
Events, folder
AskAnythingPromptService.php, class
HistoryService.php, class
AskJiminnyAi, folder
AWS, folder
BillingManagement, folder
Cache, folder
CoachingFeedback, folder
Country, folder
CustomerApi, folder
Database, folder
Datadog, folder
DateTime, folder
DealInsights, folder
DealRisks, folder
ElasticSearch, folder
Eloquent, folder
Encoding, folder
Encryption, folder
ES, folder
Faker, folder
FeatureFlags, folder
FFMpeg, folder
FileSystem, folder
Gecko, folder
Gong, folder
GuzzleHttp, folder
KeyPoints, folder
Kiosk, folder
LanguageDetection, folder
LiveFeed, folder
Locks, folder
Math, folder
MediaPipeline, folder
MeetingBot, folder
MobileSettings, folder
Model, folder
Notification, folder
Nudge, folder
ParagraphBreaker, folder
ParticipantSpeech, folder
PartitionedCookie, folder
PlaybackPage, folder
Playlist, folder
Prophet, folder
ProphetAi, folder
ProsperWorks, folder
Queue
Job
RateLimitAware.php, abstract class
RateLimitAwareWrapper.php, class
BotsQueueConstants.php, class
Constants.php, class
ProcessingQueueConstants.php, class
Router
Saml2
SCIM
Seeder
Sentry
Serializer
Settings
Sidekick
Slack
TeamInsights
TimeMemoryMapper
Transcription
TranscriptionSummary
Twilio
Uploader
UrlGenerator
Utility
Exceptions
Service
BaseRateLimiter.php, class
EfficientJsonParser.php, class
ProviderRateLimiter.php, class
RateLimiterInstance.php, class
Uuid
Waveform
Webhooks
Workflow
Configuration
Console
Commands
Activities
Analytics
Calendars
Crm
Hubspot
IntegrationApp
Traits
AddLayoutEntities.php, class
AutologDelayedCommand.php, class
BullhornCommandAbstract.php, abstract class
BullhornPingCommand.php, class
BullhornSearchCommand.php, class
BullhornSessionCommand.php, class
CheckActivityLoggableCommand.php, final class
CleanDuplicateFieldDataCommand.php, class
FullSyncOpportunityCommand.php, class
LogActivitiesCommand.php, final class
ManageSyncStrategyCommand.php, class
MatchCrmObjectsCommand.php, class
MatchOpportunityActivitiesCommand.php, class
MigrateProvider.php, class
ProcessHubspotObjectsSyncBatches.php, class
PurgeDeletedOpportunitiesCommand.php, class
ResetGovernorLimits.php, class
SendNotLogged.php, class
SetupActivityTypeForFollowUp.php, final class
SetupCloseCrm.php, class
SetupCopperCrm.php, class
SetupCrmCommand.php, abstract class
SetupLayouts.php, class
SyncAccount.php, class
SyncContact.php, class
SyncFieldMetadata.php, class
SyncHubspotActiveDeals.php, class
SyncHubspotObjects.php, class
SyncLead.php, class
SyncObjects.php, class
SyncOpportunitiesMissingFieldDataCommand.php, class
SyncOpportunity.php, class
SyncProfileMetadata.php, class
SyncTeamMetadata.php, class
UpdateOpportunitySpecifications.php, class
DealInsights
Dev
AddRateLimitCommand.php, class
FixHubSpotTokens.php, class
FixMissMatchedCrmActivitiesCommand.php, final class
ImportCallsCommand.php, class
MonitorSocialAccountsState.php, class
Dialers
DTOs
Elasticsearch
EngagementStats
GeckoExport
Livestream
Mailboxes
Migrate
PlaybackThemes
Playbooks
Playlists
Postmark
ProphetAi
Reports
AutomatedReportsCommand.php, class
AutomatedReportsRetentionPolicyCommand.php, class
AutomatedReportsSendCommand.php, class
CreateMockAskJiminnyReportResultCommand.php, class
DeleteReportCommand.php, class
GenerateMarketingReport.php, class
Team.php, class
Usage.php, class
Slack
Teams
Tracks
Transcription
Twilio
Users
Vocabulary
Zoom
Command.php, class
CreateDatabaseUsers.php, class
DatabaseTableCount.php, class
DeleteOldAiCrmNotesCommand.php, class
DeleteS3LeftoversCommand.php, class
DevPostmanCommand.php, final class
DiarizeViaAiParticipantIdentificationCommand.php, class
EncryptTokensCommand.php, class
EngagementStatsRegenerateCommand.php, class
FeatureFlagsHelper.php
FixCrossTenantIssues.php, class
FlushRolesPermissionsCache.php, class
GenerateInternalWebhookToken.php, class
GroupSetDefaultLanguageCommand.php, final class
HelperTruncateCoachingTables.php, class
HubspotJournalPollingCommand.php, class
HubspotWebhookServiceCommand.php, class
ImportRecording.php, class
ImportUsersFromCsvFile.php, final class
IterateUsersCommand.php, abstract class
JiminnyCacheClearCommand.php, class
JiminnyDebugCommand.php, class
JiminnySetEncryptedTokenManagerModeCommand.php, class
JiminnyTokenInfoCommand.php, class
MakeSlackLiveCoachingChatNotesOn.php, class
ManageScimForTeam.php, class
MarkBranchForEnvironmentPipelineCommand.php, class
MuteOrganizerChannel.php, class
PhpApm.php, class
PropagateCoachingFeedbackCreatedAtToSectionFeedbacks.php, class
PurgeConferences.php, class
PurgeSoftDeletedOpportunitiesCommand.php, class
PurgeSyncBatchesCommand.php, class
RecalculateDealRisksCommand.php, class
RemoveDeleteMarkersCommand.php, class
RemoveExpiredNudgesCommand.php, class
RemoveUnusedParticipantSpeechesCommand.php, class
ResetElasticSearch.php, class
RestoreActivityCrmProviderIdCommand.php, class
RestoreActivityTypeCommand.php, class
RunAiCallScoringForUntypedActivitiesCommand.php, class
SeedActivities.php, class
SendNudgeExpirationWarningsCommand.php, class
SyncActivity.php, class
TrackImported.php, class
WhichWorkerIsWorkingOnWhichJob.php, class
Scheduling
Kernel.php, class
Contracts
Acl
ActivitySearch
AiAutomation
Crm
DateTime
ES
Http
Requests
ApiResponse.php, interface
RateLimited.php, interface
RateLimitInterface.php, interface...
|
1513
|
NULL
|
NULL
|
NULL
|
|
21151
|
923
|
40
|
2026-05-11T17:15:30.749068+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778519730749_m2.jpg...
|
iTerm2
|
-zsh
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Last login: Sun May 10 21:10:26 on ttys013
Poetry Last login: Sun May 10 21:10:26 on ttys013
Poetry could not find a pyproject.toml file in /Users/lukas or its parents
Poetry could not find a pyproject.toml file in /Users/lukas or its parents
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ cat ~/.screenpipe/screenpipe_sync.sh | pbcopy
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ op
DOCKER
Close Tab
DEV (docker)
Close Tab
APP (-zsh)
Close Tab
-zsh
Close Tab
-zsh
Close Tab
screenpipe"
Close Tab
-zsh
Close Tab
⌥⌘1
-zsh...
|
[{"role":"AXTextArea","text [{"role":"AXTextArea","text":"Last login: Sun May 10 21:10:26 on ttys013\n\nPoetry could not find a pyproject.toml file in /Users/lukas or its parents\n\nPoetry could not find a pyproject.toml file in /Users/lukas or its parents\nlukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ cat ~/.screenpipe/screenpipe_sync.sh | pbcopy\nlukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ op","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.4787234,"height":-0.06304872},"on_screen":true,"value":"Last login: Sun May 10 21:10:26 on ttys013\n\nPoetry could not find a pyproject.toml file in /Users/lukas or its parents\n\nPoetry could not find a pyproject.toml file in /Users/lukas or its parents\nlukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ cat ~/.screenpipe/screenpipe_sync.sh | pbcopy\nlukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ op","is_focused":true},{"role":"AXRadioButton","text":"DOCKER","depth":2,"bounds":{"left":0.27027926,"top":1.0,"width":0.06732048,"height":-0.042298436},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.27227393,"top":1.0,"width":0.005319149,"height":-0.04549086},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"DEV (docker)","depth":2,"bounds":{"left":0.33759972,"top":1.0,"width":0.06732048,"height":-0.042298436},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.33959442,"top":1.0,"width":0.005319149,"height":-0.04549086},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"APP (-zsh)","depth":2,"bounds":{"left":0.40492022,"top":1.0,"width":0.06732048,"height":-0.042298436},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.4069149,"top":1.0,"width":0.005319149,"height":-0.04549086},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"-zsh","depth":2,"bounds":{"left":0.4722407,"top":1.0,"width":0.06732048,"height":-0.042298436},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.4742354,"top":1.0,"width":0.005319149,"height":-0.04549086},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"-zsh","depth":2,"bounds":{"left":0.53956115,"top":1.0,"width":0.06715426,"height":-0.042298436},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.5415558,"top":1.0,"width":0.005319149,"height":-0.04549086},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"screenpipe\"","depth":2,"bounds":{"left":0.60671544,"top":1.0,"width":0.06715426,"height":-0.042298436},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.6087101,"top":1.0,"width":0.005319149,"height":-0.04549086},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"-zsh","depth":2,"bounds":{"left":0.67386967,"top":1.0,"width":0.06715426,"height":-0.042298436},"on_screen":true,"role_description":"radio button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close Tab","depth":3,"bounds":{"left":0.67586434,"top":1.0,"width":0.005319149,"height":-0.04549086},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"⌥⌘1","depth":1,"bounds":{"left":0.7273936,"top":1.0,"width":0.01861702,"height":-0.023144484},"on_screen":true,"automation_id":"_NS:8","role_description":"text"},{"role":"AXStaticText","text":"-zsh","depth":1,"bounds":{"left":0.50398934,"top":1.0,"width":0.010970744,"height":-0.02394259},"on_screen":true,"role_description":"text"}]...
|
-8039392039186840489
|
-4070526003869332479
|
click
|
accessibility
|
NULL
|
Last login: Sun May 10 21:10:26 on ttys013
Poetry Last login: Sun May 10 21:10:26 on ttys013
Poetry could not find a pyproject.toml file in /Users/lukas or its parents
Poetry could not find a pyproject.toml file in /Users/lukas or its parents
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ cat ~/.screenpipe/screenpipe_sync.sh | pbcopy
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ op
DOCKER
Close Tab
DEV (docker)
Close Tab
APP (-zsh)
Close Tab
-zsh
Close Tab
-zsh
Close Tab
screenpipe"
Close Tab
-zsh
Close Tab
⌥⌘1
-zsh...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
23852
|
1002
|
35
|
2026-05-12T08:28:28.467888+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-12/1778 /Users/lukas/.screenpipe/data/data/2026-05-12/1778574508467_m1.jpg...
|
Firefox
|
Jiminny — Work
|
True
|
app.jiminny.com/ai-reports
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
New Tab
New Tab
Jy 20820 es reindex stream model h New Tab
New Tab
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
Pipelines - jiminny/app
Pipelines - jiminny/app
Pull requests · jiminny/app
Pull requests · jiminny/app
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
Data Explorer
Data Explorer
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
Jiminny
Jiminny
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
6
6
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Ask Jiminny
Coaching Profiles
×
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Coaching Profiles - 4 - 10 May 2026 - Client Success, UK Sales
Weekly
+1
11/05/2026
Coaching Profiles Podcast - 4 - 10 May 2026 - Client Success, UK Sales
Weekly
+1
11/05/2026
Product Feedback - 4 - 10 May 2026 - Client Success, UK Sales, Support, Product
Weekly
+2
11/05/2026
Exec Summary - 4 - 10 May 2026 - All
Weekly
+4
11/05/2026...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pull requests · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20776] Automated report - sentry - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20776] Automated report - sentry - Jira","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"TypeError: League\\Flysystem\\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"TypeError: League\\Flysystem\\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Data Explorer","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Data Explorer","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20776] Automated report - sentry - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20776] Automated report - sentry - Jira","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Jiminny","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.20243056,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.22534722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.24861111,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.271875,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.2951389,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"6","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"6","depth":14,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"AI Reports","depth":13,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"AI Reports","depth":14,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Ask Jiminny reports","depth":13,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Jiminny reports","depth":14,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report name","depth":17,"on_screen":true,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Period","depth":20,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Ask Jiminny","depth":16,"on_screen":true,"value":"Ask Jiminny","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"Coaching Profiles","depth":20,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"×","depth":21,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report Type","depth":18,"on_screen":true,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Clear all","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NAME","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"FREQUENCY","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SHARED","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"DATE","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ACTIONS","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Coaching Profiles - 4 - 10 May 2026 - Client Success, UK Sales","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+1","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"11/05/2026","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Coaching Profiles Podcast - 4 - 10 May 2026 - Client Success, UK Sales","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+1","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"11/05/2026","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Product Feedback - 4 - 10 May 2026 - Client Success, UK Sales, Support, Product","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+2","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"11/05/2026","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 4 - 10 May 2026 - All","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+4","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"11/05/2026","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8039239774713824342
|
-3169106199157426133
|
click
|
accessibility
|
NULL
|
New Tab
New Tab
Jy 20820 es reindex stream model h New Tab
New Tab
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
Pipelines - jiminny/app
Pipelines - jiminny/app
Pull requests · jiminny/app
Pull requests · jiminny/app
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
Data Explorer
Data Explorer
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
Jiminny
Jiminny
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
6
6
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Ask Jiminny
Coaching Profiles
×
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Coaching Profiles - 4 - 10 May 2026 - Client Success, UK Sales
Weekly
+1
11/05/2026
Coaching Profiles Podcast - 4 - 10 May 2026 - Client Success, UK Sales
Weekly
+1
11/05/2026
Product Feedback - 4 - 10 May 2026 - Client Success, UK Sales, Support, Product
Weekly
+2
11/05/2026
Exec Summary - 4 - 10 May 2026 - All
Weekly
+4
11/05/2026...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
15628
|
695
|
15
|
2026-05-11T07:05:20.973930+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778483120973_m2.jpg...
|
Firefox
|
Jy 20820 es reindex stream model hydration by Vasi Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app — Work...
|
True
|
github.com/jiminny/app/pull/12059
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
New Tab
Close tab
Jy 20820 es reindex stream model New Tab
Close tab
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Skip to content
Skip to content
Open menu
Homepage (g then d)
jiminny
jiminny
app
app
Search or jump to…
Type
/
to search
Chat with Copilot
Open Copilot…
Create new...
All issues(g then i)
All pull requests
All repositories
You have unread notifications(g then n)
Open user navigation menu
Repository navigation
Repository navigation
Code
Code
Pull requests (34)
Pull requests
(
34
)
Agents
Agents
Actions
Actions
Wiki
Wiki
Security and quality (4)
Security and quality
(
4
)
Insights
Insights
Settings
Settings
Important update
Important update
On April 24 we'll start using GitHub Copilot interaction data for AI model training unless you opt out.
Review this update
Review this update
and manage your preferences in your
GitHub account settings
GitHub account settings
.
Dismiss banner
Jy 20820 es reindex stream model hydration #12059 Edit title
Jy 20820 es reindex stream model hydration
#
12059
Edit title
Preview
Preview
Checks pending
Checks pending
Code
Code
Open
Vasil-Jiminny
Vasil-Jiminny
wants to merge 36 commits into
master
master
from
JY-20820-es-reindex-stream-model-hydration
JY-20820-es-reindex-stream-model-hydration
Copy head branch name to clipboard
Lines changed: 363 additions & 140 deletions
Conversation (8)
Conversation
(
8
)
Commits (36)
Commits
(
36
)
Checks (2)
Checks
(
2
)
Files changed (12)
Files changed
(
12
)
Pull Request Toolbar
Pull Request Toolbar
Collapse file tree
Open
Jy 20820 es reindex stream model hydration
Jy 20820 es reindex stream model hydration
#
12059
Commit 098a688
Commit 098a688
Vasil-Jiminny
Vasil-Jiminny
wants to merge 36 commits into
master
master
from
JY-20820-es-reindex-stream-model-hydration
JY-20820-es-reindex-stream-model-hydration
Copy head branch name to clipboard
0 of 2 files viewed
Checks pending
Checks pending
Submit review
Submit
review
Open diff view settings
Open overview panel
Open comments panel
(
0
)
Filter files…
Filter options
File tree
File tree
app/Component/ES/Processor/Actions
LoadDocumentsAction.php
LoadDocumentsAction.php
tests/Unit/Component/ES/Processor/Actions
LoadDocumentsActionTest.php
LoadDocumentsActionTest.php
Usage of cursor introduced more problems - mainly no eager loading and keeping DB connection open and busy. For that reason it is swapped by LazyByIdDesc. Smaller batches are loaded in memory, cleaned up one by one. More smaller batches are loaded in general. If smaller batches help keep memory lower (at the cost of more smaller db requests), we will load more data, in smaller chunks.
Usage of cursor introduced more problems - mainly no eager loading and keeping DB connection open and busy. For that reason it is swapped by LazyByIdDesc. Smaller batches are loaded in memory, cleaned up one by one. More smaller batches are loaded in general. If smaller batches help keep memory lower (at the cost of more smaller db requests), we will load more data, in smaller chunks.
Previous commit
Prev
No next commit
Next
Browse files
Browse files
Vasil-Jiminny
commits by Vasil-Jiminny
Vasil-Jiminny
committed
3 days ago
·
Status checks: failure
8 / 10
commit
098a688
098a688
Copy full SHA for 098a688
Collapse file
app/Component/ES/Processor/Actions/LoadDocumentsAction.php
app/Component/ES/Processor/Actions/LoadDocumentsAction.php
app/Component/ES/Processor/Actions/LoadDocumentsAction.php
Copy file name to clipboard
Expand all lines: app/Component/ES/Processor/Actions/LoadDocumentsAction.php
Lines changed: 2 additions & 2 deletions
Not Viewed
Viewed
Comment on this file
More options
Original file line number
Original file line
Diff line number
Diff line change
@@ -29,7 +29,7 @@ public function loadDocuments(string $updateTarget, array $entityIdsList): Docum
29
$
query
=
$
this
->
queryBuilder
->
getEntityQuery
(
$
updateTarget
,
$
entityIdsList
);
29
$
query
=
$
this
->
queryBuilder
->
getEntityQuery
(
$
updateTarget
,
$
entityIdsList
);
30
30
31
/** @var Model&Searchable $entityModel */
31
/** @var Model&Searchable $entityModel */
32
-
foreach
(
$
query
->
cursor
(
)
as
$
entityModel
) {
32
+
foreach
(
$
query
->
lazyByIdDesc
(
50
,
'
id
'
)
as
$
entityModel
) {
33
if
(
$
entityModel
->
isDeleted
()) {
33
if
(
$
entityModel
->
isDeleted
()) {
34
/**
34
/**
35
* Cleanup (from ElasticSearch) scheduled entities that were recently deleted.
35
* Cleanup (from ElasticSearch) scheduled entities that were recently deleted.
@@ -54,7 +54,7 @@ public function loadDocuments(string $updateTarget, array $entityIdsList): Docum
54
}
54
}...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.0,"top":0.0518755,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.0518755,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.08459697,"width":0.016123671,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.0006648936,"top":0.08459697,"width":0.004986702,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.118914604,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.0,"top":0.8547486,"width":0.016123671,"height":0.0311253},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.0,"top":0.8858739,"width":0.016123671,"height":0.027533919},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.0,"top":0.9134078,"width":0.016123671,"height":0.02793296},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.0,"top":0.9413408,"width":0.016123671,"height":0.027533919},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0,"top":0.9688747,"width":0.016123671,"height":0.0311253},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Skip to content","depth":6,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Skip to content","depth":7,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Open menu","depth":10,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Homepage (g then d)","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"jiminny","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"jiminny","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"app","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"app","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Search or jump to…","depth":9,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Type","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to search","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Chat with Copilot","depth":10,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"Open Copilot…","depth":9,"on_screen":false,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXMenuButton","text":"Create new...","depth":9,"on_screen":false,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"All issues(g then i)","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"All pull requests","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"All repositories","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"You have unread notifications(g then n)","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open user navigation menu","depth":9,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Repository navigation","depth":9,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Repository navigation","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Code","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Code","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Pull requests (34)","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"34","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Agents","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Agents","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Actions","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Actions","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Wiki","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Wiki","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Security and quality (4)","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Security and quality","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Insights","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Insights","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Settings","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Settings","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Important update","depth":10,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Important update","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"On April 24 we'll start using GitHub Copilot interaction data for AI model training unless you opt out.","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Review this update","depth":10,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Review this update","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"and manage your preferences in your","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"GitHub account settings","depth":10,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"GitHub account settings","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Dismiss banner","depth":9,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Jy 20820 es reindex stream model hydration #12059 Edit title","depth":12,"bounds":{"left":0.026761968,"top":0.0,"width":0.25382313,"height":0.031923383},"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Jy 20820 es reindex stream model hydration","depth":13,"bounds":{"left":0.026761968,"top":0.0,"width":0.20246011,"height":0.030327214},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"#","depth":14,"bounds":{"left":0.23188165,"top":0.0,"width":0.0066489363,"height":0.030327214},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12059","depth":14,"bounds":{"left":0.23853059,"top":0.0,"width":0.030086435,"height":0.030327214},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Edit title","depth":13,"bounds":{"left":0.2699468,"top":0.0,"width":0.010638298,"height":0.025538707},"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"Preview","depth":12,"bounds":{"left":0.4582779,"top":0.0,"width":0.031083776,"height":0.022346368},"on_screen":false,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Preview","depth":14,"bounds":{"left":0.4635971,"top":0.0,"width":0.01512633,"height":0.011971269},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Checks pending","depth":12,"bounds":{"left":0.3715093,"top":0.0,"width":0.051861703,"height":0.025538707},"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Checks pending","depth":14,"bounds":{"left":0.38380983,"top":0.0,"width":0.03523936,"height":0.013567438},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Code","depth":12,"bounds":{"left":0.42603058,"top":0.0,"width":0.02825798,"height":0.025538707},"on_screen":false,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Code","depth":14,"bounds":{"left":0.4303524,"top":0.0,"width":0.011635638,"height":0.013567438},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open","depth":12,"bounds":{"left":0.037400264,"top":0.0,"width":0.011968086,"height":0.013567438},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Vasil-Jiminny","depth":14,"bounds":{"left":0.056017287,"top":0.0,"width":0.03025266,"height":0.016759777},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Vasil-Jiminny","depth":15,"bounds":{"left":0.056017287,"top":0.0,"width":0.03025266,"height":0.013567438},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"wants to merge 36 commits into","depth":14,"bounds":{"left":0.08759973,"top":0.0,"width":0.06931516,"height":0.013567438},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"master","depth":14,"bounds":{"left":0.15824468,"top":0.0,"width":0.018450798,"height":0.017557861},"on_screen":false,"role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"master","depth":15,"bounds":{"left":0.16023937,"top":0.0,"width":0.014461436,"height":0.011572227},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"from","depth":15,"bounds":{"left":0.17802526,"top":0.0,"width":0.009973404,"height":0.013567438},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20820-es-reindex-stream-model-hydration","depth":15,"bounds":{"left":0.18932846,"top":0.0,"width":0.10472074,"height":0.017557861},"on_screen":false,"role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20820-es-reindex-stream-model-hydration","depth":16,"bounds":{"left":0.19132313,"top":0.0,"width":0.10073138,"height":0.011572227},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy head branch name to clipboard","depth":15,"bounds":{"left":0.29537898,"top":0.0,"width":0.00930851,"height":0.022346368},"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Lines changed: 363 additions & 140 deletions","depth":13,"bounds":{"left":0.45196143,"top":0.018754989,"width":0.019946808,"height":0.11412609},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Conversation (8)","depth":15,"bounds":{"left":0.026761968,"top":0.0007980846,"width":0.054853722,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Conversation","depth":16,"bounds":{"left":0.0390625,"top":0.0103751,"width":0.02825798,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"bounds":{"left":0.07729388,"top":0.0103751,"width":0.0029920214,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"8","depth":17,"bounds":{"left":0.08028591,"top":0.0103751,"width":0.0029920214,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":17,"bounds":{"left":0.083277926,"top":0.0103751,"width":0.0016622341,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Commits (36)","depth":15,"bounds":{"left":0.081615694,"top":0.0007980846,"width":0.048204787,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Commits","depth":16,"bounds":{"left":0.09391622,"top":0.0103751,"width":0.019115692,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"bounds":{"left":0.12549867,"top":0.0103751,"width":0.0029920214,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"36","depth":17,"bounds":{"left":0.12849069,"top":0.0103751,"width":0.005817819,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":17,"bounds":{"left":0.13430852,"top":0.0103751,"width":0.0018284575,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Checks (2)","depth":15,"bounds":{"left":0.12982048,"top":0.0007980846,"width":0.042386968,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Checks","depth":16,"bounds":{"left":0.14212102,"top":0.0103751,"width":0.015957447,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"bounds":{"left":0.16788563,"top":0.0103751,"width":0.0029920214,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2","depth":17,"bounds":{"left":0.17087767,"top":0.0103751,"width":0.0028257978,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":17,"bounds":{"left":0.17370346,"top":0.0103751,"width":0.0016622341,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Files changed (12)","depth":15,"bounds":{"left":0.17220744,"top":0.0007980846,"width":0.05817819,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Files changed","depth":16,"bounds":{"left":0.18450798,"top":0.0103751,"width":0.029753989,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"bounds":{"left":0.22606383,"top":0.0103751,"width":0.0029920214,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12","depth":17,"bounds":{"left":0.22905585,"top":0.0103751,"width":0.004986702,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":17,"bounds":{"left":0.23404256,"top":0.0103751,"width":0.0016622341,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Pull Request Toolbar","depth":13,"bounds":{"left":0.026761968,"top":0.075019956,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Pull Request Toolbar","depth":14,"bounds":{"left":0.026761968,"top":0.077813245,"width":0.030086435,"height":0.08060654},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse file tree","depth":13,"bounds":{"left":0.026761968,"top":0.06424581,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"Open","depth":13,"bounds":{"left":0.04936835,"top":0.06863528,"width":0.011968086,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Jy 20820 es reindex stream model hydration","depth":13,"bounds":{"left":0.06798537,"top":0.057462092,"width":0.100398935,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jy 20820 es reindex stream model hydration","depth":15,"bounds":{"left":0.06798537,"top":0.05905826,"width":0.100398935,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"#","depth":14,"bounds":{"left":0.17104389,"top":0.05905826,"width":0.0028257978,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12059","depth":14,"bounds":{"left":0.17386968,"top":0.05905826,"width":0.013630319,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Commit 098a688","depth":13,"bounds":{"left":0.0653258,"top":0.07102953,"width":0.045212764,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Commit 098a688","depth":15,"bounds":{"left":0.068317816,"top":0.07621708,"width":0.033909574,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Vasil-Jiminny","depth":14,"bounds":{"left":0.11486037,"top":0.075019956,"width":0.02642952,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Vasil-Jiminny","depth":15,"bounds":{"left":0.11486037,"top":0.07621708,"width":0.02642952,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"wants to merge 36 commits into","depth":14,"bounds":{"left":0.14261968,"top":0.07621708,"width":0.06050532,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"master","depth":14,"bounds":{"left":0.2044548,"top":0.07342378,"width":0.015292553,"height":0.017557861},"on_screen":true,"role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"master","depth":15,"bounds":{"left":0.20644946,"top":0.07661612,"width":0.014461436,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"from","depth":15,"bounds":{"left":0.22107713,"top":0.07621708,"width":0.00880984,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20820-es-reindex-stream-model-hydration","depth":15,"bounds":{"left":0.23121676,"top":0.07342378,"width":0.07978723,"height":0.017557861},"on_screen":true,"role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20820-es-reindex-stream-model-hydration","depth":16,"bounds":{"left":0.23321144,"top":0.07661612,"width":0.10073138,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy head branch name to clipboard","depth":15,"bounds":{"left":0.31233376,"top":0.07102953,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"0 of 2 files viewed","depth":14,"bounds":{"left":0.32729387,"top":0.07661612,"width":0.01512633,"height":0.08060654},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Checks pending","depth":13,"bounds":{"left":0.3650266,"top":0.06424581,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Checks pending","depth":15,"bounds":{"left":0.37466756,"top":0.06943336,"width":0.030917553,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Submit review","depth":13,"bounds":{"left":0.4112367,"top":0.06424581,"width":0.03856383,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Submit","depth":15,"bounds":{"left":0.41422874,"top":0.06943336,"width":0.01462766,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"review","depth":15,"bounds":{"left":0.42885637,"top":0.06943336,"width":0.012632979,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Open diff view settings","depth":13,"bounds":{"left":0.4524601,"top":0.06424581,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open overview panel","depth":13,"bounds":{"left":0.47007978,"top":0.06424581,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open comments panel","depth":13,"bounds":{"left":0.48071808,"top":0.06424581,"width":0.017287234,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"(","depth":15,"bounds":{"left":0.48902926,"top":0.06943336,"width":0.0026595744,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0","depth":15,"bounds":{"left":0.49168882,"top":0.06943336,"width":0.002493351,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":15,"bounds":{"left":0.49418217,"top":0.06943336,"width":0.0016622341,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Filter files…","depth":15,"bounds":{"left":0.038065158,"top":0.11332801,"width":0.06815159,"height":0.023942538},"on_screen":true,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"Filter options","depth":15,"bounds":{"left":0.10920878,"top":0.112529926,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"File tree","depth":14,"bounds":{"left":0.027094414,"top":0.15083799,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"File tree","depth":15,"bounds":{"left":0.027094414,"top":0.15363128,"width":0.014295213,"height":0.0518755},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app/Component/ES/Processor/Actions","depth":18,"bounds":{"left":0.04305186,"top":0.15682362,"width":0.081615694,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"LoadDocumentsAction.php","depth":20,"bounds":{"left":0.045711435,"top":0.18276137,"width":0.05817819,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LoadDocumentsAction.php","depth":21,"bounds":{"left":0.045711435,"top":0.18276137,"width":0.05817819,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"tests/Unit/Component/ES/Processor/Actions","depth":18,"bounds":{"left":0.04305186,"top":0.20830008,"width":0.09424867,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"LoadDocumentsActionTest.php","depth":20,"bounds":{"left":0.045711435,"top":0.23383878,"width":0.06698803,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LoadDocumentsActionTest.php","depth":21,"bounds":{"left":0.045711435,"top":0.23383878,"width":0.06698803,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Usage of cursor introduced more problems - mainly no eager loading and keeping DB connection open and busy. For that reason it is swapped by LazyByIdDesc. Smaller batches are loaded in memory, cleaned up one by one. More smaller batches are loaded in general. If smaller batches help keep memory lower (at the cost of more smaller db requests), we will load more data, in smaller chunks.","depth":12,"bounds":{"left":0.13646941,"top":0.10694334,"width":0.3472407,"height":0.05027933},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Usage of cursor introduced more problems - mainly no eager loading and keeping DB connection open and busy. For that reason it is swapped by LazyByIdDesc. Smaller batches are loaded in memory, cleaned up one by one. More smaller batches are loaded in general. If smaller batches help keep memory lower (at the cost of more smaller db requests), we will load more data, in smaller chunks.","depth":14,"bounds":{"left":0.13646941,"top":0.10853951,"width":0.33976063,"height":0.04708699},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Previous commit","depth":13,"bounds":{"left":0.13646941,"top":0.16999201,"width":0.021276595,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Prev","depth":15,"bounds":{"left":0.14611037,"top":0.17517957,"width":0.008643617,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"No next commit","depth":13,"bounds":{"left":0.15741356,"top":0.16999201,"width":0.02144282,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Next","depth":15,"bounds":{"left":0.16040559,"top":0.17517957,"width":0.00880984,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Browse files","depth":12,"bounds":{"left":0.44780585,"top":0.16999201,"width":0.035904255,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Browse files","depth":14,"bounds":{"left":0.4574468,"top":0.17517957,"width":0.023271276,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Vasil-Jiminny","depth":12,"bounds":{"left":0.13646941,"top":0.2150838,"width":0.00831117,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"commits by Vasil-Jiminny","depth":12,"bounds":{"left":0.14478059,"top":0.2150838,"width":0.028424202,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Vasil-Jiminny","depth":13,"bounds":{"left":0.14478059,"top":0.21667998,"width":0.028424202,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"committed","depth":13,"bounds":{"left":0.17453457,"top":0.21667998,"width":0.023105053,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3 days ago","depth":13,"bounds":{"left":0.19896941,"top":0.21667998,"width":0.0234375,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"·","depth":12,"bounds":{"left":0.22506648,"top":0.21667998,"width":0.0013297872,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Status checks: failure","depth":12,"bounds":{"left":0.22772606,"top":0.21628092,"width":0.02044548,"height":0.014365523},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"8 / 10","depth":14,"bounds":{"left":0.23603724,"top":0.21747805,"width":0.010472074,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commit","depth":13,"bounds":{"left":0.43550533,"top":0.21667998,"width":0.016788565,"height":0.0131683955},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"098a688","depth":12,"bounds":{"left":0.45495346,"top":0.2150838,"width":0.016788565,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"098a688","depth":14,"bounds":{"left":0.45495346,"top":0.21787709,"width":0.016788565,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy full SHA for 098a688","depth":13,"bounds":{"left":0.4744016,"top":0.2122905,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Collapse file","depth":13,"bounds":{"left":0.13380983,"top":0.2601756,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"app/Component/ES/Processor/Actions/LoadDocumentsAction.php","depth":14,"bounds":{"left":0.14444813,"top":0.26296887,"width":0.13912898,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"app/Component/ES/Processor/Actions/LoadDocumentsAction.php","depth":15,"bounds":{"left":0.14444813,"top":0.26456505,"width":0.13912898,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"app/Component/ES/Processor/Actions/LoadDocumentsAction.php","depth":17,"bounds":{"left":0.14444813,"top":0.26656026,"width":0.13912898,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy file name to clipboard","depth":14,"bounds":{"left":0.2862367,"top":0.2601756,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Expand all lines: app/Component/ES/Processor/Actions/LoadDocumentsAction.php","depth":14,"bounds":{"left":0.29554522,"top":0.2601756,"width":0.00930851,"height":0.022346368},"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Lines changed: 2 additions & 2 deletions","depth":14,"bounds":{"left":0.40591756,"top":0.2725459,"width":0.019946808,"height":0.11412609},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Not Viewed","depth":13,"bounds":{"left":0.43583778,"top":0.2601756,"width":0.026595745,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Viewed","depth":15,"bounds":{"left":0.44547874,"top":0.26536313,"width":0.013962766,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Comment on this file","depth":13,"bounds":{"left":0.46509308,"top":0.2601756,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXMenuButton","text":"More options","depth":13,"bounds":{"left":0.47706118,"top":0.2601756,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Original file line number","depth":16,"bounds":{"left":0.13115026,"top":0.2897047,"width":0.017952127,"height":0.04708699},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Original file line","depth":16,"bounds":{"left":0.14910239,"top":0.2980846,"width":0.018118352,"height":0.030327214},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Diff line number","depth":16,"bounds":{"left":0.16722074,"top":0.2897047,"width":0.01761968,"height":0.04708699},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Diff line change","depth":16,"bounds":{"left":0.18484043,"top":0.2897047,"width":0.016954787,"height":0.04708699},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"@@ -29,7 +29,7 @@ public function loadDocuments(string $updateTarget, array $entityIdsList): Docum","depth":17,"bounds":{"left":0.15242687,"top":0.29169992,"width":0.23503989,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"29","depth":15,"bounds":{"left":0.13547207,"top":0.31085396,"width":0.004654255,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.17154256,"top":0.31085396,"width":0.002493351,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"query","depth":17,"bounds":{"left":0.1740359,"top":0.31085396,"width":0.011968086,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":17,"bounds":{"left":0.18600398,"top":0.31085396,"width":0.0071476065,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.1931516,"top":0.31085396,"width":0.002493351,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"this","depth":17,"bounds":{"left":0.19564494,"top":0.31085396,"width":0.009640957,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"->","depth":17,"bounds":{"left":0.2052859,"top":0.31085396,"width":0.004654255,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"queryBuilder","depth":17,"bounds":{"left":0.20994017,"top":0.31085396,"width":0.028922873,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"->","depth":17,"bounds":{"left":0.15242687,"top":0.31085396,"width":0.0887633,"height":0.030726258},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"getEntityQuery","depth":17,"bounds":{"left":0.15475398,"top":0.33000797,"width":0.03374335,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"bounds":{"left":0.18849733,"top":0.33000797,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.19082446,"top":0.33000797,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"updateTarget","depth":17,"bounds":{"left":0.1931516,"top":0.33000797,"width":0.028922873,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":17,"bounds":{"left":0.22207446,"top":0.33000797,"width":0.004654255,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.22672872,"top":0.33000797,"width":0.002493351,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"entityIdsList","depth":17,"bounds":{"left":0.22922207,"top":0.33000797,"width":0.03125,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":");","depth":17,"bounds":{"left":0.2604721,"top":0.33000797,"width":0.004654255,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"29","depth":15,"bounds":{"left":0.31432846,"top":0.31085396,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.35056517,"top":0.31085396,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"query","depth":17,"bounds":{"left":0.35289228,"top":0.31085396,"width":0.012134309,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":17,"bounds":{"left":0.3650266,"top":0.31085396,"width":0.0071476065,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.3721742,"top":0.31085396,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"this","depth":17,"bounds":{"left":0.37450132,"top":0.31085396,"width":0.009640957,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"->","depth":17,"bounds":{"left":0.38414228,"top":0.31085396,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"queryBuilder","depth":17,"bounds":{"left":0.38896278,"top":0.31085396,"width":0.028756648,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"->","depth":17,"bounds":{"left":0.33144948,"top":0.31085396,"width":0.0887633,"height":0.030726258},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"getEntityQuery","depth":17,"bounds":{"left":0.3337766,"top":0.33000797,"width":0.03357713,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"bounds":{"left":0.36735374,"top":0.33000797,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.36968085,"top":0.33000797,"width":0.002493351,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"updateTarget","depth":17,"bounds":{"left":0.3721742,"top":0.33000797,"width":0.028756648,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":17,"bounds":{"left":0.40093085,"top":0.33000797,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.40575132,"top":0.33000797,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"entityIdsList","depth":17,"bounds":{"left":0.40807846,"top":0.33000797,"width":0.03125,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":");","depth":17,"bounds":{"left":0.43932846,"top":0.33000797,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"30","depth":15,"bounds":{"left":0.13547207,"top":0.349162,"width":0.004654255,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"30","depth":15,"bounds":{"left":0.31432846,"top":0.349162,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"31","depth":15,"bounds":{"left":0.13547207,"top":0.36831605,"width":0.004654255,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/** @var Model&Searchable $entityModel */","depth":17,"bounds":{"left":0.17154256,"top":0.36831605,"width":0.09840426,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"31","depth":15,"bounds":{"left":0.31432846,"top":0.36831605,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/** @var Model&Searchable $entityModel */","depth":17,"bounds":{"left":0.35056517,"top":0.36831605,"width":0.09840426,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"32","depth":15,"bounds":{"left":0.13547207,"top":0.38747007,"width":0.004654255,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-","depth":17,"bounds":{"left":0.1471077,"top":0.38747007,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"foreach","depth":17,"bounds":{"left":0.17154256,"top":0.38747007,"width":0.016954787,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"bounds":{"left":0.18849733,"top":0.38747007,"width":0.004654255,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.1931516,"top":0.38747007,"width":0.002493351,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"query","depth":17,"bounds":{"left":0.19564494,"top":0.38747007,"width":0.011968086,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"->","depth":17,"bounds":{"left":0.20761304,"top":0.38747007,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"cursor","depth":17,"bounds":{"left":0.21243352,"top":0.38747007,"width":0.014295213,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"bounds":{"left":0.22672872,"top":0.38747007,"width":0.002493351,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":17,"bounds":{"left":0.22922207,"top":0.38747007,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":17,"bounds":{"left":0.23404256,"top":0.38747007,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.24119017,"top":0.38747007,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"entityModel","depth":17,"bounds":{"left":0.2435173,"top":0.38747007,"width":0.02642952,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") {","depth":17,"bounds":{"left":0.2699468,"top":0.38747007,"width":0.00731383,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"32","depth":15,"bounds":{"left":0.31432846,"top":0.38747007,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"+","depth":17,"bounds":{"left":0.32613033,"top":0.38747007,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"foreach","depth":17,"bounds":{"left":0.35056517,"top":0.38747007,"width":0.016788565,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"bounds":{"left":0.36735374,"top":0.38747007,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.3721742,"top":0.38747007,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"query","depth":17,"bounds":{"left":0.37450132,"top":0.38747007,"width":0.011968086,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"->","depth":17,"bounds":{"left":0.38646942,"top":0.38747007,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"lazyByIdDesc","depth":17,"bounds":{"left":0.3912899,"top":0.38747007,"width":0.028922873,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"bounds":{"left":0.42021278,"top":0.38747007,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"50","depth":17,"bounds":{"left":0.4225399,"top":0.38747007,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":17,"bounds":{"left":0.4273604,"top":0.38747007,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'","depth":17,"bounds":{"left":0.43218085,"top":0.38747007,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"id","depth":17,"bounds":{"left":0.43450797,"top":0.38747007,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'","depth":17,"bounds":{"left":0.43932846,"top":0.38747007,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":17,"bounds":{"left":0.44165558,"top":0.38747007,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":17,"bounds":{"left":0.44647607,"top":0.38747007,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.33144948,"top":0.4066241,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"entityModel","depth":17,"bounds":{"left":0.3337766,"top":0.4066241,"width":0.02642952,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") {","depth":17,"bounds":{"left":0.36020613,"top":0.4066241,"width":0.0071476065,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"33","depth":15,"bounds":{"left":0.13547207,"top":0.42577812,"width":0.004654255,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"if","depth":17,"bounds":{"left":0.18118352,"top":0.42577812,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"bounds":{"left":0.18600398,"top":0.42577812,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.19082446,"top":0.42577812,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"entityModel","depth":17,"bounds":{"left":0.1931516,"top":0.42577812,"width":0.02642952,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"->","depth":17,"bounds":{"left":0.21958111,"top":0.42577812,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"isDeleted","depth":17,"bounds":{"left":0.2244016,"top":0.42577812,"width":0.021609042,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()) {","depth":17,"bounds":{"left":0.24601063,"top":0.42577812,"width":0.011968086,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"33","depth":15,"bounds":{"left":0.31432846,"top":0.42577812,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"if","depth":17,"bounds":{"left":0.36020613,"top":0.42577812,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"bounds":{"left":0.3650266,"top":0.42577812,"width":0.004654255,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"bounds":{"left":0.36968085,"top":0.42577812,"width":0.002493351,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"entityModel","depth":17,"bounds":{"left":0.3721742,"top":0.42577812,"width":0.02642952,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"->","depth":17,"bounds":{"left":0.39860374,"top":0.42577812,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"isDeleted","depth":17,"bounds":{"left":0.4034242,"top":0.42577812,"width":0.02144282,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()) {","depth":17,"bounds":{"left":0.42486703,"top":0.42577812,"width":0.012134309,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"34","depth":15,"bounds":{"left":0.13547207,"top":0.44493216,"width":0.004654255,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/**","depth":17,"bounds":{"left":0.19082446,"top":0.44493216,"width":0.0071476065,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"34","depth":15,"bounds":{"left":0.31432846,"top":0.44493216,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/**","depth":17,"bounds":{"left":0.36968085,"top":0.44493216,"width":0.00731383,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"35","depth":15,"bounds":{"left":0.13547207,"top":0.4640862,"width":0.004654255,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"* Cleanup (from ElasticSearch) scheduled entities that were recently deleted.","depth":17,"bounds":{"left":0.15242687,"top":0.4640862,"width":0.13912898,"height":0.030726258},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"35","depth":15,"bounds":{"left":0.31432846,"top":0.4640862,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"* Cleanup (from ElasticSearch) scheduled entities that were recently deleted.","depth":17,"bounds":{"left":0.33144948,"top":0.4640862,"width":0.13912898,"height":0.030726258},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"@@ -54,7 +54,7 @@ public function loadDocuments(string $updateTarget, array $entityIdsList): Docum","depth":17,"bounds":{"left":0.15242687,"top":0.50239426,"width":0.23503989,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"54","depth":15,"bounds":{"left":0.13547207,"top":0.5215483,"width":0.004654255,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":17,"bounds":{"left":0.15242687,"top":0.5215483,"width":0.03125,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"54","depth":15,"bounds":{"left":0.31432846,"top":0.5215483,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":17,"bounds":{"left":0.33144948,"top":0.5215483,"width":0.031083776,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8036458216422795369
|
-5940182200499003388
|
click
|
accessibility
|
NULL
|
New Tab
Close tab
Jy 20820 es reindex stream model New Tab
Close tab
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Skip to content
Skip to content
Open menu
Homepage (g then d)
jiminny
jiminny
app
app
Search or jump to…
Type
/
to search
Chat with Copilot
Open Copilot…
Create new...
All issues(g then i)
All pull requests
All repositories
You have unread notifications(g then n)
Open user navigation menu
Repository navigation
Repository navigation
Code
Code
Pull requests (34)
Pull requests
(
34
)
Agents
Agents
Actions
Actions
Wiki
Wiki
Security and quality (4)
Security and quality
(
4
)
Insights
Insights
Settings
Settings
Important update
Important update
On April 24 we'll start using GitHub Copilot interaction data for AI model training unless you opt out.
Review this update
Review this update
and manage your preferences in your
GitHub account settings
GitHub account settings
.
Dismiss banner
Jy 20820 es reindex stream model hydration #12059 Edit title
Jy 20820 es reindex stream model hydration
#
12059
Edit title
Preview
Preview
Checks pending
Checks pending
Code
Code
Open
Vasil-Jiminny
Vasil-Jiminny
wants to merge 36 commits into
master
master
from
JY-20820-es-reindex-stream-model-hydration
JY-20820-es-reindex-stream-model-hydration
Copy head branch name to clipboard
Lines changed: 363 additions & 140 deletions
Conversation (8)
Conversation
(
8
)
Commits (36)
Commits
(
36
)
Checks (2)
Checks
(
2
)
Files changed (12)
Files changed
(
12
)
Pull Request Toolbar
Pull Request Toolbar
Collapse file tree
Open
Jy 20820 es reindex stream model hydration
Jy 20820 es reindex stream model hydration
#
12059
Commit 098a688
Commit 098a688
Vasil-Jiminny
Vasil-Jiminny
wants to merge 36 commits into
master
master
from
JY-20820-es-reindex-stream-model-hydration
JY-20820-es-reindex-stream-model-hydration
Copy head branch name to clipboard
0 of 2 files viewed
Checks pending
Checks pending
Submit review
Submit
review
Open diff view settings
Open overview panel
Open comments panel
(
0
)
Filter files…
Filter options
File tree
File tree
app/Component/ES/Processor/Actions
LoadDocumentsAction.php
LoadDocumentsAction.php
tests/Unit/Component/ES/Processor/Actions
LoadDocumentsActionTest.php
LoadDocumentsActionTest.php
Usage of cursor introduced more problems - mainly no eager loading and keeping DB connection open and busy. For that reason it is swapped by LazyByIdDesc. Smaller batches are loaded in memory, cleaned up one by one. More smaller batches are loaded in general. If smaller batches help keep memory lower (at the cost of more smaller db requests), we will load more data, in smaller chunks.
Usage of cursor introduced more problems - mainly no eager loading and keeping DB connection open and busy. For that reason it is swapped by LazyByIdDesc. Smaller batches are loaded in memory, cleaned up one by one. More smaller batches are loaded in general. If smaller batches help keep memory lower (at the cost of more smaller db requests), we will load more data, in smaller chunks.
Previous commit
Prev
No next commit
Next
Browse files
Browse files
Vasil-Jiminny
commits by Vasil-Jiminny
Vasil-Jiminny
committed
3 days ago
·
Status checks: failure
8 / 10
commit
098a688
098a688
Copy full SHA for 098a688
Collapse file
app/Component/ES/Processor/Actions/LoadDocumentsAction.php
app/Component/ES/Processor/Actions/LoadDocumentsAction.php
app/Component/ES/Processor/Actions/LoadDocumentsAction.php
Copy file name to clipboard
Expand all lines: app/Component/ES/Processor/Actions/LoadDocumentsAction.php
Lines changed: 2 additions & 2 deletions
Not Viewed
Viewed
Comment on this file
More options
Original file line number
Original file line
Diff line number
Diff line change
@@ -29,7 +29,7 @@ public function loadDocuments(string $updateTarget, array $entityIdsList): Docum
29
$
query
=
$
this
->
queryBuilder
->
getEntityQuery
(
$
updateTarget
,
$
entityIdsList
);
29
$
query
=
$
this
->
queryBuilder
->
getEntityQuery
(
$
updateTarget
,
$
entityIdsList
);
30
30
31
/** @var Model&Searchable $entityModel */
31
/** @var Model&Searchable $entityModel */
32
-
foreach
(
$
query
->
cursor
(
)
as
$
entityModel
) {
32
+
foreach
(
$
query
->
lazyByIdDesc
(
50
,
'
id
'
)
as
$
entityModel
) {
33
if
(
$
entityModel
->
isDeleted
()) {
33
if
(
$
entityModel
->
isDeleted
()) {
34
/**
34
/**
35
* Cleanup (from ElasticSearch) scheduled entities that were recently deleted.
35
* Cleanup (from ElasticSearch) scheduled entities that were recently deleted.
@@ -54,7 +54,7 @@ public function loadDocuments(string $updateTarget, array $entityIdsList): Docum
54
}
54
}...
|
15626
|
NULL
|
NULL
|
NULL
|
|
18701
|
804
|
10
|
2026-05-11T11:40:46.297056+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778499646297_m1.jpg...
|
PhpStorm
|
faVsco.js – DeleteCrmEntityTrait.php
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
CodeFileEditSelectionViewGoRunTerminalWindowHelp$ CodeFileEditSelectionViewGoRunTerminalWindowHelp$ 0& Preparation for Refi... in 20 m100% <78• Mon 11 May 14:40:46181DEV (docker)-zshDOCKERO ₴1DEV (docker)$2APP (-zsh)H3compiledeventsroutesviewsJiminny-worker-processing-2:j1minny-worker-processing-2_00: stoppedjiminny-worker-processing-3:jiminny-worker-processing-3_00: stoppedjiminny-worker-processing-4:jiminny-worker-processing-4_00: stoppedjiminny-worker-processing-5:jiminny-worker-processing-5_00: stoppedjiminny-worker-processing-delayed: jiminny-worker-processing-delayed_00:stoppedworker-analytics:worker-analytics_00: stoppedworker-audio:worker-audio_00: stoppedworker-crm-update:worker-crm-update_00: stoppedworker-download:worker-download_00:stoppedworker-nudges:worker-nudges_00:stoppedjiminny-worker-processing-1:jiminny-worker-processing-1_00: stoppedworker:worker_00: stoppedworker-calendar:worker-calendar_00:stoppedworker-conferences:worker-conferences_00: stoppedworker-crm-sync:worker-crm-sync_00:stoppedworker-emails:worker-emails_00: stoppedworker-es-update:worker-es-update_00: stoppedartisan-schedule:artisan-schedule_00: stoppedartisan-schedule:artisan-schedule_00: startedjiminny-worker-processing-1:jiminny-worker-processing-1_00: startedjiminny-worker-processing-2:jiminny-worker-processing-2_00: startedjiminny-worker-processing-3:jiminny-worker-processing-3_00: startedjiminny-worker-processing-4:jiminny-worker-processing-4_00: startedjiminny-worker-processing-5:jiminny-worker-processing-5_00: startedjiminny-worker-processing-delayed: jiminny-worker-processing-delayed_00: startedworker:worker_00: startedworker-analytics:worker-analytics_00: startedworker-audio:worker-audio_00: startedworker-calendar:worker-calendar_00:startedworker-conferences:worker-conferences_00: startedworker-crm-sync:worker-crm-sync_00: startedworker-crm-update:worker-crm-update_00: startedworker-download:worker-download_00: startedworker-emails:worker-emails_00: startedworker-es-update:worker-es-update_00:startedworker-nudges:worker-nudges_00: startedroot@docker_lamp_1:/home/jiminny#php artisan jiminny:debugDispatching 100 MatchActivityCrmDatajobs (portal=2)Done.Watch logs and runjiminny:debug observeRateLimit to inspect cachestate.root@docker_lamp_1:/home/jiminny# ]84-zshX5screenpipe"O 8861.79ms DONE2.06ms DONE0.85ms DONE4.12ms DONE-zsh+DEV...
|
NULL
|
-8032353588260283074
|
NULL
|
click
|
ocr
|
NULL
|
CodeFileEditSelectionViewGoRunTerminalWindowHelp$ CodeFileEditSelectionViewGoRunTerminalWindowHelp$ 0& Preparation for Refi... in 20 m100% <78• Mon 11 May 14:40:46181DEV (docker)-zshDOCKERO ₴1DEV (docker)$2APP (-zsh)H3compiledeventsroutesviewsJiminny-worker-processing-2:j1minny-worker-processing-2_00: stoppedjiminny-worker-processing-3:jiminny-worker-processing-3_00: stoppedjiminny-worker-processing-4:jiminny-worker-processing-4_00: stoppedjiminny-worker-processing-5:jiminny-worker-processing-5_00: stoppedjiminny-worker-processing-delayed: jiminny-worker-processing-delayed_00:stoppedworker-analytics:worker-analytics_00: stoppedworker-audio:worker-audio_00: stoppedworker-crm-update:worker-crm-update_00: stoppedworker-download:worker-download_00:stoppedworker-nudges:worker-nudges_00:stoppedjiminny-worker-processing-1:jiminny-worker-processing-1_00: stoppedworker:worker_00: stoppedworker-calendar:worker-calendar_00:stoppedworker-conferences:worker-conferences_00: stoppedworker-crm-sync:worker-crm-sync_00:stoppedworker-emails:worker-emails_00: stoppedworker-es-update:worker-es-update_00: stoppedartisan-schedule:artisan-schedule_00: stoppedartisan-schedule:artisan-schedule_00: startedjiminny-worker-processing-1:jiminny-worker-processing-1_00: startedjiminny-worker-processing-2:jiminny-worker-processing-2_00: startedjiminny-worker-processing-3:jiminny-worker-processing-3_00: startedjiminny-worker-processing-4:jiminny-worker-processing-4_00: startedjiminny-worker-processing-5:jiminny-worker-processing-5_00: startedjiminny-worker-processing-delayed: jiminny-worker-processing-delayed_00: startedworker:worker_00: startedworker-analytics:worker-analytics_00: startedworker-audio:worker-audio_00: startedworker-calendar:worker-calendar_00:startedworker-conferences:worker-conferences_00: startedworker-crm-sync:worker-crm-sync_00: startedworker-crm-update:worker-crm-update_00: startedworker-download:worker-download_00: startedworker-emails:worker-emails_00: startedworker-es-update:worker-es-update_00:startedworker-nudges:worker-nudges_00: startedroot@docker_lamp_1:/home/jiminny#php artisan jiminny:debugDispatching 100 MatchActivityCrmDatajobs (portal=2)Done.Watch logs and runjiminny:debug observeRateLimit to inspect cachestate.root@docker_lamp_1:/home/jiminny# ]84-zshX5screenpipe"O 8861.79ms DONE2.06ms DONE0.85ms DONE4.12ms DONE-zsh+DEV...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
9323
|
421
|
14
|
2026-05-08T12:40:23.442725+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-08/1778 /Users/lukas/.screenpipe/data/data/2026-05-08/1778244023442_m1.jpg...
|
Firefox
|
Jy 20820 es reindex stream model hydration by Vasi Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app — Work...
|
True
|
github.com/jiminny/app/pull/12059/changes#diff-940 github.com/jiminny/app/pull/12059/changes#diff-940a2785a5caa141fc5cf73414adfa0cf94dc319d74d7215178ccf20020de76b...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 3 Q2 - Platform Team - Scrum Board Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Unnamed Group
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST [URL_WITH_CREDENTIALS] -0,0 +1,266 @@1+queryBuilder = $this->createMock(EntityQueryBuilder::class);29+$this->action = new LoadDocumentsAction($this->queryBuilder);30+ }31+32+public function testLoadDocumentsWithEntitiesToUpdate(): void33+ {34+$entityIds = [1, 2, 3];35+$updateTarget = UpdateTarget::ACTIVITY;36+37+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);38+$entity2 = $this->createEntityMock(2, false, ['field2' => 'value2']);39+$entity3 = $this->createEntityMock(3, false, ['field3' => 'value3']);40+41+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2, $entity3]);42+43+$this->queryBuilder44+ ->expects($this->once())45+ ->method('getEntityQuery')46+ ->with($updateTarget, $entityIds)47+ ->willReturn($queryBuilder);48+49+$result = $this->action->loadDocuments($updateTarget, $entityIds);50+51+$this->assertEquals(3, $result->getDocumentsToUpdate()->count());52+$this->assertEquals(0, $result->getDocumentsToDelete()->count());53+54+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();55+$this->assertInstanceOf(Document::class, $documentsToUpdate[0]);56+$this->assertEquals('1', $documentsToUpdate[0]->getId());57+$this->assertEquals(['field1' => 'value1'], $documentsToUpdate[0]->getData());58+ }59+60+public function testLoadDocumentsWithEntitiesToDelete(): void61+ {62+$entityIds = [1, 2];63+$updateTarget = UpdateTarget::OPPORTUNITY;64+65+$entity1 = $this->createEntityMock(1, true, []);66+$entity2 = $this->createEntityMock(2, true, []);67+68+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2]);69+70+$this->queryBuilder71+ ->expects($this->once())72+ ->method('getEntityQuery')73+ ->with($updateTarget, $entityIds)74+ ->willReturn($queryBuilder);75+76+$result = $this->action->loadDocuments($updateTarget, $entityIds);77+78+$this->assertEquals(0, $result->getDocumentsToUpdate()->count());79+$this->assertEquals(2, $result->getDocumentsToDelete()->count());80+81+$documentsToDelete = $result->getDocumentsToDelete()->toArray();82+$this->assertEquals(1, $documentsToDelete[0]);83+$this->assertEquals(2, $documentsToDelete[1]);84+ }85+86+public function testLoadDocumentsWithMixedEntities(): void87+ {88+$entityIds = [1, 2, 3, 4];89+$updateTarget = UpdateTarget::ACTIVITY;90+91+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);92+$entity2 = $this->createEntityMock(2, true, []);93+$entity3 = $this->createEntityMock(3, false, ['field3' => 'value3']);94+$entity4 = $this->createEntityMock(4, true, []);95+96+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2, $entity3, $entity4]);97+98+$this->queryBuilder99+ ->expects($this->once())100+ ->method('getEntityQuery')101+ ->with($updateTarget, $entityIds)102+ ->willReturn($queryBuilder);103+104+$result = $this->action->loadDocuments($updateTarget, $entityIds);105+106+$this->assertEquals(2, $result->getDocumentsToUpdate()->count());107+$this->assertEquals(2, $result->getDocumentsToDelete()->count());108+109+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();110+$this->assertEquals('1', $documentsToUpdate[0]->getId());111+$this->assertEquals('3', $documentsToUpdate[1]->getId());112+113+$documentsToDelete = $result->getDocumentsToDelete()->toArray();114+$this->assertEquals(2, $documentsToDelete[0]);115+$this->assertEquals(4, $documentsToDelete[1]);116+ }117+118+public function testLoadDocumentsHandlesExceptionWhenBuildingIndexableAttributes(): void119+ {120+$entityIds = [1, 2];121+$updateTarget = UpdateTarget::ACTIVITY;122+123+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);124+$entity2 = $this->createEntityMockWithException(2, false);125+126+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2]);127+128+$this->queryBuilder129+ ->expects($this->once())130+ ->method('getEntityQuery')131+ ->with($updateTarget, $entityIds)132+ ->willReturn($queryBuilder);133+134+$sentryMock = $this->createMock(SentryMock::class);135+$sentryMock->expects($this->once())136+ ->method('captureException')137+ ->with($this->isInstanceOf(SyncActivityException::class));138+139+ Sentry::swap($sentryMock);140+141+142+$result = $this->action->loadDocuments($updateTarget, $entityIds);143+144+$this->assertEquals(1, $result->getDocumentsToUpdate()->count());145+$this->assertEquals(0, $result->getDocumentsToDelete()->count());146+147+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();148+$this->assertEquals('1', $documentsToUpdate[0]->getId());149+ }150+151+public function testLoadDocumentsWithEmptyEntityList(): void152+ {153+$entityIds = [];154+$updateTarget = UpdateTarget::ACTIVITY;155+156+$queryBuilder = $this->createQueryBuilderMock([]);157+158+$this->queryBuilder159+ ->expects($this->once())160+ ->method('getEntityQuery')161+ ->with($updateTarget, $entityIds)162+ ->willReturn($queryBuilder);163+164+$result = $this->action->loadDocuments($updateTarget, $entityIds);165+166+$this->assertEquals(0, $result->getDocumentsToUpdate()->count());167+$this->assertEquals(0, $result->getDocumentsToDelete()->count());168+ }169+170+private function createEntityMock(int $id, bool $isDeleted, array $indexableAttributes): Searchable171+ {172+return new class ($id, $isDeleted, $indexableAttributes) implements Searchable {173+public function __construct(174+private int $id,175+private bool $isDeleted,176+private array $indexableAttributes177+ ) {178+ }179+180+public function getId(): int181+ {182+return $this->id;183+ }184+185+public function getIndex(): string186+ {187+return 'test_index';188+ }189+190+public function getSearchKey(): int191+ {192+return $this->id;193+ }194+195+public function getIndexableAttributes(): array196+ {197+return $this->indexableAttributes;198+ }199+200+public function isDeleted(): bool201+ {202+return $this->isDeleted;203+ }204+205+public function setRelations(array $relations): void206+ {207+ }208+ };209+ }210+211+private function createEntityMockWithException(int $id, bool $isDeleted): Searchable212+ {213+return new class ($id, $isDeleted) implements Searchable {214+public function __construct(215+private int $id,216+private bool $isDeleted217+ ) {218+ }219+220+public function getId(): int221+ {222+return $this->id;223+ }224+225+public function getIndex(): string226+ {227+return 'test_index';228+ }229+230+public function getSearchKey(): int231+ {232+return $this->id;233+ }234+235+public function getIndexableAttributes(): array236+ {237+throw new \RuntimeException('Failed to build indexable attributes');238+ }239+240+public function isDeleted(): bool241+ {242+return $this->isDeleted;243+ }244+245+public function setRelations(array $relations): void246+ {247+ }248+ };249+ }250+251+private function createQueryBuilderMock(array $entities): Builder&MockObject252+ {253+$queryBuilder = $this->createMock(Builder::class);254+$queryBuilder->method('cursor')->willReturn(new \ArrayIterator($entities));255+256+return $queryBuilder;257+ }258+}259+260+class SentryMock261+{262+public function captureException(Exception $e)263+ {264+// Do nothing.265+ }266+}</selection>” selected. Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.
You said
I’m on page “<tabTitle>Jy 20820 es reindex stream model hydration by Vasi</tabTitle>” with “<selection>@@ -0,0 +1,266 @@1+queryBuilder = $this->createMock(EntityQueryBuilder::class);29+$this->action = new LoadDocumentsAction($this->queryBuilder);30+ }31+32+public function testLoadDocumentsWithEntitiesToUpdate(): void33+ {34+$entityIds = [1, 2, 3];35+$updateTarget = UpdateTarget::ACTIVITY;36+37+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);38+$entity2 = $this->createEntityMock(2, false, ['field2' => 'value2']);39+$entity3 = $this->createEntityMock(3, false, ['field3' => 'value3']);40+41+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2, $entity3]);42+43+$this->queryBuilder44+ ->expects($this->once())45+ ->method('getEntityQuery')46+ ->with($updateTarget, $entityIds)47+ ->willReturn($queryBuilder);48+49+$result = $this->action->loadDocuments($updateTarget, $entityIds);50+51+$this->assertEquals(3, $result->getDocumentsToUpdate()->count());52+$this->assertEquals(0, $result->getDocumentsToDelete()->count());53+54+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();55+$this->assertInstanceOf(Document::class, $documentsToUpdate[0]);56+$this->assertEquals('1', $documentsToUpdate[0]->getId());57+$this->assertEquals(['field1' => 'value1'], $documentsToUpdate[0]->getData());58+ }59+60+public function testLoadDocumentsWithEntitiesToDelete(): void61+ {62+$entityIds = [1, 2];63+$updateTarget = UpdateTarget::OPPORTUNITY;64+65+$entity1 = $this->createEntityMock(1, true, []);66+$entity2 = $this->createEntityMock(2, true, []);67+68+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2]);69+70+$this->queryBuilder71+ ->expects($this->once())72+ ->method('getEntityQuery')73+ ->with($updateTarget, $entityIds)74+ ->willReturn($queryBuilder);75+76+$result = $this->action->loadDocuments($updateTarget, $entityIds);77+78+$this->assertEquals(0, $result->getDocumentsToUpdate()->count());79+$this->assertEquals(2, $result->getDocumentsToDelete()->count());80+81+$documentsToDelete = $result->getDocumentsToDelete()->toArray();82+$this->assertEquals(1, $documentsToDelete[0]);83+$this->assertEquals(2, $documentsToDelete[1]);84+ }85+86+public function testLoadDocumentsWithMixedEntities(): void87+ {88+$entityIds = [1, 2, 3, 4];89+$updateTarget = UpdateTarget::ACTIVITY;90+91+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);92+$entity2 = $this->createEntityMock(2, true, []);93+$entity3 = $this->createEntityMock(3, false, ['field3' => 'value3']);94+$entity4 = $this->createEntityMock(4, true, []);95+96+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2, $entity3, $entity4]);97+98+$this->queryBuilder99+ ->expects($this->once())100+ ->method('getEntityQuery')101+ ->with($updateTarget, $entityIds)102+ ->willReturn($queryBuilder);103+104+$result = $this->action->loadDocuments($updateTarget, $entityIds);105+106+$this->assertEquals(2, $result->getDocumentsToUpdate()->count());107+$this->assertEquals(2, $result->getDocumentsToDelete()->count());108+109+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();110+$this->assertEquals('1', $documentsToUpdate[0]->getId());111+$this->assertEquals('3', $documentsToUpdate[1]->getId());112+113+$documentsToDelete = $result->getDocumentsToDelete()->toArray();114+$this->assertEquals(2, $documentsToDelete[0]);115+$this->assertEquals(4, $documentsToDelete[1]);116+ }117+118+public function testLoadDocumentsHandlesExceptionWhenBuildingIndexableAttributes(): void119+ {120+$entityIds = [1, 2];121+$updateTarget = UpdateTarget::ACTIVITY;122+123+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);124+$entity2 = $this->createEntityMockWithException(2, false);125+126+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2]);127+128+$this->queryBuilder129+ ->expects($this->once())130+ ->method('getEntityQuery')131+ ->with($updateTarget, $entityIds)132+ ->willReturn($queryBuilder);133+134+$sentryMock = $this->createMock(SentryMock::class);135+$sentryMock->expects($this->once())136+ ->method('captureException')137+ ->with($this->isInstanceOf(SyncActivityException::class));138+139+ Sentry::swap($sentryMock);140+141+142+$result = $this->action->loadDocuments($updateTarget, $entityIds);143+144+$this->assertEquals(1, $result->getDocumentsToUpdate()->count());145+$this->assertEquals(0, $result->getDocumentsToDelete()->count());146+147+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();148+$this->assertEquals('1', $documentsToUpdate[0]->getId());149+ }150+151+public function testLoadDocumentsWithEmptyEntityList(): void152+ {153+$entityIds = [];154+$updateTarget = UpdateTarget::ACTIVITY;155+156+$queryBuilder = $this->createQueryBuilderMock([]);157+158+$this->queryBuilder159+ ->expects($this->once())160+ ->method('getEntityQuery')161+ ->with($updateTarget, $entityIds)162+ ->willReturn($queryBuilder);163+164+$result = $this->action->loadDocuments($updateTarget, $entityIds);165+166+$this->assertEquals(0, $result->getDocumentsToUpdate()->count());167+$this->assertEquals(0, $result->getDocumentsToDelete()->count());168+ }169+170+private function createEntityMock(int $id, bool $isDeleted, array $indexableAttributes): Searchable171+ {172+return new class ($id, $isDeleted, $indexableAttributes) implements Searchable {173+public function __construct(174+private int $id,175+private bool $isDeleted,176+private array $indexableAttributes177+ ) {178+ }179+180+public function getId(): int181+ {182+return $this->id;183+ }184+185+public function getIndex(): string186+ {187+return 'test_index';188+ }189+190+public function getSearchKey(): int191+ {192+return $this->id;193+ }194+195+public function getIndexableAttributes(): array196+ {197+return $this->indexableAttributes;198+ }199+200+public function isDeleted(): bool201+ {202+return $this->isDeleted;203+ }204+205+public function setRelations(array $relations): void206+ {207+ }208+ };209+ }210+211+private function createEntityMockWithException(int $id, bool $isDeleted): Searchable212+ {213+return new class ($id, $isDeleted) implements Searchable {214+public function __construct(215+private int $id,216+private bool $isDeleted217+ ) {218+ }219+220+public function getId(): int221+ {222+return $this->id;223+ }224+225+public function getIndex(): string226+ {227+return 'test_index';228+ }229+230+public function getSearchKey(): int231+ {232+return $this->id;233+ }234+235+public function getIndexableAttributes(): array236+ {237+throw new \RuntimeException('Failed to build indexable attributes');238+ }239+240+public function isDeleted(): bool241+ {242+return $this->isDeleted;243+ }244+245+public function setRelations(array $relations): void246+ {247+ }248+ };249+ }250+251+private function createQueryBuilderMock(array $entities): Builder&MockObject252+ {253+$queryBuilder = $this->createMock(Builder::class);254+$queryBuilder->method('cursor')->willReturn(new \ArrayIterator($entities));255+256+return $queryBuilder;257+ }258+}259+260+class SentryMock261+{262+public function captureException(Exception $e)263+ {264+// Do nothing.265+ }266+}</selection>” selected.
Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.
Expand
Listen
Gemini said
Gemini said
This selection contains unit tests for the
LoadDocumentsAction
class, specifically focusing on the
loadDocuments
method. The tests verify how the system hydrates search engine document models from database entities, handling updates, deletions, and exceptions.
Core Functionality Tested
Core Functionality Tested
The tests use a mocked
EntityQueryBuilder
and anonymous
Searchable
classes to simulate different hydration scenarios:
Document Updates:
Verifies that active entities are correctly transformed into
Document
objects containing the expected ID and data (indexable attributes).
Document Deletions:
Ensures that entities flagged as
isDeleted
are processed for removal from the search index.
Mixed Results:
Validates the ability to process a collection containing both updateable and deletable entities in a single stream.
Empty Result Sets:
Confirms the system handles empty entity lists gracefully without errors.
Error Handling & Resilience
Error Handling & Resilience
Exception Catching:
A specific test case (
testLoadDocumentsHandlesExceptionWhenBuildingIndexableAttributes
) ensures that if a single entity fails to hydrate due to an exception, the system:
Logs the error to
Sentry
using a
SyncActivityException
.
Continues processing other valid entities in the stream rather than failing the entire batch.
Technical Implementation Details
Technical Implementation Details
Mocking Strategy:
Uses
createMock
for dependencies and a custom
createEntityMock
helper to generate anonymous classes implementing the
Searchable
interface.
Assertions:
Utilizes PHPUnit assertions like
assertEquals
,
assertInstanceOf
, and
count
to verify the state of the returned result object.
Iterator Usage:
The
createQueryBuilderMock
uses an
ArrayIterator
to simulate a database cursor, reflecting the streaming nature of the hydration process.
Good response
Bad response
Share & export
Copy
Show more options
Copy prompt
You said Role: You are a Technical Lead. Your task is to provide a clear, high-level summary of the provided code diff or PR selection. Instructions: Summarize the core objective: Explain what the code is doing and why (if apparent from the context) using precise and concise language. Highlight key changes: Break down the structural or logical changes made in the code. Formatting: Use headers and bulleted lists to make the summary highly scannable for a developer. Avoid long paragraphs. Accuracy: Maintain the exact meaning and factual accuracy of the provided code without hallucinating outside context.
You said
Role: You are a Technical Lead. Your task is to provide a clear, high-level summary of the provided code diff or PR selection.
Instructions:
Summarize the core objective: Explain what the code is doing and why (if apparent from the context) using precise and concise language.
Highlight key changes: Break down the structural or logical changes made in the code.
Formatting: Use headers and bulleted lists to make the summary highly scannable for a developer. Avoid long paragraphs.
Accuracy: Maintain the exact meaning and factual accuracy of the provided code without hallucinating outside context.
Expand
Listen
Show more options
Show thinking
Gemini said
Gemini said
Core Objective
Core Objective
This selection introduces a comprehensive suite of PHPUnit tests for the
LoadDocumentsAction
class. The goal is to verify the logic of the
loadDocuments
method, ensuring it correctly transforms streamed database entities into search-indexable documents, accurately segregates them into "update" and "delete" queues, and handles individual hydration failures without crashing the entire batch process.
Key Behaviors Verified
Key Behaviors Verified
Standard Hydration:
Confirms that active entities (
isDeleted = false
) are properly parsed into
Document
objects containing the correct IDs and indexable attributes.
Deletion Handling:
Ensures entities flagged as deleted (
isDeleted = true
) are added to the deletion queue and excluded from the update queue.
Mixed Batch Processing:
Validates the system's ability to process a single stream containing both active and deleted entities, successfully splitting them into their respective queues.
Empty Result Sets:
Verifies that providing an empty list of entity IDs resolves gracefully, returning zero documents to update or delete without error.
Fault Tolerance:
Ensures that if a specific entity throws an exception during attribute generation, the error is logged to Sentry (as a
SyncActivityException
), and the system successfully continues processing the remaining valid entities.
Structural & Mocking Changes
Structural & Mocking Changes
Anonymous Class Mocks:
Introduces helper methods (
createEntityMock
,
createEntityMockWithException
) that utilize anonymous classes implementing the
Searchable
interface to simulate different entity states cleanly.
Cursor Simulation:
Mocks the
EntityQueryBuilder
to return an
ArrayIterator
via a
cursor()
method, mimicking the streaming behavior of a database query.
Sentry Facade Swapping:
Implements a
SentryMock
to intercept and assert exception handling logic without triggering actual Sentry events during test execution.
Good response...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Unnamed Group","depth":4,"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXRadioButton","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Service-Desk - Queues - Platform team - Service space - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Service-Desk - Queues - Platform team - Service space - Jira","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jy 20807 check various issues with stages by nikolaybiaivanov · Pull Request #12041 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jy 20807 check various issues with stages by nikolaybiaivanov · Pull Request #12041 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20818 move ask jiminny reports to its own datadog metric by LakyLak · Pull Request #12056 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20818 move ask jiminny reports to its own datadog metric by LakyLak · Pull Request #12056 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Userpilot | Ask Jiminny Report Generated","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Userpilot | Ask Jiminny Report Generated","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Problem loading page","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Problem loading page","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search the CRM - HubSpot docs","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search the CRM - HubSpot docs","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"AI Features | Datadog","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"AI Features | Datadog","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jy 20493 smart instant nudge pre filtering by nikolaybiaivanov · Pull Request #12053 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jy 20493 smart instant nudge pre filtering by nikolaybiaivanov · Pull Request #12053 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Close Google Gemini (⌃X)","depth":6,"bounds":{"left":0.0,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.0,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.0,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.0013888889,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"AI Chat settings","depth":7,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":7,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"WORK, Google Account: lukas.kovalik@jiminny.com","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Main menu","depth":12,"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Chat","depth":12,"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open menu for conversation actions.","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"Conversation with Gemini","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Conversation with Gemini","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy prompt","depth":21,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"You said I’m on page “<tabTitle>Jy 20820 es reindex stream model hydration by Vasi</tabTitle>” with “<selection>@@ -0,0 +1,266 @@1+queryBuilder = $this->createMock(EntityQueryBuilder::class);29+$this->action = new LoadDocumentsAction($this->queryBuilder);30+ }31+32+public function testLoadDocumentsWithEntitiesToUpdate(): void33+ {34+$entityIds = [1, 2, 3];35+$updateTarget = UpdateTarget::ACTIVITY;36+37+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);38+$entity2 = $this->createEntityMock(2, false, ['field2' => 'value2']);39+$entity3 = $this->createEntityMock(3, false, ['field3' => 'value3']);40+41+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2, $entity3]);42+43+$this->queryBuilder44+ ->expects($this->once())45+ ->method('getEntityQuery')46+ ->with($updateTarget, $entityIds)47+ ->willReturn($queryBuilder);48+49+$result = $this->action->loadDocuments($updateTarget, $entityIds);50+51+$this->assertEquals(3, $result->getDocumentsToUpdate()->count());52+$this->assertEquals(0, $result->getDocumentsToDelete()->count());53+54+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();55+$this->assertInstanceOf(Document::class, $documentsToUpdate[0]);56+$this->assertEquals('1', $documentsToUpdate[0]->getId());57+$this->assertEquals(['field1' => 'value1'], $documentsToUpdate[0]->getData());58+ }59+60+public function testLoadDocumentsWithEntitiesToDelete(): void61+ {62+$entityIds = [1, 2];63+$updateTarget = UpdateTarget::OPPORTUNITY;64+65+$entity1 = $this->createEntityMock(1, true, []);66+$entity2 = $this->createEntityMock(2, true, []);67+68+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2]);69+70+$this->queryBuilder71+ ->expects($this->once())72+ ->method('getEntityQuery')73+ ->with($updateTarget, $entityIds)74+ ->willReturn($queryBuilder);75+76+$result = $this->action->loadDocuments($updateTarget, $entityIds);77+78+$this->assertEquals(0, $result->getDocumentsToUpdate()->count());79+$this->assertEquals(2, $result->getDocumentsToDelete()->count());80+81+$documentsToDelete = $result->getDocumentsToDelete()->toArray();82+$this->assertEquals(1, $documentsToDelete[0]);83+$this->assertEquals(2, $documentsToDelete[1]);84+ }85+86+public function testLoadDocumentsWithMixedEntities(): void87+ {88+$entityIds = [1, 2, 3, 4];89+$updateTarget = UpdateTarget::ACTIVITY;90+91+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);92+$entity2 = $this->createEntityMock(2, true, []);93+$entity3 = $this->createEntityMock(3, false, ['field3' => 'value3']);94+$entity4 = $this->createEntityMock(4, true, []);95+96+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2, $entity3, $entity4]);97+98+$this->queryBuilder99+ ->expects($this->once())100+ ->method('getEntityQuery')101+ ->with($updateTarget, $entityIds)102+ ->willReturn($queryBuilder);103+104+$result = $this->action->loadDocuments($updateTarget, $entityIds);105+106+$this->assertEquals(2, $result->getDocumentsToUpdate()->count());107+$this->assertEquals(2, $result->getDocumentsToDelete()->count());108+109+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();110+$this->assertEquals('1', $documentsToUpdate[0]->getId());111+$this->assertEquals('3', $documentsToUpdate[1]->getId());112+113+$documentsToDelete = $result->getDocumentsToDelete()->toArray();114+$this->assertEquals(2, $documentsToDelete[0]);115+$this->assertEquals(4, $documentsToDelete[1]);116+ }117+118+public function testLoadDocumentsHandlesExceptionWhenBuildingIndexableAttributes(): void119+ {120+$entityIds = [1, 2];121+$updateTarget = UpdateTarget::ACTIVITY;122+123+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);124+$entity2 = $this->createEntityMockWithException(2, false);125+126+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2]);127+128+$this->queryBuilder129+ ->expects($this->once())130+ ->method('getEntityQuery')131+ ->with($updateTarget, $entityIds)132+ ->willReturn($queryBuilder);133+134+$sentryMock = $this->createMock(SentryMock::class);135+$sentryMock->expects($this->once())136+ ->method('captureException')137+ ->with($this->isInstanceOf(SyncActivityException::class));138+139+ Sentry::swap($sentryMock);140+141+142+$result = $this->action->loadDocuments($updateTarget, $entityIds);143+144+$this->assertEquals(1, $result->getDocumentsToUpdate()->count());145+$this->assertEquals(0, $result->getDocumentsToDelete()->count());146+147+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();148+$this->assertEquals('1', $documentsToUpdate[0]->getId());149+ }150+151+public function testLoadDocumentsWithEmptyEntityList(): void152+ {153+$entityIds = [];154+$updateTarget = UpdateTarget::ACTIVITY;155+156+$queryBuilder = $this->createQueryBuilderMock([]);157+158+$this->queryBuilder159+ ->expects($this->once())160+ ->method('getEntityQuery')161+ ->with($updateTarget, $entityIds)162+ ->willReturn($queryBuilder);163+164+$result = $this->action->loadDocuments($updateTarget, $entityIds);165+166+$this->assertEquals(0, $result->getDocumentsToUpdate()->count());167+$this->assertEquals(0, $result->getDocumentsToDelete()->count());168+ }169+170+private function createEntityMock(int $id, bool $isDeleted, array $indexableAttributes): Searchable171+ {172+return new class ($id, $isDeleted, $indexableAttributes) implements Searchable {173+public function __construct(174+private int $id,175+private bool $isDeleted,176+private array $indexableAttributes177+ ) {178+ }179+180+public function getId(): int181+ {182+return $this->id;183+ }184+185+public function getIndex(): string186+ {187+return 'test_index';188+ }189+190+public function getSearchKey(): int191+ {192+return $this->id;193+ }194+195+public function getIndexableAttributes(): array196+ {197+return $this->indexableAttributes;198+ }199+200+public function isDeleted(): bool201+ {202+return $this->isDeleted;203+ }204+205+public function setRelations(array $relations): void206+ {207+ }208+ };209+ }210+211+private function createEntityMockWithException(int $id, bool $isDeleted): Searchable212+ {213+return new class ($id, $isDeleted) implements Searchable {214+public function __construct(215+private int $id,216+private bool $isDeleted217+ ) {218+ }219+220+public function getId(): int221+ {222+return $this->id;223+ }224+225+public function getIndex(): string226+ {227+return 'test_index';228+ }229+230+public function getSearchKey(): int231+ {232+return $this->id;233+ }234+235+public function getIndexableAttributes(): array236+ {237+throw new \\RuntimeException('Failed to build indexable attributes');238+ }239+240+public function isDeleted(): bool241+ {242+return $this->isDeleted;243+ }244+245+public function setRelations(array $relations): void246+ {247+ }248+ };249+ }250+251+private function createQueryBuilderMock(array $entities): Builder&MockObject252+ {253+$queryBuilder = $this->createMock(Builder::class);254+$queryBuilder->method('cursor')->willReturn(new \\ArrayIterator($entities));255+256+return $queryBuilder;257+ }258+}259+260+class SentryMock261+{262+public function captureException(Exception $e)263+ {264+// Do nothing.265+ }266+}</selection>” selected. Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You said","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"I’m on page “<tabTitle>Jy 20820 es reindex stream model hydration by Vasi</tabTitle>” with “<selection>@@ -0,0 +1,266 @@1+queryBuilder = $this->createMock(EntityQueryBuilder::class);29+$this->action = new LoadDocumentsAction($this->queryBuilder);30+ }31+32+public function testLoadDocumentsWithEntitiesToUpdate(): void33+ {34+$entityIds = [1, 2, 3];35+$updateTarget = UpdateTarget::ACTIVITY;36+37+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);38+$entity2 = $this->createEntityMock(2, false, ['field2' => 'value2']);39+$entity3 = $this->createEntityMock(3, false, ['field3' => 'value3']);40+41+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2, $entity3]);42+43+$this->queryBuilder44+ ->expects($this->once())45+ ->method('getEntityQuery')46+ ->with($updateTarget, $entityIds)47+ ->willReturn($queryBuilder);48+49+$result = $this->action->loadDocuments($updateTarget, $entityIds);50+51+$this->assertEquals(3, $result->getDocumentsToUpdate()->count());52+$this->assertEquals(0, $result->getDocumentsToDelete()->count());53+54+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();55+$this->assertInstanceOf(Document::class, $documentsToUpdate[0]);56+$this->assertEquals('1', $documentsToUpdate[0]->getId());57+$this->assertEquals(['field1' => 'value1'], $documentsToUpdate[0]->getData());58+ }59+60+public function testLoadDocumentsWithEntitiesToDelete(): void61+ {62+$entityIds = [1, 2];63+$updateTarget = UpdateTarget::OPPORTUNITY;64+65+$entity1 = $this->createEntityMock(1, true, []);66+$entity2 = $this->createEntityMock(2, true, []);67+68+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2]);69+70+$this->queryBuilder71+ ->expects($this->once())72+ ->method('getEntityQuery')73+ ->with($updateTarget, $entityIds)74+ ->willReturn($queryBuilder);75+76+$result = $this->action->loadDocuments($updateTarget, $entityIds);77+78+$this->assertEquals(0, $result->getDocumentsToUpdate()->count());79+$this->assertEquals(2, $result->getDocumentsToDelete()->count());80+81+$documentsToDelete = $result->getDocumentsToDelete()->toArray();82+$this->assertEquals(1, $documentsToDelete[0]);83+$this->assertEquals(2, $documentsToDelete[1]);84+ }85+86+public function testLoadDocumentsWithMixedEntities(): void87+ {88+$entityIds = [1, 2, 3, 4];89+$updateTarget = UpdateTarget::ACTIVITY;90+91+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);92+$entity2 = $this->createEntityMock(2, true, []);93+$entity3 = $this->createEntityMock(3, false, ['field3' => 'value3']);94+$entity4 = $this->createEntityMock(4, true, []);95+96+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2, $entity3, $entity4]);97+98+$this->queryBuilder99+ ->expects($this->once())100+ ->method('getEntityQuery')101+ ->with($updateTarget, $entityIds)102+ ->willReturn($queryBuilder);103+104+$result = $this->action->loadDocuments($updateTarget, $entityIds);105+106+$this->assertEquals(2, $result->getDocumentsToUpdate()->count());107+$this->assertEquals(2, $result->getDocumentsToDelete()->count());108+109+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();110+$this->assertEquals('1', $documentsToUpdate[0]->getId());111+$this->assertEquals('3', $documentsToUpdate[1]->getId());112+113+$documentsToDelete = $result->getDocumentsToDelete()->toArray();114+$this->assertEquals(2, $documentsToDelete[0]);115+$this->assertEquals(4, $documentsToDelete[1]);116+ }117+118+public function testLoadDocumentsHandlesExceptionWhenBuildingIndexableAttributes(): void119+ {120+$entityIds = [1, 2];121+$updateTarget = UpdateTarget::ACTIVITY;122+123+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);124+$entity2 = $this->createEntityMockWithException(2, false);125+126+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2]);127+128+$this->queryBuilder129+ ->expects($this->once())130+ ->method('getEntityQuery')131+ ->with($updateTarget, $entityIds)132+ ->willReturn($queryBuilder);133+134+$sentryMock = $this->createMock(SentryMock::class);135+$sentryMock->expects($this->once())136+ ->method('captureException')137+ ->with($this->isInstanceOf(SyncActivityException::class));138+139+ Sentry::swap($sentryMock);140+141+142+$result = $this->action->loadDocuments($updateTarget, $entityIds);143+144+$this->assertEquals(1, $result->getDocumentsToUpdate()->count());145+$this->assertEquals(0, $result->getDocumentsToDelete()->count());146+147+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();148+$this->assertEquals('1', $documentsToUpdate[0]->getId());149+ }150+151+public function testLoadDocumentsWithEmptyEntityList(): void152+ {153+$entityIds = [];154+$updateTarget = UpdateTarget::ACTIVITY;155+156+$queryBuilder = $this->createQueryBuilderMock([]);157+158+$this->queryBuilder159+ ->expects($this->once())160+ ->method('getEntityQuery')161+ ->with($updateTarget, $entityIds)162+ ->willReturn($queryBuilder);163+164+$result = $this->action->loadDocuments($updateTarget, $entityIds);165+166+$this->assertEquals(0, $result->getDocumentsToUpdate()->count());167+$this->assertEquals(0, $result->getDocumentsToDelete()->count());168+ }169+170+private function createEntityMock(int $id, bool $isDeleted, array $indexableAttributes): Searchable171+ {172+return new class ($id, $isDeleted, $indexableAttributes) implements Searchable {173+public function __construct(174+private int $id,175+private bool $isDeleted,176+private array $indexableAttributes177+ ) {178+ }179+180+public function getId(): int181+ {182+return $this->id;183+ }184+185+public function getIndex(): string186+ {187+return 'test_index';188+ }189+190+public function getSearchKey(): int191+ {192+return $this->id;193+ }194+195+public function getIndexableAttributes(): array196+ {197+return $this->indexableAttributes;198+ }199+200+public function isDeleted(): bool201+ {202+return $this->isDeleted;203+ }204+205+public function setRelations(array $relations): void206+ {207+ }208+ };209+ }210+211+private function createEntityMockWithException(int $id, bool $isDeleted): Searchable212+ {213+return new class ($id, $isDeleted) implements Searchable {214+public function __construct(215+private int $id,216+private bool $isDeleted217+ ) {218+ }219+220+public function getId(): int221+ {222+return $this->id;223+ }224+225+public function getIndex(): string226+ {227+return 'test_index';228+ }229+230+public function getSearchKey(): int231+ {232+return $this->id;233+ }234+235+public function getIndexableAttributes(): array236+ {237+throw new \\RuntimeException('Failed to build indexable attributes');238+ }239+240+public function isDeleted(): bool241+ {242+return $this->isDeleted;243+ }244+245+public function setRelations(array $relations): void246+ {247+ }248+ };249+ }250+251+private function createQueryBuilderMock(array $entities): Builder&MockObject252+ {253+$queryBuilder = $this->createMock(Builder::class);254+$queryBuilder->method('cursor')->willReturn(new \\ArrayIterator($entities));255+256+return $queryBuilder;257+ }258+}259+260+class SentryMock261+{262+public function captureException(Exception $e)263+ {264+// Do nothing.265+ }266+}</selection>” selected.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Expand","depth":21,"on_screen":false,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Listen","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Gemini said","depth":20,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Gemini said","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This selection contains unit tests for the","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"LoadDocumentsAction","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"class, specifically focusing on the","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"loadDocuments","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"method. The tests verify how the system hydrates search engine document models from database entities, handling updates, deletions, and exceptions.","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Core Functionality Tested","depth":23,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Core Functionality Tested","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"The tests use a mocked","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"EntityQueryBuilder","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"and anonymous","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Searchable","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"classes to simulate different hydration scenarios:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Document Updates:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Verifies that active entities are correctly transformed into","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Document","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"objects containing the expected ID and data (indexable attributes).","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Document Deletions:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ensures that entities flagged as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"isDeleted","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"are processed for removal from the search index.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mixed Results:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Validates the ability to process a collection containing both updateable and deletable entities in a single stream.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Empty Result Sets:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Confirms the system handles empty entity lists gracefully without errors.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Error Handling & Resilience","depth":23,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Error Handling & Resilience","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exception Catching:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A specific test case (","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"testLoadDocumentsHandlesExceptionWhenBuildingIndexableAttributes","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") ensures that if a single entity fails to hydrate due to an exception, the system:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Logs the error to","depth":28,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Sentry","depth":28,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"using a","depth":28,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SyncActivityException","depth":29,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":28,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Continues processing other valid entities in the stream rather than failing the entire batch.","depth":28,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Technical Implementation Details","depth":23,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Technical Implementation Details","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mocking Strategy:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Uses","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"createMock","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"for dependencies and a custom","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"createEntityMock","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"helper to generate anonymous classes implementing the","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Searchable","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"interface.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Assertions:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Utilizes PHPUnit assertions like","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"assertEquals","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"assertInstanceOf","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", and","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"count","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to verify the state of the returned result object.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Iterator Usage:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"The","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"createQueryBuilderMock","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"uses an","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ArrayIterator","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to simulate a database cursor, reflecting the streaming nature of the hydration process.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Good response","depth":22,"on_screen":false,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bad response","depth":22,"on_screen":false,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Share & export","depth":21,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show more options","depth":21,"on_screen":false,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy prompt","depth":21,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"You said Role: You are a Technical Lead. Your task is to provide a clear, high-level summary of the provided code diff or PR selection. Instructions: Summarize the core objective: Explain what the code is doing and why (if apparent from the context) using precise and concise language. Highlight key changes: Break down the structural or logical changes made in the code. Formatting: Use headers and bulleted lists to make the summary highly scannable for a developer. Avoid long paragraphs. Accuracy: Maintain the exact meaning and factual accuracy of the provided code without hallucinating outside context.","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You said","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Role: You are a Technical Lead. Your task is to provide a clear, high-level summary of the provided code diff or PR selection.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Instructions:","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Summarize the core objective: Explain what the code is doing and why (if apparent from the context) using precise and concise language.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Highlight key changes: Break down the structural or logical changes made in the code.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Formatting: Use headers and bulleted lists to make the summary highly scannable for a developer. Avoid long paragraphs.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Accuracy: Maintain the exact meaning and factual accuracy of the provided code without hallucinating outside context.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Expand","depth":21,"on_screen":false,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Listen","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show more options","depth":20,"on_screen":false,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Show thinking","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Gemini said","depth":20,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Gemini said","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Core Objective","depth":23,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Core Objective","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This selection introduces a comprehensive suite of PHPUnit tests for the","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"LoadDocumentsAction","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"class. The goal is to verify the logic of the","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"loadDocuments","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"method, ensuring it correctly transforms streamed database entities into search-indexable documents, accurately segregates them into \"update\" and \"delete\" queues, and handles individual hydration failures without crashing the entire batch process.","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Key Behaviors Verified","depth":23,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Key Behaviors Verified","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Standard Hydration:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Confirms that active entities (","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"isDeleted = false","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") are properly parsed into","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Document","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"objects containing the correct IDs and indexable attributes.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Deletion Handling:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ensures entities flagged as deleted (","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"isDeleted = true","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") are added to the deletion queue and excluded from the update queue.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mixed Batch Processing:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Validates the system's ability to process a single stream containing both active and deleted entities, successfully splitting them into their respective queues.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Empty Result Sets:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Verifies that providing an empty list of entity IDs resolves gracefully, returning zero documents to update or delete without error.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Fault Tolerance:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ensures that if a specific entity throws an exception during attribute generation, the error is logged to Sentry (as a","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SyncActivityException","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"), and the system successfully continues processing the remaining valid entities.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Structural & Mocking Changes","depth":23,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Structural & Mocking Changes","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Anonymous Class Mocks:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Introduces helper methods (","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"createEntityMock","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"createEntityMockWithException","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") that utilize anonymous classes implementing the","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Searchable","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"interface to simulate different entity states cleanly.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Cursor Simulation:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mocks the","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"EntityQueryBuilder","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to return an","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ArrayIterator","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"via a","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"cursor()","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"method, mimicking the streaming behavior of a database query.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Sentry Facade Swapping:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Implements a","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SentryMock","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to intercept and assert exception handling logic without triggering actual Sentry events during test execution.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Good response","depth":22,"on_screen":false,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false}]...
|
-8032021776412697460
|
-3799236680972561530
|
click
|
accessibility
|
NULL
|
Platform Sprint 3 Q2 - Platform Team - Scrum Board Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Unnamed Group
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST [URL_WITH_CREDENTIALS] -0,0 +1,266 @@1+queryBuilder = $this->createMock(EntityQueryBuilder::class);29+$this->action = new LoadDocumentsAction($this->queryBuilder);30+ }31+32+public function testLoadDocumentsWithEntitiesToUpdate(): void33+ {34+$entityIds = [1, 2, 3];35+$updateTarget = UpdateTarget::ACTIVITY;36+37+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);38+$entity2 = $this->createEntityMock(2, false, ['field2' => 'value2']);39+$entity3 = $this->createEntityMock(3, false, ['field3' => 'value3']);40+41+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2, $entity3]);42+43+$this->queryBuilder44+ ->expects($this->once())45+ ->method('getEntityQuery')46+ ->with($updateTarget, $entityIds)47+ ->willReturn($queryBuilder);48+49+$result = $this->action->loadDocuments($updateTarget, $entityIds);50+51+$this->assertEquals(3, $result->getDocumentsToUpdate()->count());52+$this->assertEquals(0, $result->getDocumentsToDelete()->count());53+54+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();55+$this->assertInstanceOf(Document::class, $documentsToUpdate[0]);56+$this->assertEquals('1', $documentsToUpdate[0]->getId());57+$this->assertEquals(['field1' => 'value1'], $documentsToUpdate[0]->getData());58+ }59+60+public function testLoadDocumentsWithEntitiesToDelete(): void61+ {62+$entityIds = [1, 2];63+$updateTarget = UpdateTarget::OPPORTUNITY;64+65+$entity1 = $this->createEntityMock(1, true, []);66+$entity2 = $this->createEntityMock(2, true, []);67+68+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2]);69+70+$this->queryBuilder71+ ->expects($this->once())72+ ->method('getEntityQuery')73+ ->with($updateTarget, $entityIds)74+ ->willReturn($queryBuilder);75+76+$result = $this->action->loadDocuments($updateTarget, $entityIds);77+78+$this->assertEquals(0, $result->getDocumentsToUpdate()->count());79+$this->assertEquals(2, $result->getDocumentsToDelete()->count());80+81+$documentsToDelete = $result->getDocumentsToDelete()->toArray();82+$this->assertEquals(1, $documentsToDelete[0]);83+$this->assertEquals(2, $documentsToDelete[1]);84+ }85+86+public function testLoadDocumentsWithMixedEntities(): void87+ {88+$entityIds = [1, 2, 3, 4];89+$updateTarget = UpdateTarget::ACTIVITY;90+91+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);92+$entity2 = $this->createEntityMock(2, true, []);93+$entity3 = $this->createEntityMock(3, false, ['field3' => 'value3']);94+$entity4 = $this->createEntityMock(4, true, []);95+96+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2, $entity3, $entity4]);97+98+$this->queryBuilder99+ ->expects($this->once())100+ ->method('getEntityQuery')101+ ->with($updateTarget, $entityIds)102+ ->willReturn($queryBuilder);103+104+$result = $this->action->loadDocuments($updateTarget, $entityIds);105+106+$this->assertEquals(2, $result->getDocumentsToUpdate()->count());107+$this->assertEquals(2, $result->getDocumentsToDelete()->count());108+109+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();110+$this->assertEquals('1', $documentsToUpdate[0]->getId());111+$this->assertEquals('3', $documentsToUpdate[1]->getId());112+113+$documentsToDelete = $result->getDocumentsToDelete()->toArray();114+$this->assertEquals(2, $documentsToDelete[0]);115+$this->assertEquals(4, $documentsToDelete[1]);116+ }117+118+public function testLoadDocumentsHandlesExceptionWhenBuildingIndexableAttributes(): void119+ {120+$entityIds = [1, 2];121+$updateTarget = UpdateTarget::ACTIVITY;122+123+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);124+$entity2 = $this->createEntityMockWithException(2, false);125+126+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2]);127+128+$this->queryBuilder129+ ->expects($this->once())130+ ->method('getEntityQuery')131+ ->with($updateTarget, $entityIds)132+ ->willReturn($queryBuilder);133+134+$sentryMock = $this->createMock(SentryMock::class);135+$sentryMock->expects($this->once())136+ ->method('captureException')137+ ->with($this->isInstanceOf(SyncActivityException::class));138+139+ Sentry::swap($sentryMock);140+141+142+$result = $this->action->loadDocuments($updateTarget, $entityIds);143+144+$this->assertEquals(1, $result->getDocumentsToUpdate()->count());145+$this->assertEquals(0, $result->getDocumentsToDelete()->count());146+147+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();148+$this->assertEquals('1', $documentsToUpdate[0]->getId());149+ }150+151+public function testLoadDocumentsWithEmptyEntityList(): void152+ {153+$entityIds = [];154+$updateTarget = UpdateTarget::ACTIVITY;155+156+$queryBuilder = $this->createQueryBuilderMock([]);157+158+$this->queryBuilder159+ ->expects($this->once())160+ ->method('getEntityQuery')161+ ->with($updateTarget, $entityIds)162+ ->willReturn($queryBuilder);163+164+$result = $this->action->loadDocuments($updateTarget, $entityIds);165+166+$this->assertEquals(0, $result->getDocumentsToUpdate()->count());167+$this->assertEquals(0, $result->getDocumentsToDelete()->count());168+ }169+170+private function createEntityMock(int $id, bool $isDeleted, array $indexableAttributes): Searchable171+ {172+return new class ($id, $isDeleted, $indexableAttributes) implements Searchable {173+public function __construct(174+private int $id,175+private bool $isDeleted,176+private array $indexableAttributes177+ ) {178+ }179+180+public function getId(): int181+ {182+return $this->id;183+ }184+185+public function getIndex(): string186+ {187+return 'test_index';188+ }189+190+public function getSearchKey(): int191+ {192+return $this->id;193+ }194+195+public function getIndexableAttributes(): array196+ {197+return $this->indexableAttributes;198+ }199+200+public function isDeleted(): bool201+ {202+return $this->isDeleted;203+ }204+205+public function setRelations(array $relations): void206+ {207+ }208+ };209+ }210+211+private function createEntityMockWithException(int $id, bool $isDeleted): Searchable212+ {213+return new class ($id, $isDeleted) implements Searchable {214+public function __construct(215+private int $id,216+private bool $isDeleted217+ ) {218+ }219+220+public function getId(): int221+ {222+return $this->id;223+ }224+225+public function getIndex(): string226+ {227+return 'test_index';228+ }229+230+public function getSearchKey(): int231+ {232+return $this->id;233+ }234+235+public function getIndexableAttributes(): array236+ {237+throw new \RuntimeException('Failed to build indexable attributes');238+ }239+240+public function isDeleted(): bool241+ {242+return $this->isDeleted;243+ }244+245+public function setRelations(array $relations): void246+ {247+ }248+ };249+ }250+251+private function createQueryBuilderMock(array $entities): Builder&MockObject252+ {253+$queryBuilder = $this->createMock(Builder::class);254+$queryBuilder->method('cursor')->willReturn(new \ArrayIterator($entities));255+256+return $queryBuilder;257+ }258+}259+260+class SentryMock261+{262+public function captureException(Exception $e)263+ {264+// Do nothing.265+ }266+}</selection>” selected. Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.
You said
I’m on page “<tabTitle>Jy 20820 es reindex stream model hydration by Vasi</tabTitle>” with “<selection>@@ -0,0 +1,266 @@1+queryBuilder = $this->createMock(EntityQueryBuilder::class);29+$this->action = new LoadDocumentsAction($this->queryBuilder);30+ }31+32+public function testLoadDocumentsWithEntitiesToUpdate(): void33+ {34+$entityIds = [1, 2, 3];35+$updateTarget = UpdateTarget::ACTIVITY;36+37+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);38+$entity2 = $this->createEntityMock(2, false, ['field2' => 'value2']);39+$entity3 = $this->createEntityMock(3, false, ['field3' => 'value3']);40+41+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2, $entity3]);42+43+$this->queryBuilder44+ ->expects($this->once())45+ ->method('getEntityQuery')46+ ->with($updateTarget, $entityIds)47+ ->willReturn($queryBuilder);48+49+$result = $this->action->loadDocuments($updateTarget, $entityIds);50+51+$this->assertEquals(3, $result->getDocumentsToUpdate()->count());52+$this->assertEquals(0, $result->getDocumentsToDelete()->count());53+54+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();55+$this->assertInstanceOf(Document::class, $documentsToUpdate[0]);56+$this->assertEquals('1', $documentsToUpdate[0]->getId());57+$this->assertEquals(['field1' => 'value1'], $documentsToUpdate[0]->getData());58+ }59+60+public function testLoadDocumentsWithEntitiesToDelete(): void61+ {62+$entityIds = [1, 2];63+$updateTarget = UpdateTarget::OPPORTUNITY;64+65+$entity1 = $this->createEntityMock(1, true, []);66+$entity2 = $this->createEntityMock(2, true, []);67+68+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2]);69+70+$this->queryBuilder71+ ->expects($this->once())72+ ->method('getEntityQuery')73+ ->with($updateTarget, $entityIds)74+ ->willReturn($queryBuilder);75+76+$result = $this->action->loadDocuments($updateTarget, $entityIds);77+78+$this->assertEquals(0, $result->getDocumentsToUpdate()->count());79+$this->assertEquals(2, $result->getDocumentsToDelete()->count());80+81+$documentsToDelete = $result->getDocumentsToDelete()->toArray();82+$this->assertEquals(1, $documentsToDelete[0]);83+$this->assertEquals(2, $documentsToDelete[1]);84+ }85+86+public function testLoadDocumentsWithMixedEntities(): void87+ {88+$entityIds = [1, 2, 3, 4];89+$updateTarget = UpdateTarget::ACTIVITY;90+91+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);92+$entity2 = $this->createEntityMock(2, true, []);93+$entity3 = $this->createEntityMock(3, false, ['field3' => 'value3']);94+$entity4 = $this->createEntityMock(4, true, []);95+96+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2, $entity3, $entity4]);97+98+$this->queryBuilder99+ ->expects($this->once())100+ ->method('getEntityQuery')101+ ->with($updateTarget, $entityIds)102+ ->willReturn($queryBuilder);103+104+$result = $this->action->loadDocuments($updateTarget, $entityIds);105+106+$this->assertEquals(2, $result->getDocumentsToUpdate()->count());107+$this->assertEquals(2, $result->getDocumentsToDelete()->count());108+109+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();110+$this->assertEquals('1', $documentsToUpdate[0]->getId());111+$this->assertEquals('3', $documentsToUpdate[1]->getId());112+113+$documentsToDelete = $result->getDocumentsToDelete()->toArray();114+$this->assertEquals(2, $documentsToDelete[0]);115+$this->assertEquals(4, $documentsToDelete[1]);116+ }117+118+public function testLoadDocumentsHandlesExceptionWhenBuildingIndexableAttributes(): void119+ {120+$entityIds = [1, 2];121+$updateTarget = UpdateTarget::ACTIVITY;122+123+$entity1 = $this->createEntityMock(1, false, ['field1' => 'value1']);124+$entity2 = $this->createEntityMockWithException(2, false);125+126+$queryBuilder = $this->createQueryBuilderMock([$entity1, $entity2]);127+128+$this->queryBuilder129+ ->expects($this->once())130+ ->method('getEntityQuery')131+ ->with($updateTarget, $entityIds)132+ ->willReturn($queryBuilder);133+134+$sentryMock = $this->createMock(SentryMock::class);135+$sentryMock->expects($this->once())136+ ->method('captureException')137+ ->with($this->isInstanceOf(SyncActivityException::class));138+139+ Sentry::swap($sentryMock);140+141+142+$result = $this->action->loadDocuments($updateTarget, $entityIds);143+144+$this->assertEquals(1, $result->getDocumentsToUpdate()->count());145+$this->assertEquals(0, $result->getDocumentsToDelete()->count());146+147+$documentsToUpdate = $result->getDocumentsToUpdate()->toArray();148+$this->assertEquals('1', $documentsToUpdate[0]->getId());149+ }150+151+public function testLoadDocumentsWithEmptyEntityList(): void152+ {153+$entityIds = [];154+$updateTarget = UpdateTarget::ACTIVITY;155+156+$queryBuilder = $this->createQueryBuilderMock([]);157+158+$this->queryBuilder159+ ->expects($this->once())160+ ->method('getEntityQuery')161+ ->with($updateTarget, $entityIds)162+ ->willReturn($queryBuilder);163+164+$result = $this->action->loadDocuments($updateTarget, $entityIds);165+166+$this->assertEquals(0, $result->getDocumentsToUpdate()->count());167+$this->assertEquals(0, $result->getDocumentsToDelete()->count());168+ }169+170+private function createEntityMock(int $id, bool $isDeleted, array $indexableAttributes): Searchable171+ {172+return new class ($id, $isDeleted, $indexableAttributes) implements Searchable {173+public function __construct(174+private int $id,175+private bool $isDeleted,176+private array $indexableAttributes177+ ) {178+ }179+180+public function getId(): int181+ {182+return $this->id;183+ }184+185+public function getIndex(): string186+ {187+return 'test_index';188+ }189+190+public function getSearchKey(): int191+ {192+return $this->id;193+ }194+195+public function getIndexableAttributes(): array196+ {197+return $this->indexableAttributes;198+ }199+200+public function isDeleted(): bool201+ {202+return $this->isDeleted;203+ }204+205+public function setRelations(array $relations): void206+ {207+ }208+ };209+ }210+211+private function createEntityMockWithException(int $id, bool $isDeleted): Searchable212+ {213+return new class ($id, $isDeleted) implements Searchable {214+public function __construct(215+private int $id,216+private bool $isDeleted217+ ) {218+ }219+220+public function getId(): int221+ {222+return $this->id;223+ }224+225+public function getIndex(): string226+ {227+return 'test_index';228+ }229+230+public function getSearchKey(): int231+ {232+return $this->id;233+ }234+235+public function getIndexableAttributes(): array236+ {237+throw new \RuntimeException('Failed to build indexable attributes');238+ }239+240+public function isDeleted(): bool241+ {242+return $this->isDeleted;243+ }244+245+public function setRelations(array $relations): void246+ {247+ }248+ };249+ }250+251+private function createQueryBuilderMock(array $entities): Builder&MockObject252+ {253+$queryBuilder = $this->createMock(Builder::class);254+$queryBuilder->method('cursor')->willReturn(new \ArrayIterator($entities));255+256+return $queryBuilder;257+ }258+}259+260+class SentryMock261+{262+public function captureException(Exception $e)263+ {264+// Do nothing.265+ }266+}</selection>” selected.
Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.
Expand
Listen
Gemini said
Gemini said
This selection contains unit tests for the
LoadDocumentsAction
class, specifically focusing on the
loadDocuments
method. The tests verify how the system hydrates search engine document models from database entities, handling updates, deletions, and exceptions.
Core Functionality Tested
Core Functionality Tested
The tests use a mocked
EntityQueryBuilder
and anonymous
Searchable
classes to simulate different hydration scenarios:
Document Updates:
Verifies that active entities are correctly transformed into
Document
objects containing the expected ID and data (indexable attributes).
Document Deletions:
Ensures that entities flagged as
isDeleted
are processed for removal from the search index.
Mixed Results:
Validates the ability to process a collection containing both updateable and deletable entities in a single stream.
Empty Result Sets:
Confirms the system handles empty entity lists gracefully without errors.
Error Handling & Resilience
Error Handling & Resilience
Exception Catching:
A specific test case (
testLoadDocumentsHandlesExceptionWhenBuildingIndexableAttributes
) ensures that if a single entity fails to hydrate due to an exception, the system:
Logs the error to
Sentry
using a
SyncActivityException
.
Continues processing other valid entities in the stream rather than failing the entire batch.
Technical Implementation Details
Technical Implementation Details
Mocking Strategy:
Uses
createMock
for dependencies and a custom
createEntityMock
helper to generate anonymous classes implementing the
Searchable
interface.
Assertions:
Utilizes PHPUnit assertions like
assertEquals
,
assertInstanceOf
, and
count
to verify the state of the returned result object.
Iterator Usage:
The
createQueryBuilderMock
uses an
ArrayIterator
to simulate a database cursor, reflecting the streaming nature of the hydration process.
Good response
Bad response
Share & export
Copy
Show more options
Copy prompt
You said Role: You are a Technical Lead. Your task is to provide a clear, high-level summary of the provided code diff or PR selection. Instructions: Summarize the core objective: Explain what the code is doing and why (if apparent from the context) using precise and concise language. Highlight key changes: Break down the structural or logical changes made in the code. Formatting: Use headers and bulleted lists to make the summary highly scannable for a developer. Avoid long paragraphs. Accuracy: Maintain the exact meaning and factual accuracy of the provided code without hallucinating outside context.
You said
Role: You are a Technical Lead. Your task is to provide a clear, high-level summary of the provided code diff or PR selection.
Instructions:
Summarize the core objective: Explain what the code is doing and why (if apparent from the context) using precise and concise language.
Highlight key changes: Break down the structural or logical changes made in the code.
Formatting: Use headers and bulleted lists to make the summary highly scannable for a developer. Avoid long paragraphs.
Accuracy: Maintain the exact meaning and factual accuracy of the provided code without hallucinating outside context.
Expand
Listen
Show more options
Show thinking
Gemini said
Gemini said
Core Objective
Core Objective
This selection introduces a comprehensive suite of PHPUnit tests for the
LoadDocumentsAction
class. The goal is to verify the logic of the
loadDocuments
method, ensuring it correctly transforms streamed database entities into search-indexable documents, accurately segregates them into "update" and "delete" queues, and handles individual hydration failures without crashing the entire batch process.
Key Behaviors Verified
Key Behaviors Verified
Standard Hydration:
Confirms that active entities (
isDeleted = false
) are properly parsed into
Document
objects containing the correct IDs and indexable attributes.
Deletion Handling:
Ensures entities flagged as deleted (
isDeleted = true
) are added to the deletion queue and excluded from the update queue.
Mixed Batch Processing:
Validates the system's ability to process a single stream containing both active and deleted entities, successfully splitting them into their respective queues.
Empty Result Sets:
Verifies that providing an empty list of entity IDs resolves gracefully, returning zero documents to update or delete without error.
Fault Tolerance:
Ensures that if a specific entity throws an exception during attribute generation, the error is logged to Sentry (as a
SyncActivityException
), and the system successfully continues processing the remaining valid entities.
Structural & Mocking Changes
Structural & Mocking Changes
Anonymous Class Mocks:
Introduces helper methods (
createEntityMock
,
createEntityMockWithException
) that utilize anonymous classes implementing the
Searchable
interface to simulate different entity states cleanly.
Cursor Simulation:
Mocks the
EntityQueryBuilder
to return an
ArrayIterator
via a
cursor()
method, mimicking the streaming behavior of a database query.
Sentry Facade Swapping:
Implements a
SentryMock
to intercept and assert exception handling logic without triggering actual Sentry events during test execution.
Good response...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
18196
|
791
|
3
|
2026-05-11T11:03:42.871207+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778497422871_m2.jpg...
|
PhpStorm
|
faVsco.js – HandleHubspotRateLimit.php
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
PhostormVIewINavicareCodeWindowFV faVsco.js°9 JY-2 PhostormVIewINavicareCodeWindowFV faVsco.js°9 JY-20725-handle-HS-search-rate-limiProiect© BatchSyncCollectolhuospot/service.onpT SyncCrmEntitiesTrait.phpc) CachedCrmServiceDecorator.ongJiminnyDeougcommana.onge balchsynckealssec clientoneo closeaDealstagesso RematchActivityonCrmObiectDetach.pngDealrielasservice.gRateLimitexcedc)Decorateacuivilv.or© FieldDefinitions.phrC) CrmObiectsResolver.pho() ProviderRateLimiter.phpC) PaqinationContia.phpC) FieldT vpeconverteclass Cuient extends BasecLient imolements Hubspotcuientinterfacee Hubspotclientinterc) HubspotlokenmanC) PavloadBuilder.phpC) RemotecrmobiectrP ResponseNormalize210 Cc) Service.onrC)SvncFieldAction.onC) SvncRelatedActivitC) WebhookSvncBatclv MintearationAorM Acceccors•MAnConfigD DTO• M Silters219D Jobs• M ProcnectSoarchStr.W service lraits© DataClient.php© DecorateActivity.ph(e) LocalSearch.onpu Localsearchinteria227 C© RemoteSearch.phpc) Service.phpv W Listeners© ConvertLeadActivitc) PurceLookuocache> M Metadata> MiarationiPioedrivev Salesforce236• D FieldsM OnnortunitvMatcheMOnnortunitvSvneStl239M ProsneetSearchStr.• M ServiceTraitcC) Client nhr© DecorateActivity.pr. Delete@biectsTrait© FieldDefinitions.php249© PayloadBuilder.php© Profile.php© QueryBuilder.php248Tacts nacced. 12 (1 hour adoi* Ufficial documentation states: The search endpoints are rate limited to five requests per second.* Since with 5 RPS were still hitting secondly rate limits we lowered it to 4public function getPaginatedData(array Spayload, string $type, int $offset = 0): arrayStotal = 0;Sastid = nun•Srows = []:foreach (Sthis->getPaginatedDataGenerator(Spayload, $type, $offset,8: Stotal.QlastRecordld: Slas+tdh as Srow&Srows(] = $rowreturn ['results' => $rows, 'total' => $total, 'last_record' => $lastId]:*acows nuospoccxceotlon*dchrows soc1alaccountlokenLnval1dzxcept1on* dchrows Badkequestpublic function getPaginatedDataGenerator(arrav soavload.lstrina Stvoelint Soffset = 0.int &stotal = 0.Ostrina &SlastRecordid = nuluGenerator "neturnsthis->naginationServi.ce->aetpaginatedbataGeneraton(SthisSnavload.$type,Soffset.8: Stotal..8: SlactPecordTd• Execute a search request against HubSpot CRM obiects with rate limiting.* Anaram string SobjectType The object tupe ('deals'.'contacts', 'calls')* anaram array<string, mixed> Spayload The search payload with filters, sorts, properties. etc.A6 VAYPreparation tor kell... In o/ m100% 2• Mon 11 May 14:03:42HandleHubspotRateLimitTest v= custom.loa X|4 HS_local (iminny@localhost]# console [PKoD)CascadeA console (EU]A console [STAGING]Hubspot Rate Limit Re+0 ..[2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {w19Alets simplify it, just call it parseMessage and skip policy al together"Vace".L"Inu,or may 20z0 14.21.10 bMl"J,Thought for 5s ›Read Client.php #L86-200"Connection":"keep-aLive".rb Client.php+17 -35"CF-Ray":"9t80deb8dbo0dcsa-S0F"arVerity nothing broke:Command docker. tail"Strict-Transport-Security":"max-aqe=31536000* 1ncLudesubbomains: preload")."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3)",docker execetests/Unit/Jobs/Middleware/HandleHubspotRateLimitTest-phptests/Unit/Services/Crm/Hubspot/ClientTest.php --no-coverage 2>&1 | tail -10pup92.20contzaeration: Phomes3.minnv/ohpunit.xml"x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"),"Set-Cookie":["__cf_bm=S1UrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-[IP_ADDRESS]-rI.ZggtDKxTg07-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"],"Renont-Tol.":D.:Time: 02:14.415. Memorv: 62.00 MB•[PASSWORD_DOTS]DD..DD..D.D..DDDDD.DDD......65 / 80 (1808)OK hut there were ¿csuec!All 80 tests still passN"url\":\"https:|\/\\/a.nel.cloudflare.com\/report\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsr\"group\":\"cf-nel\",\"max_age\":604800}"],"NEL": ["{\"success_fraction\":0.01,reporc to. "cr-nel,"max age":604800}"]"Server": ["cloudflare"]}} {"correlation id":"95236535-ec98-4541-b92a-adfa73b69eab".SummaryRemoved narsePo Eicv entirelv. narseRetrvAfter now mans messade kevwords direct v to seconds without theintermediate policy conceptBefore: header a narsePolicy a nolicy constant a seconds After: header « narceMessage „ secondsChanges:•parsePoLicy → deleted•narseMessade added: returns the raw messade strina from the response bodv (or .. )•parseRetryAfter does the keyword matching itself (daily → 600, ten secondly → 10, secondly → 1)I"trace_1d":"C/aD8565-905t-4604-9405-0e5b551e5545'• Log line in executeRequest now logs message instead of policy - more informative for debuggingThe keyword-match order is the same as before (daily before ten secondly before secondly ) to avoid substringcollision.IІПII 1 1IIIIlII111 1.nl .Ask anvthina (84L)« CodeClaude Onus 4.7 MediumWN Windsurf Toams 228-24UTF.8io 4 spaces...
|
NULL
|
-8032017939677384184
|
NULL
|
click
|
ocr
|
NULL
|
PhostormVIewINavicareCodeWindowFV faVsco.js°9 JY-2 PhostormVIewINavicareCodeWindowFV faVsco.js°9 JY-20725-handle-HS-search-rate-limiProiect© BatchSyncCollectolhuospot/service.onpT SyncCrmEntitiesTrait.phpc) CachedCrmServiceDecorator.ongJiminnyDeougcommana.onge balchsynckealssec clientoneo closeaDealstagesso RematchActivityonCrmObiectDetach.pngDealrielasservice.gRateLimitexcedc)Decorateacuivilv.or© FieldDefinitions.phrC) CrmObiectsResolver.pho() ProviderRateLimiter.phpC) PaqinationContia.phpC) FieldT vpeconverteclass Cuient extends BasecLient imolements Hubspotcuientinterfacee Hubspotclientinterc) HubspotlokenmanC) PavloadBuilder.phpC) RemotecrmobiectrP ResponseNormalize210 Cc) Service.onrC)SvncFieldAction.onC) SvncRelatedActivitC) WebhookSvncBatclv MintearationAorM Acceccors•MAnConfigD DTO• M Silters219D Jobs• M ProcnectSoarchStr.W service lraits© DataClient.php© DecorateActivity.ph(e) LocalSearch.onpu Localsearchinteria227 C© RemoteSearch.phpc) Service.phpv W Listeners© ConvertLeadActivitc) PurceLookuocache> M Metadata> MiarationiPioedrivev Salesforce236• D FieldsM OnnortunitvMatcheMOnnortunitvSvneStl239M ProsneetSearchStr.• M ServiceTraitcC) Client nhr© DecorateActivity.pr. Delete@biectsTrait© FieldDefinitions.php249© PayloadBuilder.php© Profile.php© QueryBuilder.php248Tacts nacced. 12 (1 hour adoi* Ufficial documentation states: The search endpoints are rate limited to five requests per second.* Since with 5 RPS were still hitting secondly rate limits we lowered it to 4public function getPaginatedData(array Spayload, string $type, int $offset = 0): arrayStotal = 0;Sastid = nun•Srows = []:foreach (Sthis->getPaginatedDataGenerator(Spayload, $type, $offset,8: Stotal.QlastRecordld: Slas+tdh as Srow&Srows(] = $rowreturn ['results' => $rows, 'total' => $total, 'last_record' => $lastId]:*acows nuospoccxceotlon*dchrows soc1alaccountlokenLnval1dzxcept1on* dchrows Badkequestpublic function getPaginatedDataGenerator(arrav soavload.lstrina Stvoelint Soffset = 0.int &stotal = 0.Ostrina &SlastRecordid = nuluGenerator "neturnsthis->naginationServi.ce->aetpaginatedbataGeneraton(SthisSnavload.$type,Soffset.8: Stotal..8: SlactPecordTd• Execute a search request against HubSpot CRM obiects with rate limiting.* Anaram string SobjectType The object tupe ('deals'.'contacts', 'calls')* anaram array<string, mixed> Spayload The search payload with filters, sorts, properties. etc.A6 VAYPreparation tor kell... In o/ m100% 2• Mon 11 May 14:03:42HandleHubspotRateLimitTest v= custom.loa X|4 HS_local (iminny@localhost]# console [PKoD)CascadeA console (EU]A console [STAGING]Hubspot Rate Limit Re+0 ..[2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {w19Alets simplify it, just call it parseMessage and skip policy al together"Vace".L"Inu,or may 20z0 14.21.10 bMl"J,Thought for 5s ›Read Client.php #L86-200"Connection":"keep-aLive".rb Client.php+17 -35"CF-Ray":"9t80deb8dbo0dcsa-S0F"arVerity nothing broke:Command docker. tail"Strict-Transport-Security":"max-aqe=31536000* 1ncLudesubbomains: preload")."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3)",docker execetests/Unit/Jobs/Middleware/HandleHubspotRateLimitTest-phptests/Unit/Services/Crm/Hubspot/ClientTest.php --no-coverage 2>&1 | tail -10pup92.20contzaeration: Phomes3.minnv/ohpunit.xml"x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"),"Set-Cookie":["__cf_bm=S1UrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-[IP_ADDRESS]-rI.ZggtDKxTg07-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"],"Renont-Tol.":D.:Time: 02:14.415. Memorv: 62.00 MB•[PASSWORD_DOTS]DD..DD..D.D..DDDDD.DDD......65 / 80 (1808)OK hut there were ¿csuec!All 80 tests still passN"url\":\"https:|\/\\/a.nel.cloudflare.com\/report\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsr\"group\":\"cf-nel\",\"max_age\":604800}"],"NEL": ["{\"success_fraction\":0.01,reporc to. "cr-nel,"max age":604800}"]"Server": ["cloudflare"]}} {"correlation id":"95236535-ec98-4541-b92a-adfa73b69eab".SummaryRemoved narsePo Eicv entirelv. narseRetrvAfter now mans messade kevwords direct v to seconds without theintermediate policy conceptBefore: header a narsePolicy a nolicy constant a seconds After: header « narceMessage „ secondsChanges:•parsePoLicy → deleted•narseMessade added: returns the raw messade strina from the response bodv (or .. )•parseRetryAfter does the keyword matching itself (daily → 600, ten secondly → 10, secondly → 1)I"trace_1d":"C/aD8565-905t-4604-9405-0e5b551e5545'• Log line in executeRequest now logs message instead of policy - more informative for debuggingThe keyword-match order is the same as before (daily before ten secondly before secondly ) to avoid substringcollision.IІПII 1 1IIIIlII111 1.nl .Ask anvthina (84L)« CodeClaude Onus 4.7 MediumWN Windsurf Toams 228-24UTF.8io 4 spaces...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
713
|
25
|
30
|
2026-05-07T07:24:53.858484+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778138693858_m1.jpg...
|
iTerm2
|
NULL
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
iTerm2ShellEditViewSessionScriptsProfilesWindowHel iTerm2ShellEditViewSessionScriptsProfilesWindowHelpSupport Daily • in 4 h 36 m100% [8Thu 7 May 10:24:53screenpipe"DOCKER2026-05-07110:16:10.08882522026-05-07T10:16:11.585397Z2026-05-07T10:16:11.626664Z2026-05-07110:16:14.07905722026-05-07T10:16:16.219212Z2026-05-07T10:16:16.238237Z2026-05-07T10:16:17.211409Z2026-05-07T10:16:17.247202Z2026-05-07T10:16:37.973759Z2026-05-07T10:16:38.014645Z2026-05-07110:16:38.719453Z2026-05-07T10:16:38.757458Z2026-05-07110:16:39132320342026-05-07110:16:39.36147222026-05-07T10:16:40.850433Z2026-05-07T10:16:42.489832Z2026-05-07T10:16:44.044480Z2026-05-07T10:16:44.383786Z2026-05-07T10:17:13.547514Z2026-05-07T10:17:23.997418Z2026-05-07110:17:36.067503Z2026-05-07T10:17:48.254094Z2026-05-07T10:18:06.328441Z2026-05-07T10:18:21.374558Z2026-05-07T10:18:27.400579Z2026-05-07T10:18:36.379491Z2026-05-07T10:18:39.375238Z2026-05-07T10:19:43.208935Z2026-05-07T10:19:49.257421ZDEV (-zsh)O $82APP (-zsh)83-zsh• *4screenpipe"INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingINFOscreenpipe_engine::event_driven_capture:contentdedup:capture for monitor 2 (hash=-6145754442538527174, trigger=click)skippingcapture for monitor 1(hash=-6145754442538527174,INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapturefor monitor 2INFOcontentChash=-6145754442538527174,trigger=click)trigger=click)screenpipe_engine::event_driven_capture:dedup:skipping capturefor monitor 2(hash=806643008695069553, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture:contentdedup:skipping capture for monitor 2 (hash=806643008695069553,trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 1 (hash=806643008695069553,trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 2 (hash=806643008695069553,trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skipping capture for monitor 1 (hash=806643008695069553, trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 2(hash=-8875948178524934281, trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 1(hash=-8875948178524934281, trigger=click)INFOscreenpipe_engine::event,_driven_capture:contentdedup:skippingcapture for monitor 1INFOscreenpipe_engine::event_driven_capture:contentdedup:skipping(hash=-8875948178524934281, trigger=click)capture for monitor 2 (hash=-8875948178524934281, trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 2 (hash=-8875948178524934281,trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 1 (hash=-8875948178524934281, trigger=click)INFOscreenpipe_engine::snapshot_compaction:snapshotcompaction:found 50eligible framesINFOscreenpipe_engine::snapshot_compaction:snapshotcompaction:25frames,4. 5MB→ 1.4MB (3.2x), 25 JPEGs deletedINFOscreenpipe_engine::snapshot_compaction:snapshotcompaction:23frames,4.2MB→ 1.1MB (3.7x),23 JPEGs deletedINFOscreenpipe_engine:: event_driven_capture:contentdedup:skipping capture for monitor 2 (hash=-8875948178524934281, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture:contentdedup:skipping capture for monitor 2 (hash=763931354791105339, trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 2 (hash=8224741320031956579, trigger=click)INFOscreenpipe_engine::event_driven_capture: content dedup:skipping capture for monitor 2 (hash=8224741320031956579, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: content dedup:skipping capture for monitor 2 (hash=8224741320031956579, trigger=click)INFOscreenpipe_engine::event_driven_capture: content dedup:skipping capture for monitor 2 (hash=8392580966194121284,trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: contentdedup:skipping capture for monitor 2 (hash=8392580966194121284, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: contentdedup:skipping capture for monitor 2 (hash=8392580966194121284, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: contentdedup: skippingINFOscreenpipe_engine::event_driven_capture:contentdedup:capture for monitor 2 (hash=7524776963116161484, trigger=visual_change)skippingcapture for monitor 2 (hash=7524776963116161484, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture:contentdedup:skipping capture for monitor 2 (hash=-6840747455939898472, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: content dedup: skipping capture for monitor 2 (hash=-6840747455939898472, trigger=visual_change)tip: install a starter bundle of pipes:screenpipe install https://screenpi.pe/start.json2026-05-07110:21:21.84837522026-05-07T10:21:23.439805Z2026-05-07110:21:38.80377722026-05-07T10:21:44.054102Z2026-05-07T10:21:46.307600Z2026-05-07T10:21:49.031129Z2026-05-07T10:23:02.085605Z2026-05-07110:23:05.086593Z2026-05-07T10:24:05.661776Z2026-05-07T10:24:09.585701Z2026-05-07110:24:11.7149562INFOscreenpipe_engine::event_driven_capture: contentdedup: skipping capture for monitor 2 (hash=201887528283740068, trigger=click)INFOscreenpipe_engine::event_driven_capture: content dedup:skipping capture for monitor 2 (hash=201887528283740068, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: content dedup: skipping capture for monitor 2 (hash=4689651471004117672, trigger=click)INFOscreenpipe_engine::snapshot_compaction: snapshotcompaction: found 84 eligible framesINFOscreenpipe_engine::snapshot_compaction: snapshotcompaction: 38 frames,5.0MB 1.3MB (3.8x), 38 JPEGs deletedINFOscreenpipe_engine::snapshot_compaction: snapshotcompaction: 44 frames,7.2MB→ 1.4MB (5.2x),44 JPEGSdeletedINFOscreenpipe_engine::event_driven_capture: content dedup: skipping capture for monitor 2 (hash=-2104275679555505311, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: content dedup:INFOscreenpipe_engine::event_driven_capture:skipping capture for monitor 2 (hash=-2104275679555505311, trigger=visual_change)content dedup:skipping capture for monitor 2 (hash=763931354791105339, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: contentdedup:skipping capture for monitor 2 (hash=763931354791105339, trigger=click)INFOscreenpipe_engine::event_driven_capture: contentdedup: skipping capture for monitor 2 (hash=763931354791105339, trigger=visual_change)...
|
NULL
|
-8031629529185585092
|
NULL
|
click
|
ocr
|
NULL
|
iTerm2ShellEditViewSessionScriptsProfilesWindowHel iTerm2ShellEditViewSessionScriptsProfilesWindowHelpSupport Daily • in 4 h 36 m100% [8Thu 7 May 10:24:53screenpipe"DOCKER2026-05-07110:16:10.08882522026-05-07T10:16:11.585397Z2026-05-07T10:16:11.626664Z2026-05-07110:16:14.07905722026-05-07T10:16:16.219212Z2026-05-07T10:16:16.238237Z2026-05-07T10:16:17.211409Z2026-05-07T10:16:17.247202Z2026-05-07T10:16:37.973759Z2026-05-07T10:16:38.014645Z2026-05-07110:16:38.719453Z2026-05-07T10:16:38.757458Z2026-05-07110:16:39132320342026-05-07110:16:39.36147222026-05-07T10:16:40.850433Z2026-05-07T10:16:42.489832Z2026-05-07T10:16:44.044480Z2026-05-07T10:16:44.383786Z2026-05-07T10:17:13.547514Z2026-05-07T10:17:23.997418Z2026-05-07110:17:36.067503Z2026-05-07T10:17:48.254094Z2026-05-07T10:18:06.328441Z2026-05-07T10:18:21.374558Z2026-05-07T10:18:27.400579Z2026-05-07T10:18:36.379491Z2026-05-07T10:18:39.375238Z2026-05-07T10:19:43.208935Z2026-05-07T10:19:49.257421ZDEV (-zsh)O $82APP (-zsh)83-zsh• *4screenpipe"INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingINFOscreenpipe_engine::event_driven_capture:contentdedup:capture for monitor 2 (hash=-6145754442538527174, trigger=click)skippingcapture for monitor 1(hash=-6145754442538527174,INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapturefor monitor 2INFOcontentChash=-6145754442538527174,trigger=click)trigger=click)screenpipe_engine::event_driven_capture:dedup:skipping capturefor monitor 2(hash=806643008695069553, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture:contentdedup:skipping capture for monitor 2 (hash=806643008695069553,trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 1 (hash=806643008695069553,trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 2 (hash=806643008695069553,trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skipping capture for monitor 1 (hash=806643008695069553, trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 2(hash=-8875948178524934281, trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 1(hash=-8875948178524934281, trigger=click)INFOscreenpipe_engine::event,_driven_capture:contentdedup:skippingcapture for monitor 1INFOscreenpipe_engine::event_driven_capture:contentdedup:skipping(hash=-8875948178524934281, trigger=click)capture for monitor 2 (hash=-8875948178524934281, trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 2 (hash=-8875948178524934281,trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 1 (hash=-8875948178524934281, trigger=click)INFOscreenpipe_engine::snapshot_compaction:snapshotcompaction:found 50eligible framesINFOscreenpipe_engine::snapshot_compaction:snapshotcompaction:25frames,4. 5MB→ 1.4MB (3.2x), 25 JPEGs deletedINFOscreenpipe_engine::snapshot_compaction:snapshotcompaction:23frames,4.2MB→ 1.1MB (3.7x),23 JPEGs deletedINFOscreenpipe_engine:: event_driven_capture:contentdedup:skipping capture for monitor 2 (hash=-8875948178524934281, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture:contentdedup:skipping capture for monitor 2 (hash=763931354791105339, trigger=click)INFOscreenpipe_engine::event_driven_capture:contentdedup:skippingcapture for monitor 2 (hash=8224741320031956579, trigger=click)INFOscreenpipe_engine::event_driven_capture: content dedup:skipping capture for monitor 2 (hash=8224741320031956579, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: content dedup:skipping capture for monitor 2 (hash=8224741320031956579, trigger=click)INFOscreenpipe_engine::event_driven_capture: content dedup:skipping capture for monitor 2 (hash=8392580966194121284,trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: contentdedup:skipping capture for monitor 2 (hash=8392580966194121284, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: contentdedup:skipping capture for monitor 2 (hash=8392580966194121284, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: contentdedup: skippingINFOscreenpipe_engine::event_driven_capture:contentdedup:capture for monitor 2 (hash=7524776963116161484, trigger=visual_change)skippingcapture for monitor 2 (hash=7524776963116161484, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture:contentdedup:skipping capture for monitor 2 (hash=-6840747455939898472, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: content dedup: skipping capture for monitor 2 (hash=-6840747455939898472, trigger=visual_change)tip: install a starter bundle of pipes:screenpipe install https://screenpi.pe/start.json2026-05-07110:21:21.84837522026-05-07T10:21:23.439805Z2026-05-07110:21:38.80377722026-05-07T10:21:44.054102Z2026-05-07T10:21:46.307600Z2026-05-07T10:21:49.031129Z2026-05-07T10:23:02.085605Z2026-05-07110:23:05.086593Z2026-05-07T10:24:05.661776Z2026-05-07T10:24:09.585701Z2026-05-07110:24:11.7149562INFOscreenpipe_engine::event_driven_capture: contentdedup: skipping capture for monitor 2 (hash=201887528283740068, trigger=click)INFOscreenpipe_engine::event_driven_capture: content dedup:skipping capture for monitor 2 (hash=201887528283740068, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: content dedup: skipping capture for monitor 2 (hash=4689651471004117672, trigger=click)INFOscreenpipe_engine::snapshot_compaction: snapshotcompaction: found 84 eligible framesINFOscreenpipe_engine::snapshot_compaction: snapshotcompaction: 38 frames,5.0MB 1.3MB (3.8x), 38 JPEGs deletedINFOscreenpipe_engine::snapshot_compaction: snapshotcompaction: 44 frames,7.2MB→ 1.4MB (5.2x),44 JPEGSdeletedINFOscreenpipe_engine::event_driven_capture: content dedup: skipping capture for monitor 2 (hash=-2104275679555505311, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: content dedup:INFOscreenpipe_engine::event_driven_capture:skipping capture for monitor 2 (hash=-2104275679555505311, trigger=visual_change)content dedup:skipping capture for monitor 2 (hash=763931354791105339, trigger=visual_change)INFOscreenpipe_engine::event_driven_capture: contentdedup:skipping capture for monitor 2 (hash=763931354791105339, trigger=click)INFOscreenpipe_engine::event_driven_capture: contentdedup: skipping capture for monitor 2 (hash=763931354791105339, trigger=visual_change)...
|
709
|
NULL
|
NULL
|
NULL
|
|
539
|
22
|
40
|
2026-05-07T07:16:23.059913+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778138183059_m2.jpg...
|
Firefox
|
Screenpipe — Archive — Personal
|
True
|
http://192.168.0.242:8766
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Pull requests · screenpipe/screenpipe · GitHub
Pul Pull requests · screenpipe/screenpipe · GitHub
Pull requests · screenpipe/screenpipe · GitHub
Hostinger login | Sign in to Hostinger account
Hostinger login | Sign in to Hostinger account
Login – Nginx Proxy Manager
Login – Nginx Proxy Manager
Screenpipe — Archive
Screenpipe — Archive
Close tab
SQLite Web: archive.db
SQLite Web: archive.db
SQLite Web: db.sqlite
SQLite Web: db.sqlite
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
Screenpipe [archive.db · 10616.9MB]
Screenpipe
[archive.db · 10616.9MB]
Activity
Search
Audio
Work Report
Timetable
AI Summary
Date
06
/
05
/
2026
Calendar
Monitor
Jump to
--
:
--
Go
APP TIMELINE · CLICK TO PLAY · DRAG SCROLLBAR TO PAN
−
1×
+
Follow
Follow
20:30
6 May 20:36 · iTerm2 / -zsh
⏮ 30s
◀ 10s
⏸ Pause
10s ▶
30s ⏭
20:36
iTerm2...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Pull requests · screenpipe/screenpipe · GitHub","depth":4,"bounds":{"left":0.0,"top":0.0518755,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests · screenpipe/screenpipe · GitHub","depth":5,"bounds":{"left":0.013297873,"top":0.06304868,"width":0.080784574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Hostinger login | Sign in to Hostinger account","depth":4,"bounds":{"left":0.0,"top":0.08459697,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Hostinger login | Sign in to Hostinger account","depth":5,"bounds":{"left":0.013297873,"top":0.09577015,"width":0.07895612,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Login – Nginx Proxy Manager","depth":4,"bounds":{"left":0.0,"top":0.11731844,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Login – Nginx Proxy Manager","depth":5,"bounds":{"left":0.013297873,"top":0.12849163,"width":0.05069814,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.0,"top":0.15003991,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.013297873,"top":0.16121309,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.10139628,"top":0.15722266,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"SQLite Web: archive.db","depth":4,"bounds":{"left":0.0,"top":0.18276137,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SQLite Web: archive.db","depth":5,"bounds":{"left":0.013297873,"top":0.19393456,"width":0.040724736,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SQLite Web: db.sqlite","depth":4,"bounds":{"left":0.0,"top":0.21548285,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SQLite Web: db.sqlite","depth":5,"bounds":{"left":0.013297873,"top":0.22665602,"width":0.03756649,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub","depth":4,"bounds":{"left":0.0,"top":0.2482043,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub","depth":5,"bounds":{"left":0.013297873,"top":0.25937748,"width":0.11469415,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.0,"top":0.28092578,"width":0.113696806,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.013297873,"top":0.29209897,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.31524342,"width":0.108211435,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0028257978,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.013796543,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.024933511,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.036070477,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden","depth":6,"bounds":{"left":0.04720745,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Screenpipe [archive.db · 10616.9MB]","depth":7,"bounds":{"left":0.12034574,"top":0.061452515,"width":0.06665558,"height":0.017956903},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Screenpipe","depth":8,"bounds":{"left":0.12034574,"top":0.06304868,"width":0.027759308,"height":0.014764565},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"[archive.db · 10616.9MB]","depth":9,"bounds":{"left":0.14943483,"top":0.06703911,"width":0.03756649,"height":0.009976057},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Activity","depth":7,"bounds":{"left":0.19165559,"top":0.059856344,"width":0.024933511,"height":0.0207502},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":7,"bounds":{"left":0.21725398,"top":0.059856344,"width":0.023603724,"height":0.0207502},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Audio","depth":7,"bounds":{"left":0.24152261,"top":0.059856344,"width":0.020944148,"height":0.0207502},"on_screen":true,"help_text":"No audio data in this database","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Work Report","depth":7,"bounds":{"left":0.26313165,"top":0.059856344,"width":0.03507314,"height":0.0207502},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Timetable","depth":7,"bounds":{"left":0.29886967,"top":0.059856344,"width":0.029753989,"height":0.0207502},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"AI Summary","depth":7,"bounds":{"left":0.32928857,"top":0.059856344,"width":0.034075797,"height":0.0207502},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Date","depth":8,"bounds":{"left":0.93849736,"top":0.0650439,"width":0.008144947,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"06","depth":9,"bounds":{"left":0.9552859,"top":0.06464485,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/","depth":8,"bounds":{"left":0.96110374,"top":0.06464485,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"05","depth":9,"bounds":{"left":0.9644282,"top":0.06464485,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/","depth":8,"bounds":{"left":0.970246,"top":0.06464485,"width":0.002493351,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2026","depth":9,"bounds":{"left":0.9737367,"top":0.06464485,"width":0.009474734,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Calendar","depth":8,"bounds":{"left":0.98454124,"top":0.0650439,"width":0.0051529254,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Monitor","depth":9,"bounds":{"left":0.34740692,"top":0.10853951,"width":0.013464096,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Jump to","depth":9,"bounds":{"left":0.7059508,"top":0.10853951,"width":0.01412899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"--","depth":10,"bounds":{"left":0.72606385,"top":0.10814046,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":9,"bounds":{"left":0.7318817,"top":0.10814046,"width":0.0023271276,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"--","depth":10,"bounds":{"left":0.7352061,"top":0.10814046,"width":0.0048204786,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Go","depth":8,"bounds":{"left":0.75398934,"top":0.10454908,"width":0.012300532,"height":0.018754989},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"APP TIMELINE · CLICK TO PLAY · DRAG SCROLLBAR TO PAN","depth":10,"bounds":{"left":0.35239363,"top":0.14964086,"width":0.10571808,"height":0.009976057},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"−","depth":9,"bounds":{"left":0.7087766,"top":0.1452514,"width":0.009807181,"height":0.018754989},"on_screen":true,"help_text":"Zoom out","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1×","depth":10,"bounds":{"left":0.72273934,"top":0.14924182,"width":0.004155585,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"+","depth":9,"bounds":{"left":0.7312167,"top":0.1452514,"width":0.009640957,"height":0.018754989},"on_screen":true,"help_text":"Zoom in","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Follow","depth":10,"bounds":{"left":0.74418217,"top":0.14924182,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Follow","depth":10,"bounds":{"left":0.75016624,"top":0.14924182,"width":0.011136968,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20:30","depth":13,"bounds":{"left":0.43085107,"top":0.21947326,"width":0.008477394,"height":0.008778931},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6 May 20:36 · iTerm2 / -zsh","depth":10,"bounds":{"left":0.35106382,"top":0.2661612,"width":0.051861703,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"⏮ 30s","depth":9,"bounds":{"left":0.35172874,"top":0.8882682,"width":0.023936171,"height":0.02434158},"on_screen":true,"help_text":"Ctrl+←","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"◀ 10s","depth":9,"bounds":{"left":0.37832448,"top":0.8886672,"width":0.02244016,"height":0.023942538},"on_screen":true,"help_text":"←","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"⏸ Pause","depth":9,"bounds":{"left":0.4034242,"top":0.8882682,"width":0.027925532,"height":0.02434158},"on_screen":true,"help_text":"Space","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"10s ▶","depth":9,"bounds":{"left":0.4340093,"top":0.8886672,"width":0.022273935,"height":0.023942538},"on_screen":true,"help_text":"→","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"30s ⏭","depth":9,"bounds":{"left":0.45894283,"top":0.8882682,"width":0.024102394,"height":0.02434158},"on_screen":true,"help_text":"Ctrl+→","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"20:36","depth":10,"bounds":{"left":0.75166225,"top":0.8950519,"width":0.010305851,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"iTerm2","depth":9,"bounds":{"left":0.35239363,"top":0.93056667,"width":0.011801862,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8031016194751797612
|
-5309553831512403701
|
visual_change
|
accessibility
|
NULL
|
Pull requests · screenpipe/screenpipe · GitHub
Pul Pull requests · screenpipe/screenpipe · GitHub
Pull requests · screenpipe/screenpipe · GitHub
Hostinger login | Sign in to Hostinger account
Hostinger login | Sign in to Hostinger account
Login – Nginx Proxy Manager
Login – Nginx Proxy Manager
Screenpipe — Archive
Screenpipe — Archive
Close tab
SQLite Web: archive.db
SQLite Web: archive.db
SQLite Web: db.sqlite
SQLite Web: db.sqlite
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
Screenpipe [archive.db · 10616.9MB]
Screenpipe
[archive.db · 10616.9MB]
Activity
Search
Audio
Work Report
Timetable
AI Summary
Date
06
/
05
/
2026
Calendar
Monitor
Jump to
--
:
--
Go
APP TIMELINE · CLICK TO PLAY · DRAG SCROLLBAR TO PAN
−
1×
+
Follow
Follow
20:30
6 May 20:36 · iTerm2 / -zsh
⏮ 30s
◀ 10s
⏸ Pause
10s ▶
30s ⏭
20:36
iTerm2...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
21434
|
937
|
37
|
2026-05-11T17:50:41.163947+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778521841163_m2.jpg...
|
Code
|
screenpipe_sync.sh — screenpipe [SSH: nas]
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧ Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧G) - 10 pending changes
10
Run and Debug (⇧⌘D)
Remote Explorer
Extensions (⇧⌘X) - 2 require update
2
Claude Code
Containers
EXPLORER
EXPLORER
Explorer Section: screenpipe [SSH: nas]
Explorer Section: screenpipe [SSH: nas]
SCREENPIPE [SSH: NAS]
#recycle
app
__pycache__
consumers
static
.env
cli.py
M
db.py
docker-compose.yml
Dockerfile
M
main.py
M
requirements.txt
M
data
logs
pipes
.gitignore
app_settings.json
archive.db
archive.db-bak
U
db.sqlite
db.sqlite-shm
db.sqlite-wal
screenpipe_sync_updated.sh
U
screenpipe_sync.sh
screenpipe.db
Outline Section
OUTLINE
OUTLINE
Timeline Section
TIMELINE
TIMELINE
app_settings.json, Editor Group 1
screenpipe_sync.sh, Editor Group 1
screenpipe_sync_updated.sh, preview, Editor Group 1
pipe.md, Editor Group 1
.env, Editor Group 1
#!/bin/bash
# screenpipe_sync.sh
# Syncs Screenpipe SQLite data (vision + audio) to a NAS archive database.
# Append-only, no deletions.
#
# Key design points
# -----------------
# 1. Multi-install safe via install_id.
# Source IDs reset to 1 on every screenpipe reinstall. To avoid collisions
# in the NAS archive, every synced table gets an extra `install_id` column,
# and the logical primary key becomes (install_id, id) enforced by a
# unique index. The install_id is a UUID stored in
# ~/.screenpipe/.sync_install_id — wiping ~/.screenpipe/ (which is what
# happens on reinstall) discards it, so the next run generates a new one.
#
# 2. Schema-drift tolerant. If screenpipe migrations add new columns to the
# source DB, the NAS gets ALTER TABLE'd to match. Inserts use explicit
# column lists so positional mismatches can't occur.
#
# 3. FTS caveat. FTS tables in the NAS use source `id` as rowid. After a
# reinstall, INSERT OR IGNORE will silently skip rows whose id collides
# with a previous install's id, so FTS only reliably indexes the most
# recent install. Falls back to LIKE queries on the base tables for
# multi-install searches (which can filter by install_id).
#
# Usage
# -----
# ./screenpipe_sync.sh # syncs yesterday
# ./screenpipe_sync.sh 2026-04-15 # syncs a specific date
# ./screenpipe_sync.sh today # syncs today so far
# ./screenpipe_sync.sh --reset-install-id # rotate install_id and exit
# ./screenpipe_sync.sh --show-install-id # print install_id and exit
set -euo pipefail
# ─── CONFIG ───────────────────────────────────────────────────────────────────
DB_SRC="${SCREENPIPE_DB:-$HOME/.screenpipe/db.sqlite}"
NAS_MOUNT="${NAS_MOUNT:-/Volumes/screenpipe}"
NAS_DB="$NAS_MOUNT/archive.db"
NAS_DATA="$NAS_MOUNT/data"
LOG_FILE="$HOME/.screenpipe/sync.log"
INSTALL_ID_FILE="$HOME/.screenpipe/.sync_install_id"
# Sync table groups. Order matters for FK-ish references
# (parents before children).
VISION_TABLES=(video_chunks frames elements ocr_text ui_events meetings)
AUDIO_TABLES=(speakers speaker_embeddings audio_chunks audio_transcriptions audio_tags)
ALL_SYNC_TABLES=("${VISION_TABLES[@]}" "${AUDIO_TABLES[@]}")
# ──────────────────────────────────────────────────────────────────────────────
SCRIPT_START=$(date +%s)
# ─── HELPERS ──────────────────────────────────────────────────────────────────
log() {
local msg="[$(date '+%Y-%m-%d %H:%M:%S')] $*"
echo "$msg" | tee -a "$LOG_FILE"
}
step() {
local now=$(date +%s)
local elapsed=$(( now - SCRIPT_START ))
local min=$(( elapsed / 60 ))
local sec=$(( elapsed % 60 ))
printf "\n[+%02dm%02ds] ▶ %s\n" "$min" "$sec" "$*" | tee -a "$LOG_FILE"
}
run_sqlite_heredoc() {
local label="$1"
local sql="$2"
local start=$(date +%s)
printf " %-36s " "$label"
sqlite3 "$DB_SRC" <<< "$sql" &
local pid=$!
local spin=[PASSWORD] '⠙' '⠹' '⠸' '⠼' '⠴' '⠦' '⠧' '⠇' '⠏')
local i=0
while kill -0 "$pid" 2>/dev/null; do
printf "\r %-36s %s " "$label" "${spin[$i]}"
i=$(( (i + 1) % 10 ))
sleep 0.2
done
wait "$pid"
local rc=$?
if [ $rc -ne 0 ]; then
printf "\r %-36s ✗ FAILED\n" "$label" | tee -a "$LOG_FILE"
exit $rc
fi
local dur=$(( $(date +%s) - start ))
printf "\r %-36s ✓ %dm%02ds\n" "$label" "$(( dur / 60 ))" "$(( dur % 60 ))" | tee -a "$LOG_FILE"
}
check() {
local label="$1" got="$2" expected="$3"
if [ "$got" -eq "$expected" ]; then
printf " %-25s %s / %s ✓\n" "$label:" "$got" "$expected"
else
printf " %-25s %s / %s ✗ MISMATCH\n" "$label:" "$got" "$expected"
fi
}
table_columns_with_types() {
local db="$1" table="$2"
sqlite3 "$db" "PRAGMA table_info($table);" | awk -F'|' '{print $2 "|" $3}'
}
table_columns() {
local db="$1" table="$2"
sqlite3 "$db" "PRAGMA table_info($table);" | awk -F'|' '{print $2}'
}
table_exists() {
local db="$1" table="$2"
local count
count=$(sqlite3 "$db" "SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='$table';")
[ "$count" -gt 0 ]
}
# Adds any columns present in source but missing in NAS for the given table.
# Skips install_id (which is NAS-only and managed separately).
ensure_columns() {
local table="$1"
local label="schema: $table"
printf " %-36s " "$label"
if ! table_exists "$DB_SRC" "$table"; then
printf "✗ source missing — skipping\n"
return 0
fi
if ! table_exists "$NAS_DB" "$table"; then
printf "✓ fresh (created above)\n"
return 0
fi
local src_cols
src_cols=$(table_columns_with_types "$DB_SRC" "$table")
local nas_cols
nas_cols=$(table_columns "$NAS_DB" "$table")
local added=0
local added_names=""
while IFS='|' read -r name type; do
[ -z "$name" ] && continue
if ! echo "$nas_cols" | grep -Fxq "$name"; then
sqlite3 "$NAS_DB" "ALTER TABLE $table ADD COLUMN \"$name\" $type;"
added=$((added + 1))
added_names="$added_names $name"
fi
done <<< "$src_cols"
if [ "$added" -gt 0 ]; then
printf "✓ added %d:%s\n" "$added" "$added_names"
else
printf "✓ in sync\n"
fi
}
# Comma-separated, double-quoted column list for a table from source DB.
# Optional alias is prefixed (e.g. `o."col"`) for JOIN selects where column
# names would otherwise collide.
build_col_list() {
local table="$1"
local alias="${2:-}"
local prefix=""
[ -n "$alias" ] && prefix="${alias}."
table_columns "$DB_SRC" "$table" | awk 'NF' | awk -v p="$prefix" '{print p "\"" $0 "\""}' | paste -sd, -
}
# ──────────────────────────────────────────────────────────────────────────────
# ─── ARG HANDLING ─────────────────────────────────────────────────────────────
if [ "${1:-}" = "--reset-install-id" ]; then
if [ -f "$INSTALL_ID_FILE" ]; then
OLD=$(cat "$INSTALL_ID_FILE")
rm -f "$INSTALL_ID_FILE"
echo "Removed install_id: $OLD"
else
echo "No install_id file at $INSTALL_ID_FILE"
fi
echo "A new install_id will be generated on the next sync run."
exit 0
fi
if [ "${1:-}" = "--show-install-id" ]; then
if [ -f "$INSTALL_ID_FILE" ]; then
cat "$INSTALL_ID_FILE"
else
echo "(none — will be generated on next run)"
fi
exit 0
fi
if [ "${1:-}" = "today" ]; then
TARGET_DATE=$(date +%Y-%m-%d)
elif [ -n "${1:-}" ]; then
TARGET_DATE="$1"
if ! [[ "$TARGET_DATE" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then
echo "ERROR: Invalid date. Use YYYY-MM-DD, 'today', or no argument for yesterday."
exit 1
fi
else
TARGET_DATE=$(date -v-1d +%Y-%m-%d)
fi
# ─── INSTALL ID ───────────────────────────────────────────────────────────────
INSTALL_ID=""
if [ -f "$INSTALL_ID_FILE" ]; then
INSTALL_ID=$(tr -d '[:space:]' < "$INSTALL_ID_FILE")
fi
if [ -z "$INSTALL_ID" ]; then
INSTALL_ID=$(uuidgen | tr 'A-Z' 'a-z')
echo "$INSTALL_ID" > "$INSTALL_ID_FILE"
log "Generated new install_id: $INSTALL_ID"
fi
log "========================================"
log "Screenpipe sync starting for: $TARGET_DATE"
log "install_id: $INSTALL_ID"
log "========================================"
# ─── PREFLIGHT ────────────────────────────────────────────────────────────────
step "Preflight checks"
if [ ! -f "$DB_SRC" ]; then
log "ERROR: Source DB not found at $DB_SRC"; exit 1
fi
printf " %-25s %s (%s)\n" "Source DB:" "OK" "$(du -sh "$DB_SRC" | cut -f1)"
if [ ! -d "$NAS_MOUNT" ]; then
log "ERROR: NAS not mounted at $NAS_MOUNT"; exit 1
fi
printf " %-25s %s\n" "NAS mount:" "OK $NAS_MOUNT"
# Check if DB already synced for this date+install_id
DB_ALREADY_SYNCED=false
if [ -f "$NAS_DB" ]; then
if table_exists "$NAS_DB" "frames"; then
HAS_INSTALL_COL=$(sqlite3 "$NAS_DB" "SELECT COUNT(*) FROM pragma_table_info('frames') WHERE name='install_id';")
if [ "$HAS_INSTALL_COL" -gt "0" ]; then
EXISTING=$(sqlite3 "$NAS_DB" "SELECT COUNT(*) FROM frames WHERE date(timestamp)='$TARGET_DATE' AND install_id='$INSTALL_ID';" 2>/dev/null || echo "0")
else
EXISTING=$(sqlite3 "$NAS_DB" "SELECT COUNT(*) FROM frames WHERE date(timestamp)='$TARGET_DATE';" 2>/dev/null || echo "0")
fi
if [ "$EXISTING" -gt "0" ]; then
log "Date $TARGET_DATE / install $INSTALL_ID already has $EXISTING frames — skipping DB sync"
DB_ALREADY_SYNCED=true
else
printf " %-25s %s (%s)\n" "Archive DB:" "exists" "$(du -sh "$NAS_DB" | cut -f1)"
fi
else
printf " %-25s %s\n" "Archive DB:" "exists, no frames table yet"
fi
else
printf " %-25s %s\n" "Archive DB:" "will be created"
fi
# Source data dir for this date (video frames)
DATA_SRC="$HOME/.screenpipe/data/data/$TARGET_DATE"
if [ -d "$DATA_SRC" ]; then
DATA_SIZE=$(du -sh "$DATA_SRC" | cut -f1)
DATA_FILES=$(ls "$DATA_SRC" | wc -l | tr -d ' ')
printf " %-25s %s (%s files, %s)\n" "Frame data dir:" "OK" "$DATA_FILES" "$DATA_SIZE"
else
printf " %-25s %s\n" "Frame data dir:" "not found — skipping"
fi
# Audio files (flat in ~/.screenpipe/data/, dated by filename)
shopt -s nullglob
AUDIO_SRC_FILES=( "$HOME/.screenpipe/data/"*_"${TARGET_DATE}"_*.mp4 )
shopt -u nullglob
if [ ${#AUDIO_SRC_FILES[@]} -gt 0 ]; then
AUDIO_TOTAL=$(du -ch "${AUDIO_SRC_FILES[@]}" | tail -1 | cut -f1)
printf " %-25s %s (%s files, %s)\n" "Audio files:" "OK" "${#AUDIO_SRC_FILES[@]}" "$AUDIO_TOTAL"
else
printf " %-25s %s\n" "Audio files:" "none for this date"
fi
# ─── SCHEMA MIGRATION: install_id ─────────────────────────────────────────────
# Adds install_id column to existing NAS tables, backfills NULLs with a
# legacy tag, and creates the (install_id, id) unique index. Idempotent.
if [ -f "$NAS_DB" ]; then
step "Schema migration: install_id"
LEGACY_TAG="legacy-$(date +%Y%m%d)"
for tbl in "${ALL_SYNC_TABLES[@]}"; do
if ! table_exists "$NAS_DB" "$tbl"; then
continue
fi
HAS_COL=$(sqlite3 "$NAS_DB" "SELECT COUNT(*) FROM pragma_table_info('$tbl') WHERE name='install_id';")
if [ "$HAS_COL" = "0" ]; then
ROW_COUNT=$(sqlite3 "$NAS_DB" "SELECT COUNT(*) FROM $tbl;")
printf " %-36s adding install_id, backfill %s rows → %s\n" "$tbl" "$ROW_COUNT" "$LEGACY_TAG"
sqlite3 "$NAS_DB" "ALTER TABLE $tbl ADD COLUMN install_id TEXT;"
sqlite3 "$NAS_DB" "UPDATE $tbl SET install_id = '$LEGACY_TAG' WHERE install_id IS NULL;"
fi
sqlite3 "$NAS_DB" "CREATE UNIQUE INDEX IF NOT EXISTS idx_${tbl}_install_pk ON ${tbl}(install_id, id);"
done
fi
# ─── DB SYNC ──────────────────────────────────────────────────────────────────
if [ "$DB_ALREADY_SYNCED" = false ]; then
# ─── COUNT SOURCE ROWS ────────────────────────────────────────────────────
step "Counting source rows for $TARGET_DATE"
SRC_FRAMES=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM frames WHERE date(timestamp) = '$TARGET_DATE';")
SRC_ELEMENTS=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM elements WHERE frame_id IN (SELECT id FROM frames WHERE date(timestamp) = '$TARGET_DATE');")
SRC_UI=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM ui_events WHERE date(timestamp) = '$TARGET_DATE';")
SRC_OCR=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM ocr_text WHERE frame_id IN (SELECT id FROM frames WHERE date(timestamp) = '$TARGET_DATE');")
SRC_MEETINGS=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM meetings WHERE date(meeting_start) = '$TARGET_DATE';")
SRC_ACHUNKS=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM audio_chunks WHERE date(timestamp) = '$TARGET_DATE';")
SRC_ATRANS=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM audio_transcriptions WHERE audio_chunk_id IN (SELECT id FROM audio_chunks WHERE date(timestamp) = '$TARGET_DATE');")
SRC_ATAGS=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM audio_tags WHERE audio_chunk_id IN (SELECT id FROM audio_chunks WHERE date(timestamp) = '$TARGET_DATE');")
# speakers + speaker_embeddings are install-global, not per-date; we sync all.
SRC_SPEAKERS=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM speakers;")
SRC_SEMB=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM speaker_embeddings;")
printf " %-25s %s\n" "frames:" "$SRC_FRAMES"
printf " %-25s %s\n" "elements:" "$SRC_ELEMENTS"
printf " %-25s %s\n" "ui_events:" "$SRC_UI"
printf " %-25s %s\n" "ocr_text:" "$SRC_OCR"
printf " %-25s %s\n" "meetings:" "$SRC_MEETINGS"
printf " %-25s %s\n" "audio_chunks:" "$SRC_ACHUNKS"
printf " %-25s %s\n" "audio_transcriptions:" "$SRC_ATRANS"
printf " %-25s %s\n" "audio_tags:" "$SRC_ATAGS"
printf " %-25s %s (all-time)\n" "speakers:" "$SRC_SPEAKERS"
printf " %-25s %s (all-time)\n" "speaker_embeddings:" "$SRC_SEMB"
if [ "$SRC_FRAMES" -eq "0" ] && [ "$SRC_ACHUNKS" -eq "0" ]; then
log "No frames or audio chunks for $TARGET_DATE — skipping DB sync"
DB_ALREADY_SYNCED=true
fi
fi
if [ "$DB_ALREADY_SYNCED" = false ]; then
# ─── INIT TABLES ──────────────────────────────────────────────────────────
step "Initialising tables (CREATE IF NOT EXISTS)"
run_sqlite_heredoc "creating vision tables" "
ATTACH '$NAS_DB' AS nas;
CREATE TABLE IF NOT EXISTS nas.frames AS SELECT * FROM main.frames WHERE 0;
CREATE TABLE IF NOT EXISTS nas.elements AS SELECT * FROM main.elements WHERE 0;
CREATE TABLE IF NOT EXISTS nas.ui_events AS SELECT * FROM main.ui_events WHERE 0;
CREATE TABLE IF NOT EXISTS nas.ocr_text AS SELECT * FROM main.ocr_text WHERE 0;
CREATE TABLE IF NOT EXISTS nas.video_chunks AS SELECT * FROM main.video_chunks WHERE 0;
CREATE TABLE IF NOT EXISTS nas.meetings AS SELECT * FROM main.meetings WHERE 0;
DETACH nas;
"
run_sqlite_heredoc "creating audio tables" "
ATTACH '$NAS_DB' AS nas;
CREATE TABLE IF NOT EXISTS nas.audio_chunks AS SELECT * FROM main.audio_chunks WHERE 0;
CREATE TABLE IF NOT EXISTS nas.audio_transcriptions AS SELECT * FROM main.audio_transcriptions WHERE 0;
CREATE TABLE IF NOT EXISTS nas.speakers AS SELECT * FROM main.speakers WHERE 0;
CREATE TABLE IF NOT EXISTS nas.speaker_embeddings AS SELECT * FROM main.speaker_embeddings WHERE 0;
CREATE TABLE IF NOT EXISTS nas.audio_tags AS SELECT * FROM main.audio_tags WHERE 0;
DETACH nas;
"
# Re-run install_id + index setup so freshly-created tables get them too.
for tbl in "${ALL_SYNC_TABLES[@]}"; do
HAS_COL=$(sqlite3 "$NAS_DB" "SELECT COUNT(*) FROM pragma_table_info('$tbl') WHERE name='install_id';")
if [ "$HAS_COL" = "0" ]; then
sqlite3 "$NAS_DB" "ALTER TABLE $tbl ADD COLUMN install_id TEXT;"
fi
sqlite3 "$NAS_DB" "CREATE UNIQUE INDEX IF NOT EXISTS idx_${tbl}_install_pk ON ${tbl}(install_id, id);"
done
# ─── SCHEMA DRIFT ─────────────────────────────────────────────────────────
step "Reconciling NAS schema with source"
for tbl in "${ALL_SYNC_TABLES[@]}"; do
ensure_columns "$tbl"
done
run_sqlite_heredoc "creating indexes" "
ATTACH '$NAS_DB' AS nas;
-- vision
CREATE INDEX IF NOT EXISTS nas.idx_frames_timestamp ON frames(timestamp);
CREATE INDEX IF NOT EXISTS nas.idx_frames_app_name ON frames(app_name);
CREATE INDEX IF NOT EXISTS nas.idx_frames_window_name ON frames(window_name);
CREATE INDEX IF NOT EXISTS nas.idx_frames_video_chunk_id ON frames(video_chunk_id);
CREATE INDEX IF NOT EXISTS nas.idx_frames_document_path ON frames(document_path) WHERE document_path IS NOT NULL;
CREATE INDEX IF NOT EXISTS nas.idx_elements_frame_id ON elements(frame_id);
CREATE INDEX IF NOT EXISTS nas.idx_elements_frame_src_role ON elements(frame_id, source, role) WHERE text IS NOT NULL;
CREATE INDEX IF NOT EXISTS nas.idx_elements_onscreen_frame ON elements(frame_id) WHERE on_screen = 1 AND text IS NOT NULL;
CREATE INDEX IF NOT EXISTS nas.idx_ui_events_timestamp ON ui_events(timestamp);
CREATE INDEX IF NOT EXISTS nas.idx_ui_events_app_name ON ui_events(app_name);
CREATE INDEX IF NOT EXISTS nas.idx_ui_events_frame_id ON ui_events(frame_id);
CREATE INDEX IF NOT EXISTS nas.idx_ocr_text_frame_id ON ocr_text(frame_id);
CREATE INDEX IF NOT EXISTS nas.idx_meetings_start ON meetings(meeting_start);
CREATE INDEX IF NOT EXISTS nas.idx_video_chunks_device ON video_chunks(device_name);
-- audio
CREATE INDEX IF NOT EXISTS nas.idx_audio_chunks_timestamp ON audio_chunks(timestamp);
CREATE INDEX IF NOT EXISTS nas.idx_audio_trans_chunk_id ON audio_transcriptions(audio_chunk_id);
CREATE INDEX IF NOT EXISTS nas.idx_audio_trans_timestamp ON audio_transcriptions(timestamp);
CREATE INDEX IF NOT EXISTS nas.idx_audio_trans_speaker ON audio_transcriptions(speaker_id, timestamp DESC);
CREATE INDEX IF NOT EXISTS nas.idx_speaker_emb_speaker_id ON speaker_embeddings(speaker_id);
CREATE INDEX IF NOT EXISTS nas.idx_audio_tags_chunk_id ON audio_tags(audio_chunk_id);
DETACH nas;
"
run_sqlite_heredoc "creating FTS tables" "
ATTACH '$NAS_DB' AS nas;
CREATE VIRTUAL TABLE IF NOT EXISTS nas.elements_fts USING fts5(
text, role, frame_id UNINDEXED,
content='elements', content_rowid='id', tokenize='unicode61'
);
CREATE VIRTUAL TABLE IF NOT EXISTS nas.frames_fts USING fts5(
full_text, app_name, window_name, browser_url, id UNINDEXED,
tokenize='unicode61'
);
CREATE VIRTUAL TABLE IF NOT EXISTS nas.ui_events_fts USING fts5(
text_content, app_name, window_title, element_name,
content='ui_events', content_rowid='id', tokenize='unicode61'
);
CREATE VIRTUAL TABLE IF NOT EXISTS nas.audio_transcriptions_fts USING fts5(
transcription, device, speaker_id UNINDEXED, id UNINDEXED,
tokenize='unicode61'
);
DETACH nas;
"
# ─── BUILD EXPLICIT COLUMN LISTS ──────────────────────────────────────────
# Source columns + install_id appended. Same on both sides of the INSERT.
FRAMES_COLS=$(build_col_list frames)
ELEMENTS_COLS=$(build_col_list elements)
ELEMENTS_COLS_E=$(build_col_list elements e)
UI_EVENTS_COLS=$(build_col_list ui_events)
OCR_TEXT_COLS=$(build_col_list ocr_text)
OCR_TEXT_COLS_O=$(build_col_list ocr_text o)
VIDEO_CHUNKS_COLS=$(build_col_list video_chunks)
MEETINGS_COLS=$(build_col_list meetings)
ACHUNKS_COLS=$(build_col_list audio_chunks)
ATRANS_COLS=$(build_col_list audio_transcriptions)
ATRANS_COLS_T=$(build_col_list audio_transcriptions t)
SPEAKERS_COLS=$(build_col_list speakers)
SEMB_COLS=$(build_col_list speaker_embeddings)
ATAGS_COLS=$(build_col_list audio_tags)
ATAGS_COLS_AT=$(build_col_list audio_tags at)
# ─── SYNC VISION DATA ─────────────────────────────────────────────────────
step "Syncing vision data for $TARGET_DATE"
run_sqlite_heredoc "video_chunks" "
ATTACH '$NAS_DB' AS nas;
INSERT OR IGNORE INTO nas.video_chunks ($VIDEO_CHUNKS_COLS, install_id)
SELECT $VIDEO_CHUNKS_COLS, '$INSTALL_ID' FROM main.video_chunks
WHERE id IN (
SELECT DISTINCT video_chunk_id FROM main.frames
WHERE date(timestamp) = '$TARGET_DATE' AND video_chunk_id IS NOT NULL
);
DETACH nas;
"
run_sqlite_heredoc "frames ($SRC_FRAMES rows)" "
ATTACH '$NAS_DB' AS nas;
INSERT OR IGNORE INTO nas.frames ($FRAMES_COLS, install_id)
SELECT $FRAMES_COLS, '$INSTALL_ID' FROM main.frames WHERE date(timestamp) = '$TARGET_DATE';
DETACH nas;
"
run_sqlite_heredoc "ocr_text ($SRC_OCR rows)" "
ATTACH '$NAS_DB' AS nas;
INSERT OR IGNORE INTO nas.ocr_text ($OCR_TEXT_COLS, install_id)
SELECT $OCR_TEXT_COLS_O, '$INSTALL_ID' FROM main.ocr_text o
JOIN main.frames f ON o.frame_id = f.id
WHERE date(f.timestamp) = '$TARGET_DATE';
DETACH nas;
"
run_sqlite_heredoc "ui_events ($SRC_UI rows)" "
ATTACH '$NAS_DB' AS nas;
INSERT OR IGNORE INTO nas.ui_events ($UI_EVENTS_COLS, install_id)
SELECT $UI_EVENTS_COLS, '$INSTALL_ID' FROM main.ui_events WHERE date(timestamp) = '$TARGET_DATE';
DETACH nas;
"
run_sqlite_heredoc "elements ($SRC_ELEMENTS rows)" "
ATTACH '$NAS_DB' AS nas;
INSERT OR IGNORE INTO nas.elements ($ELEMENTS_COLS, install_id)
SELECT $ELEMENTS_COLS_E, '$INSTALL_ID' FROM main.elements e
JOIN main.frames f ON e.frame_id = f.id
WHERE date(f.timestamp) = '$TARGET_DATE';
DETACH nas;
"
run_sqlite_heredoc "meetings ($SRC_MEETINGS rows)" "
ATTACH '$NAS_DB' AS nas;
INSERT OR IGNORE INTO nas.meetings ($MEETINGS_COLS, install_id)
SELECT $MEETINGS_COLS, '$INSTALL_ID' FROM main.meetings WHERE date(meeting_start) = '$TARGET_DATE';
DETACH nas;
"
# ─── SYNC AUDIO DATA ──────────────────────────────────────────────────────
step "Syncing audio data for $TARGET_DATE"
# Speakers + embeddings are install-global, not per-date. Sync everything...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Explorer (⇧⌘E)","depth":19,"bounds":{"left":0.0,"top":0.047885075,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":true},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.057462092,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Search (⇧⌘F)","depth":19,"bounds":{"left":0.0,"top":0.08619314,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.09577015,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Source Control (⌃⇧G) - 10 pending changes","depth":19,"bounds":{"left":0.0,"top":0.1245012,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.13407822,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"10","depth":22,"bounds":{"left":0.00831117,"top":0.1452514,"width":0.003656915,"height":0.008778931},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.00831117,"top":0.14604948,"width":0.0016622341,"height":0.007980846}},{"char_start":1,"char_count":1,"bounds":{"left":0.009973404,"top":0.14604948,"width":0.0023271276,"height":0.007980846}}],"role_description":"text"},{"role":"AXRadioButton","text":"Run and Debug (⇧⌘D)","depth":19,"bounds":{"left":0.0,"top":0.16280925,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.17238627,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Remote Explorer","depth":19,"bounds":{"left":0.0,"top":0.20111732,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.21069433,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Extensions (⇧⌘X) - 2 require update","depth":19,"bounds":{"left":0.0,"top":0.23942538,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.2490024,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":22,"bounds":{"left":0.009640957,"top":0.2601756,"width":0.0019946808,"height":0.008778931},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Claude Code","depth":19,"bounds":{"left":0.0,"top":0.27773345,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Containers","depth":19,"bounds":{"left":0.0,"top":0.3160415,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"EXPLORER","depth":17,"bounds":{"left":0.022606382,"top":0.047885075,"width":0.018949468,"height":0.02793296},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"EXPLORER","depth":18,"bounds":{"left":0.022606382,"top":0.056664005,"width":0.018949468,"height":0.0103751},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.022606382,"top":0.056664005,"width":0.0023271276,"height":0.0103751}},{"char_start":1,"char_count":7,"bounds":{"left":0.024933511,"top":0.056664005,"width":0.01662234,"height":0.0103751}}],"role_description":"text"},{"role":"AXButton","text":"Explorer Section: screenpipe [SSH: nas]","depth":21,"bounds":{"left":0.015957447,"top":0.07581804,"width":0.09940159,"height":0.017557861},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"","depth":23,"bounds":{"left":0.01662234,"top":0.07821229,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"Explorer Section: screenpipe [SSH: nas]","depth":22,"bounds":{"left":0.022606382,"top":0.07581804,"width":0.045877658,"height":0.017557861},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"SCREENPIPE [SSH: NAS]","depth":23,"bounds":{"left":0.022606382,"top":0.079010375,"width":0.045877658,"height":0.0103751},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.022606382,"top":0.07980846,"width":0.0026595744,"height":0.0103751}},{"char_start":1,"char_count":20,"bounds":{"left":0.025265958,"top":0.07980846,"width":0.043218084,"height":0.0103751}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.09577015,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"#recycle","depth":27,"bounds":{"left":0.025930852,"top":0.09577015,"width":0.017287234,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.096568234,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":7,"bounds":{"left":0.028590426,"top":0.096568234,"width":0.01462766,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.11332801,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"app","depth":27,"bounds":{"left":0.025930852,"top":0.11332801,"width":0.0076462766,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.11412609,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":2,"bounds":{"left":0.02825798,"top":0.11412609,"width":0.005319149,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.10605053,"top":0.11412609,"width":0.004654255,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.13088587,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"__pycache__","depth":27,"bounds":{"left":0.028590426,"top":0.13088587,"width":0.026595745,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.13168396,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":10,"bounds":{"left":0.030917553,"top":0.13168396,"width":0.024268618,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.14844373,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"consumers","depth":27,"bounds":{"left":0.028590426,"top":0.14844373,"width":0.022273935,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.14924182,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":8,"bounds":{"left":0.030917553,"top":0.14924182,"width":0.019946808,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.10605053,"top":0.14924182,"width":0.004654255,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.1660016,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"static","depth":27,"bounds":{"left":0.028590426,"top":0.1660016,"width":0.010970744,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.16679968,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":5,"bounds":{"left":0.030917553,"top":0.16679968,"width":0.008976064,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.10605053,"top":0.16679968,"width":0.004654255,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.1819633,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".env","depth":27,"bounds":{"left":0.028590426,"top":0.18355946,"width":0.00831117,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.18435754,"width":0.0013297872,"height":0.011971269}},{"char_start":1,"char_count":3,"bounds":{"left":0.029920213,"top":0.18435754,"width":0.006981383,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.19952115,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"cli.py","depth":27,"bounds":{"left":0.028590426,"top":0.20111732,"width":0.010638298,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.2019154,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":5,"bounds":{"left":0.030917553,"top":0.2019154,"width":0.00831117,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"bounds":{"left":0.10638298,"top":0.2019154,"width":0.003656915,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.21707901,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"db.py","depth":27,"bounds":{"left":0.028590426,"top":0.21867518,"width":0.011303191,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.21947326,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":4,"bounds":{"left":0.03125,"top":0.21947326,"width":0.008643617,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.23463687,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"docker-compose.yml","depth":27,"bounds":{"left":0.028590426,"top":0.23623304,"width":0.042220745,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.23703113,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":17,"bounds":{"left":0.03125,"top":0.23703113,"width":0.03956117,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.25219473,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Dockerfile","depth":27,"bounds":{"left":0.028590426,"top":0.25379092,"width":0.020611702,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.254589,"width":0.0033244682,"height":0.011971269}},{"char_start":1,"char_count":9,"bounds":{"left":0.031914894,"top":0.254589,"width":0.017287234,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"bounds":{"left":0.10638298,"top":0.254589,"width":0.003656915,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.2697526,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"main.py","depth":27,"bounds":{"left":0.028590426,"top":0.27134877,"width":0.015625,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.27214685,"width":0.003656915,"height":0.011971269}},{"char_start":1,"char_count":6,"bounds":{"left":0.032247342,"top":0.27214685,"width":0.012300532,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"bounds":{"left":0.10638298,"top":0.27214685,"width":0.003656915,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.28731045,"width":0.0076462766,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"requirements.txt","depth":27,"bounds":{"left":0.028590426,"top":0.28890663,"width":0.032912236,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.2897047,"width":0.0016622341,"height":0.011971269}},{"char_start":1,"char_count":15,"bounds":{"left":0.03025266,"top":0.2897047,"width":0.03158245,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"bounds":{"left":0.10638298,"top":0.2897047,"width":0.003656915,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.3064645,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"data","depth":27,"bounds":{"left":0.025930852,"top":0.3064645,"width":0.008976064,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.30726257,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":3,"bounds":{"left":0.028590426,"top":0.30726257,"width":0.0063164895,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.32402235,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"logs","depth":27,"bounds":{"left":0.025930852,"top":0.32402235,"width":0.00831117,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.32482043,"width":0.0009973404,"height":0.011971269}},{"char_start":1,"char_count":3,"bounds":{"left":0.026928192,"top":0.32482043,"width":0.0076462766,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.10605053,"top":0.32482043,"width":0.004654255,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.3415802,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"pipes","depth":27,"bounds":{"left":0.025930852,"top":0.3415802,"width":0.010970744,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.3423783,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":4,"bounds":{"left":0.028590426,"top":0.3423783,"width":0.00831117,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.01861702,"top":0.3575419,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".gitignore","depth":27,"bounds":{"left":0.025930852,"top":0.35913807,"width":0.018949468,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.35993615,"width":0.0013297872,"height":0.011971269}},{"char_start":1,"char_count":9,"bounds":{"left":0.027260639,"top":0.35993615,"width":0.017952127,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.01861702,"top":0.37509975,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"app_settings.json","depth":27,"bounds":{"left":0.025930852,"top":0.37669593,"width":0.03557181,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.377494,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":16,"bounds":{"left":0.02825798,"top":0.377494,"width":0.03324468,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.01861702,"top":0.3926576,"width":0.0076462766,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"archive.db","depth":27,"bounds":{"left":0.025930852,"top":0.3942538,"width":0.020944148,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.39505187,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":9,"bounds":{"left":0.02825798,"top":0.39505187,"width":0.01861702,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.01861702,"top":0.4102155,"width":0.0076462766,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"archive.db-bak","depth":27,"bounds":{"left":0.025930852,"top":0.41181165,"width":0.03025266,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.41260973,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":13,"bounds":{"left":0.02825798,"top":0.41260973,"width":0.027925532,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"U","depth":27,"bounds":{"left":0.10704787,"top":0.41260973,"width":0.0029920214,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.01861702,"top":0.42777336,"width":0.0076462766,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"db.sqlite","depth":27,"bounds":{"left":0.025930852,"top":0.4293695,"width":0.017287234,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.4301676,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":8,"bounds":{"left":0.028590426,"top":0.4301676,"width":0.014960106,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.01861702,"top":0.44533122,"width":0.0076462766,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"db.sqlite-shm","depth":27,"bounds":{"left":0.025930852,"top":0.44692737,"width":0.027925532,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.44772545,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":12,"bounds":{"left":0.028590426,"top":0.44772545,"width":0.025265958,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.01861702,"top":0.46288908,"width":0.0076462766,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"db.sqlite-wal","depth":27,"bounds":{"left":0.025930852,"top":0.46448523,"width":0.025930852,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.46528333,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":12,"bounds":{"left":0.028590426,"top":0.46528333,"width":0.023603724,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.01861702,"top":0.48044693,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"screenpipe_sync_updated.sh","depth":27,"bounds":{"left":0.025930852,"top":0.4820431,"width":0.059175532,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.4828412,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":25,"bounds":{"left":0.02825798,"top":0.4828412,"width":0.056848403,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"U","depth":27,"bounds":{"left":0.10704787,"top":0.4828412,"width":0.0029920214,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.01861702,"top":0.4980048,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"screenpipe_sync.sh","depth":27,"bounds":{"left":0.025930852,"top":0.49960095,"width":0.039893616,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.50039905,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":17,"bounds":{"left":0.02825798,"top":0.50039905,"width":0.037898935,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.01861702,"top":0.51556265,"width":0.0076462766,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"screenpipe.db","depth":27,"bounds":{"left":0.025930852,"top":0.5171588,"width":0.028590426,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.5179569,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":12,"bounds":{"left":0.02825798,"top":0.5179569,"width":0.026595745,"height":0.011971269}}],"role_description":"text"},{"role":"AXButton","text":"Outline Section","depth":21,"bounds":{"left":0.015957447,"top":0.9473264,"width":0.09940159,"height":0.017557861},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"bounds":{"left":0.01662234,"top":0.9497207,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"OUTLINE","depth":22,"bounds":{"left":0.022606382,"top":0.9473264,"width":0.01662234,"height":0.017557861},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"OUTLINE","depth":23,"bounds":{"left":0.022606382,"top":0.95131683,"width":0.01662234,"height":0.0103751},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.022606382,"top":0.95131683,"width":0.0029920214,"height":0.0103751}},{"char_start":1,"char_count":6,"bounds":{"left":0.025598405,"top":0.95131683,"width":0.013630319,"height":0.0103751}}],"role_description":"text"},{"role":"AXButton","text":"Timeline Section","depth":21,"bounds":{"left":0.015957447,"top":0.9648843,"width":0.09940159,"height":0.017557861},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"bounds":{"left":0.01662234,"top":0.96727854,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"TIMELINE","depth":22,"bounds":{"left":0.022606382,"top":0.9648843,"width":0.01761968,"height":0.017557861},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"TIMELINE","depth":23,"bounds":{"left":0.022606382,"top":0.9688747,"width":0.01761968,"height":0.0103751},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.022606382,"top":0.9688747,"width":0.0026595744,"height":0.0103751}},{"char_start":1,"char_count":7,"bounds":{"left":0.025265958,"top":0.9688747,"width":0.015292553,"height":0.0103751}}],"role_description":"text"},{"role":"AXRadioButton","text":"app_settings.json, Editor Group 1","depth":28,"bounds":{"left":0.11569149,"top":0.047885075,"width":0.055851065,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"screenpipe_sync.sh, Editor Group 1","depth":28,"bounds":{"left":0.17154256,"top":0.047885075,"width":0.06050532,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXRadioButton","text":"screenpipe_sync_updated.sh, preview, Editor Group 1","depth":28,"bounds":{"left":0.23171543,"top":0.047885075,"width":0.08344415,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"pipe.md, Editor Group 1","depth":28,"bounds":{"left":0.3148271,"top":0.047885075,"width":0.040226065,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":".env, Editor Group 1","depth":28,"bounds":{"left":0.35472074,"top":0.047885075,"width":0.040226065,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"#!/bin/bash\n# screenpipe_sync.sh\n# Syncs Screenpipe SQLite data (vision + audio) to a NAS archive database.\n# Append-only, no deletions.\n#\n# Key design points\n# -----------------\n# 1. Multi-install safe via install_id.\n# Source IDs reset to 1 on every screenpipe reinstall. To avoid collisions\n# in the NAS archive, every synced table gets an extra `install_id` column,\n# and the logical primary key becomes (install_id, id) enforced by a\n# unique index. The install_id is a UUID stored in\n# ~/.screenpipe/.sync_install_id — wiping ~/.screenpipe/ (which is what\n# happens on reinstall) discards it, so the next run generates a new one.\n#\n# 2. Schema-drift tolerant. If screenpipe migrations add new columns to the\n# source DB, the NAS gets ALTER TABLE'd to match. Inserts use explicit\n# column lists so positional mismatches can't occur.\n#\n# 3. FTS caveat. FTS tables in the NAS use source `id` as rowid. After a\n# reinstall, INSERT OR IGNORE will silently skip rows whose id collides\n# with a previous install's id, so FTS only reliably indexes the most\n# recent install. Falls back to LIKE queries on the base tables for\n# multi-install searches (which can filter by install_id).\n#\n# Usage\n# -----\n# ./screenpipe_sync.sh # syncs yesterday\n# ./screenpipe_sync.sh 2026-04-15 # syncs a specific date\n# ./screenpipe_sync.sh today # syncs today so far\n# ./screenpipe_sync.sh --reset-install-id # rotate install_id and exit\n# ./screenpipe_sync.sh --show-install-id # print install_id and exit\n\nset -euo pipefail\n\n# ─── CONFIG ───────────────────────────────────────────────────────────────────\nDB_SRC=\"${SCREENPIPE_DB:-$HOME/.screenpipe/db.sqlite}\"\nNAS_MOUNT=\"${NAS_MOUNT:-/Volumes/screenpipe}\"\nNAS_DB=\"$NAS_MOUNT/archive.db\"\nNAS_DATA=\"$NAS_MOUNT/data\"\nLOG_FILE=\"$HOME/.screenpipe/sync.log\"\nINSTALL_ID_FILE=\"$HOME/.screenpipe/.sync_install_id\"\n\n# Sync table groups. Order matters for FK-ish references\n# (parents before children).\nVISION_TABLES=(video_chunks frames elements ocr_text ui_events meetings)\nAUDIO_TABLES=(speakers speaker_embeddings audio_chunks audio_transcriptions audio_tags)\nALL_SYNC_TABLES=(\"${VISION_TABLES[@]}\" \"${AUDIO_TABLES[@]}\")\n# ──────────────────────────────────────────────────────────────────────────────\n\nSCRIPT_START=$(date +%s)\n\n# ─── HELPERS ──────────────────────────────────────────────────────────────────\nlog() {\n local msg=\"[$(date '+%Y-%m-%d %H:%M:%S')] $*\"\n echo \"$msg\" | tee -a \"$LOG_FILE\"\n}\n\nstep() {\n local now=$(date +%s)\n local elapsed=$(( now - SCRIPT_START ))\n local min=$(( elapsed / 60 ))\n local sec=$(( elapsed % 60 ))\n printf \"\\n[+%02dm%02ds] ▶ %s\\n\" \"$min\" \"$sec\" \"$*\" | tee -a \"$LOG_FILE\"\n}\n\nrun_sqlite_heredoc() {\n local label=\"$1\"\n local sql=\"$2\"\n local start=$(date +%s)\n\n printf \" %-36s \" \"$label\"\n\n sqlite3 \"$DB_SRC\" <<< \"$sql\" &\n local pid=$!\n local spin=('⠋' '⠙' '⠹' '⠸' '⠼' '⠴' '⠦' '⠧' '⠇' '⠏')\n local i=0\n while kill -0 \"$pid\" 2>/dev/null; do\n printf \"\\r %-36s %s \" \"$label\" \"${spin[$i]}\"\n i=$(( (i + 1) % 10 ))\n sleep 0.2\n done\n wait \"$pid\"\n local rc=$?\n if [ $rc -ne 0 ]; then\n printf \"\\r %-36s ✗ FAILED\\n\" \"$label\" | tee -a \"$LOG_FILE\"\n exit $rc\n fi\n\n local dur=$(( $(date +%s) - start ))\n printf \"\\r %-36s ✓ %dm%02ds\\n\" \"$label\" \"$(( dur / 60 ))\" \"$(( dur % 60 ))\" | tee -a \"$LOG_FILE\"\n}\n\ncheck() {\n local label=\"$1\" got=\"$2\" expected=\"$3\"\n if [ \"$got\" -eq \"$expected\" ]; then\n printf \" %-25s %s / %s ✓\\n\" \"$label:\" \"$got\" \"$expected\"\n else\n printf \" %-25s %s / %s ✗ MISMATCH\\n\" \"$label:\" \"$got\" \"$expected\"\n fi\n}\n\ntable_columns_with_types() {\n local db=\"$1\" table=\"$2\"\n sqlite3 \"$db\" \"PRAGMA table_info($table);\" | awk -F'|' '{print $2 \"|\" $3}'\n}\n\ntable_columns() {\n local db=\"$1\" table=\"$2\"\n sqlite3 \"$db\" \"PRAGMA table_info($table);\" | awk -F'|' '{print $2}'\n}\n\ntable_exists() {\n local db=\"$1\" table=\"$2\"\n local count\n count=$(sqlite3 \"$db\" \"SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='$table';\")\n [ \"$count\" -gt 0 ]\n}\n\n# Adds any columns present in source but missing in NAS for the given table.\n# Skips install_id (which is NAS-only and managed separately).\nensure_columns() {\n local table=\"$1\"\n local label=\"schema: $table\"\n printf \" %-36s \" \"$label\"\n\n if ! table_exists \"$DB_SRC\" \"$table\"; then\n printf \"✗ source missing — skipping\\n\"\n return 0\n fi\n\n if ! table_exists \"$NAS_DB\" \"$table\"; then\n printf \"✓ fresh (created above)\\n\"\n return 0\n fi\n\n local src_cols\n src_cols=$(table_columns_with_types \"$DB_SRC\" \"$table\")\n local nas_cols\n nas_cols=$(table_columns \"$NAS_DB\" \"$table\")\n\n local added=0\n local added_names=\"\"\n while IFS='|' read -r name type; do\n [ -z \"$name\" ] && continue\n if ! echo \"$nas_cols\" | grep -Fxq \"$name\"; then\n sqlite3 \"$NAS_DB\" \"ALTER TABLE $table ADD COLUMN \\\"$name\\\" $type;\"\n added=$((added + 1))\n added_names=\"$added_names $name\"\n fi\n done <<< \"$src_cols\"\n\n if [ \"$added\" -gt 0 ]; then\n printf \"✓ added %d:%s\\n\" \"$added\" \"$added_names\"\n else\n printf \"✓ in sync\\n\"\n fi\n}\n\n# Comma-separated, double-quoted column list for a table from source DB.\n# Optional alias is prefixed (e.g. `o.\"col\"`) for JOIN selects where column\n# names would otherwise collide.\nbuild_col_list() {\n local table=\"$1\"\n local alias=\"${2:-}\"\n local prefix=\"\"\n [ -n \"$alias\" ] && prefix=\"${alias}.\"\n table_columns \"$DB_SRC\" \"$table\" | awk 'NF' | awk -v p=\"$prefix\" '{print p \"\\\"\" $0 \"\\\"\"}' | paste -sd, -\n}\n# ──────────────────────────────────────────────────────────────────────────────\n\n# ─── ARG HANDLING ─────────────────────────────────────────────────────────────\nif [ \"${1:-}\" = \"--reset-install-id\" ]; then\n if [ -f \"$INSTALL_ID_FILE\" ]; then\n OLD=$(cat \"$INSTALL_ID_FILE\")\n rm -f \"$INSTALL_ID_FILE\"\n echo \"Removed install_id: $OLD\"\n else\n echo \"No install_id file at $INSTALL_ID_FILE\"\n fi\n echo \"A new install_id will be generated on the next sync run.\"\n exit 0\nfi\n\nif [ \"${1:-}\" = \"--show-install-id\" ]; then\n if [ -f \"$INSTALL_ID_FILE\" ]; then\n cat \"$INSTALL_ID_FILE\"\n else\n echo \"(none — will be generated on next run)\"\n fi\n exit 0\nfi\n\nif [ \"${1:-}\" = \"today\" ]; then\n TARGET_DATE=$(date +%Y-%m-%d)\nelif [ -n \"${1:-}\" ]; then\n TARGET_DATE=\"$1\"\n if ! [[ \"$TARGET_DATE\" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then\n echo \"ERROR: Invalid date. Use YYYY-MM-DD, 'today', or no argument for yesterday.\"\n exit 1\n fi\nelse\n TARGET_DATE=$(date -v-1d +%Y-%m-%d)\nfi\n\n# ─── INSTALL ID ───────────────────────────────────────────────────────────────\nINSTALL_ID=\"\"\nif [ -f \"$INSTALL_ID_FILE\" ]; then\n INSTALL_ID=$(tr -d '[:space:]' < \"$INSTALL_ID_FILE\")\nfi\nif [ -z \"$INSTALL_ID\" ]; then\n INSTALL_ID=$(uuidgen | tr 'A-Z' 'a-z')\n echo \"$INSTALL_ID\" > \"$INSTALL_ID_FILE\"\n log \"Generated new install_id: $INSTALL_ID\"\nfi\n\nlog \"========================================\"\nlog \"Screenpipe sync starting for: $TARGET_DATE\"\nlog \"install_id: $INSTALL_ID\"\nlog \"========================================\"\n\n# ─── PREFLIGHT ────────────────────────────────────────────────────────────────\nstep \"Preflight checks\"\n\nif [ ! -f \"$DB_SRC\" ]; then\n log \"ERROR: Source DB not found at $DB_SRC\"; exit 1\nfi\nprintf \" %-25s %s (%s)\\n\" \"Source DB:\" \"OK\" \"$(du -sh \"$DB_SRC\" | cut -f1)\"\n\nif [ ! -d \"$NAS_MOUNT\" ]; then\n log \"ERROR: NAS not mounted at $NAS_MOUNT\"; exit 1\nfi\nprintf \" %-25s %s\\n\" \"NAS mount:\" \"OK $NAS_MOUNT\"\n\n# Check if DB already synced for this date+install_id\nDB_ALREADY_SYNCED=false\nif [ -f \"$NAS_DB\" ]; then\n if table_exists \"$NAS_DB\" \"frames\"; then\n HAS_INSTALL_COL=$(sqlite3 \"$NAS_DB\" \"SELECT COUNT(*) FROM pragma_table_info('frames') WHERE name='install_id';\")\n if [ \"$HAS_INSTALL_COL\" -gt \"0\" ]; then\n EXISTING=$(sqlite3 \"$NAS_DB\" \"SELECT COUNT(*) FROM frames WHERE date(timestamp)='$TARGET_DATE' AND install_id='$INSTALL_ID';\" 2>/dev/null || echo \"0\")\n else\n EXISTING=$(sqlite3 \"$NAS_DB\" \"SELECT COUNT(*) FROM frames WHERE date(timestamp)='$TARGET_DATE';\" 2>/dev/null || echo \"0\")\n fi\n if [ \"$EXISTING\" -gt \"0\" ]; then\n log \"Date $TARGET_DATE / install $INSTALL_ID already has $EXISTING frames — skipping DB sync\"\n DB_ALREADY_SYNCED=true\n else\n printf \" %-25s %s (%s)\\n\" \"Archive DB:\" \"exists\" \"$(du -sh \"$NAS_DB\" | cut -f1)\"\n fi\n else\n printf \" %-25s %s\\n\" \"Archive DB:\" \"exists, no frames table yet\"\n fi\nelse\n printf \" %-25s %s\\n\" \"Archive DB:\" \"will be created\"\nfi\n\n# Source data dir for this date (video frames)\nDATA_SRC=\"$HOME/.screenpipe/data/data/$TARGET_DATE\"\nif [ -d \"$DATA_SRC\" ]; then\n DATA_SIZE=$(du -sh \"$DATA_SRC\" | cut -f1)\n DATA_FILES=$(ls \"$DATA_SRC\" | wc -l | tr -d ' ')\n printf \" %-25s %s (%s files, %s)\\n\" \"Frame data dir:\" \"OK\" \"$DATA_FILES\" \"$DATA_SIZE\"\nelse\n printf \" %-25s %s\\n\" \"Frame data dir:\" \"not found — skipping\"\nfi\n\n# Audio files (flat in ~/.screenpipe/data/, dated by filename)\nshopt -s nullglob\nAUDIO_SRC_FILES=( \"$HOME/.screenpipe/data/\"*_\"${TARGET_DATE}\"_*.mp4 )\nshopt -u nullglob\nif [ ${#AUDIO_SRC_FILES[@]} -gt 0 ]; then\n AUDIO_TOTAL=$(du -ch \"${AUDIO_SRC_FILES[@]}\" | tail -1 | cut -f1)\n printf \" %-25s %s (%s files, %s)\\n\" \"Audio files:\" \"OK\" \"${#AUDIO_SRC_FILES[@]}\" \"$AUDIO_TOTAL\"\nelse\n printf \" %-25s %s\\n\" \"Audio files:\" \"none for this date\"\nfi\n\n# ─── SCHEMA MIGRATION: install_id ─────────────────────────────────────────────\n# Adds install_id column to existing NAS tables, backfills NULLs with a\n# legacy tag, and creates the (install_id, id) unique index. Idempotent.\nif [ -f \"$NAS_DB\" ]; then\n step \"Schema migration: install_id\"\n LEGACY_TAG=\"legacy-$(date +%Y%m%d)\"\n for tbl in \"${ALL_SYNC_TABLES[@]}\"; do\n if ! table_exists \"$NAS_DB\" \"$tbl\"; then\n continue\n fi\n HAS_COL=$(sqlite3 \"$NAS_DB\" \"SELECT COUNT(*) FROM pragma_table_info('$tbl') WHERE name='install_id';\")\n if [ \"$HAS_COL\" = \"0\" ]; then\n ROW_COUNT=$(sqlite3 \"$NAS_DB\" \"SELECT COUNT(*) FROM $tbl;\")\n printf \" %-36s adding install_id, backfill %s rows → %s\\n\" \"$tbl\" \"$ROW_COUNT\" \"$LEGACY_TAG\"\n sqlite3 \"$NAS_DB\" \"ALTER TABLE $tbl ADD COLUMN install_id TEXT;\"\n sqlite3 \"$NAS_DB\" \"UPDATE $tbl SET install_id = '$LEGACY_TAG' WHERE install_id IS NULL;\"\n fi\n sqlite3 \"$NAS_DB\" \"CREATE UNIQUE INDEX IF NOT EXISTS idx_${tbl}_install_pk ON ${tbl}(install_id, id);\"\n done\nfi\n\n# ─── DB SYNC ──────────────────────────────────────────────────────────────────\nif [ \"$DB_ALREADY_SYNCED\" = false ]; then\n\n # ─── COUNT SOURCE ROWS ────────────────────────────────────────────────────\n step \"Counting source rows for $TARGET_DATE\"\n\n SRC_FRAMES=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM frames WHERE date(timestamp) = '$TARGET_DATE';\")\n SRC_ELEMENTS=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM elements WHERE frame_id IN (SELECT id FROM frames WHERE date(timestamp) = '$TARGET_DATE');\")\n SRC_UI=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM ui_events WHERE date(timestamp) = '$TARGET_DATE';\")\n SRC_OCR=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM ocr_text WHERE frame_id IN (SELECT id FROM frames WHERE date(timestamp) = '$TARGET_DATE');\")\n SRC_MEETINGS=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM meetings WHERE date(meeting_start) = '$TARGET_DATE';\")\n\n SRC_ACHUNKS=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM audio_chunks WHERE date(timestamp) = '$TARGET_DATE';\")\n SRC_ATRANS=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM audio_transcriptions WHERE audio_chunk_id IN (SELECT id FROM audio_chunks WHERE date(timestamp) = '$TARGET_DATE');\")\n SRC_ATAGS=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM audio_tags WHERE audio_chunk_id IN (SELECT id FROM audio_chunks WHERE date(timestamp) = '$TARGET_DATE');\")\n # speakers + speaker_embeddings are install-global, not per-date; we sync all.\n SRC_SPEAKERS=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM speakers;\")\n SRC_SEMB=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM speaker_embeddings;\")\n\n printf \" %-25s %s\\n\" \"frames:\" \"$SRC_FRAMES\"\n printf \" %-25s %s\\n\" \"elements:\" \"$SRC_ELEMENTS\"\n printf \" %-25s %s\\n\" \"ui_events:\" \"$SRC_UI\"\n printf \" %-25s %s\\n\" \"ocr_text:\" \"$SRC_OCR\"\n printf \" %-25s %s\\n\" \"meetings:\" \"$SRC_MEETINGS\"\n printf \" %-25s %s\\n\" \"audio_chunks:\" \"$SRC_ACHUNKS\"\n printf \" %-25s %s\\n\" \"audio_transcriptions:\" \"$SRC_ATRANS\"\n printf \" %-25s %s\\n\" \"audio_tags:\" \"$SRC_ATAGS\"\n printf \" %-25s %s (all-time)\\n\" \"speakers:\" \"$SRC_SPEAKERS\"\n printf \" %-25s %s (all-time)\\n\" \"speaker_embeddings:\" \"$SRC_SEMB\"\n\n if [ \"$SRC_FRAMES\" -eq \"0\" ] && [ \"$SRC_ACHUNKS\" -eq \"0\" ]; then\n log \"No frames or audio chunks for $TARGET_DATE — skipping DB sync\"\n DB_ALREADY_SYNCED=true\n fi\n\nfi\n\nif [ \"$DB_ALREADY_SYNCED\" = false ]; then\n\n # ─── INIT TABLES ──────────────────────────────────────────────────────────\n step \"Initialising tables (CREATE IF NOT EXISTS)\"\n\n run_sqlite_heredoc \"creating vision tables\" \"\nATTACH '$NAS_DB' AS nas;\nCREATE TABLE IF NOT EXISTS nas.frames AS SELECT * FROM main.frames WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.elements AS SELECT * FROM main.elements WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.ui_events AS SELECT * FROM main.ui_events WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.ocr_text AS SELECT * FROM main.ocr_text WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.video_chunks AS SELECT * FROM main.video_chunks WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.meetings AS SELECT * FROM main.meetings WHERE 0;\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"creating audio tables\" \"\nATTACH '$NAS_DB' AS nas;\nCREATE TABLE IF NOT EXISTS nas.audio_chunks AS SELECT * FROM main.audio_chunks WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.audio_transcriptions AS SELECT * FROM main.audio_transcriptions WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.speakers AS SELECT * FROM main.speakers WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.speaker_embeddings AS SELECT * FROM main.speaker_embeddings WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.audio_tags AS SELECT * FROM main.audio_tags WHERE 0;\nDETACH nas;\n\"\n\n # Re-run install_id + index setup so freshly-created tables get them too.\n for tbl in \"${ALL_SYNC_TABLES[@]}\"; do\n HAS_COL=$(sqlite3 \"$NAS_DB\" \"SELECT COUNT(*) FROM pragma_table_info('$tbl') WHERE name='install_id';\")\n if [ \"$HAS_COL\" = \"0\" ]; then\n sqlite3 \"$NAS_DB\" \"ALTER TABLE $tbl ADD COLUMN install_id TEXT;\"\n fi\n sqlite3 \"$NAS_DB\" \"CREATE UNIQUE INDEX IF NOT EXISTS idx_${tbl}_install_pk ON ${tbl}(install_id, id);\"\n done\n\n # ─── SCHEMA DRIFT ─────────────────────────────────────────────────────────\n step \"Reconciling NAS schema with source\"\n for tbl in \"${ALL_SYNC_TABLES[@]}\"; do\n ensure_columns \"$tbl\"\n done\n\n run_sqlite_heredoc \"creating indexes\" \"\nATTACH '$NAS_DB' AS nas;\n-- vision\nCREATE INDEX IF NOT EXISTS nas.idx_frames_timestamp ON frames(timestamp);\nCREATE INDEX IF NOT EXISTS nas.idx_frames_app_name ON frames(app_name);\nCREATE INDEX IF NOT EXISTS nas.idx_frames_window_name ON frames(window_name);\nCREATE INDEX IF NOT EXISTS nas.idx_frames_video_chunk_id ON frames(video_chunk_id);\nCREATE INDEX IF NOT EXISTS nas.idx_frames_document_path ON frames(document_path) WHERE document_path IS NOT NULL;\nCREATE INDEX IF NOT EXISTS nas.idx_elements_frame_id ON elements(frame_id);\nCREATE INDEX IF NOT EXISTS nas.idx_elements_frame_src_role ON elements(frame_id, source, role) WHERE text IS NOT NULL;\nCREATE INDEX IF NOT EXISTS nas.idx_elements_onscreen_frame ON elements(frame_id) WHERE on_screen = 1 AND text IS NOT NULL;\nCREATE INDEX IF NOT EXISTS nas.idx_ui_events_timestamp ON ui_events(timestamp);\nCREATE INDEX IF NOT EXISTS nas.idx_ui_events_app_name ON ui_events(app_name);\nCREATE INDEX IF NOT EXISTS nas.idx_ui_events_frame_id ON ui_events(frame_id);\nCREATE INDEX IF NOT EXISTS nas.idx_ocr_text_frame_id ON ocr_text(frame_id);\nCREATE INDEX IF NOT EXISTS nas.idx_meetings_start ON meetings(meeting_start);\nCREATE INDEX IF NOT EXISTS nas.idx_video_chunks_device ON video_chunks(device_name);\n-- audio\nCREATE INDEX IF NOT EXISTS nas.idx_audio_chunks_timestamp ON audio_chunks(timestamp);\nCREATE INDEX IF NOT EXISTS nas.idx_audio_trans_chunk_id ON audio_transcriptions(audio_chunk_id);\nCREATE INDEX IF NOT EXISTS nas.idx_audio_trans_timestamp ON audio_transcriptions(timestamp);\nCREATE INDEX IF NOT EXISTS nas.idx_audio_trans_speaker ON audio_transcriptions(speaker_id, timestamp DESC);\nCREATE INDEX IF NOT EXISTS nas.idx_speaker_emb_speaker_id ON speaker_embeddings(speaker_id);\nCREATE INDEX IF NOT EXISTS nas.idx_audio_tags_chunk_id ON audio_tags(audio_chunk_id);\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"creating FTS tables\" \"\nATTACH '$NAS_DB' AS nas;\nCREATE VIRTUAL TABLE IF NOT EXISTS nas.elements_fts USING fts5(\n text, role, frame_id UNINDEXED,\n content='elements', content_rowid='id', tokenize='unicode61'\n);\nCREATE VIRTUAL TABLE IF NOT EXISTS nas.frames_fts USING fts5(\n full_text, app_name, window_name, browser_url, id UNINDEXED,\n tokenize='unicode61'\n);\nCREATE VIRTUAL TABLE IF NOT EXISTS nas.ui_events_fts USING fts5(\n text_content, app_name, window_title, element_name,\n content='ui_events', content_rowid='id', tokenize='unicode61'\n);\nCREATE VIRTUAL TABLE IF NOT EXISTS nas.audio_transcriptions_fts USING fts5(\n transcription, device, speaker_id UNINDEXED, id UNINDEXED,\n tokenize='unicode61'\n);\nDETACH nas;\n\"\n\n # ─── BUILD EXPLICIT COLUMN LISTS ──────────────────────────────────────────\n # Source columns + install_id appended. Same on both sides of the INSERT.\n FRAMES_COLS=$(build_col_list frames)\n ELEMENTS_COLS=$(build_col_list elements)\n ELEMENTS_COLS_E=$(build_col_list elements e)\n UI_EVENTS_COLS=$(build_col_list ui_events)\n OCR_TEXT_COLS=$(build_col_list ocr_text)\n OCR_TEXT_COLS_O=$(build_col_list ocr_text o)\n VIDEO_CHUNKS_COLS=$(build_col_list video_chunks)\n MEETINGS_COLS=$(build_col_list meetings)\n ACHUNKS_COLS=$(build_col_list audio_chunks)\n ATRANS_COLS=$(build_col_list audio_transcriptions)\n ATRANS_COLS_T=$(build_col_list audio_transcriptions t)\n SPEAKERS_COLS=$(build_col_list speakers)\n SEMB_COLS=$(build_col_list speaker_embeddings)\n ATAGS_COLS=$(build_col_list audio_tags)\n ATAGS_COLS_AT=$(build_col_list audio_tags at)\n\n # ─── SYNC VISION DATA ─────────────────────────────────────────────────────\n step \"Syncing vision data for $TARGET_DATE\"\n\n run_sqlite_heredoc \"video_chunks\" \"\nATTACH '$NAS_DB' AS nas;\nINSERT OR IGNORE INTO nas.video_chunks ($VIDEO_CHUNKS_COLS, install_id)\n SELECT $VIDEO_CHUNKS_COLS, '$INSTALL_ID' FROM main.video_chunks\n WHERE id IN (\n SELECT DISTINCT video_chunk_id FROM main.frames\n WHERE date(timestamp) = '$TARGET_DATE' AND video_chunk_id IS NOT NULL\n );\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"frames ($SRC_FRAMES rows)\" \"\nATTACH '$NAS_DB' AS nas;\nINSERT OR IGNORE INTO nas.frames ($FRAMES_COLS, install_id)\n SELECT $FRAMES_COLS, '$INSTALL_ID' FROM main.frames WHERE date(timestamp) = '$TARGET_DATE';\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"ocr_text ($SRC_OCR rows)\" \"\nATTACH '$NAS_DB' AS nas;\nINSERT OR IGNORE INTO nas.ocr_text ($OCR_TEXT_COLS, install_id)\n SELECT $OCR_TEXT_COLS_O, '$INSTALL_ID' FROM main.ocr_text o\n JOIN main.frames f ON o.frame_id = f.id\n WHERE date(f.timestamp) = '$TARGET_DATE';\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"ui_events ($SRC_UI rows)\" \"\nATTACH '$NAS_DB' AS nas;\nINSERT OR IGNORE INTO nas.ui_events ($UI_EVENTS_COLS, install_id)\n SELECT $UI_EVENTS_COLS, '$INSTALL_ID' FROM main.ui_events WHERE date(timestamp) = '$TARGET_DATE';\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"elements ($SRC_ELEMENTS rows)\" \"\nATTACH '$NAS_DB' AS nas;\nINSERT OR IGNORE INTO nas.elements ($ELEMENTS_COLS, install_id)\n SELECT $ELEMENTS_COLS_E, '$INSTALL_ID' FROM main.elements e\n JOIN main.frames f ON e.frame_id = f.id\n WHERE date(f.timestamp) = '$TARGET_DATE';\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"meetings ($SRC_MEETINGS rows)\" \"\nATTACH '$NAS_DB' AS nas;\nINSERT OR IGNORE INTO nas.meetings ($MEETINGS_COLS, install_id)\n SELECT $MEETINGS_COLS, '$INSTALL_ID' FROM main.meetings WHERE date(meeting_start) = '$TARGET_DATE';\nDETACH nas;\n\"\n\n # ─── SYNC AUDIO DATA ──────────────────────────────────────────────────────\n step \"Syncing audio data for $TARGET_DATE\"\n\n # Speakers + embeddings are install-global, not per-date. Sync everything","depth":28,"bounds":{"left":0.11569149,"top":0.0933759,"width":0.38031915,"height":0.0007980846},"on_screen":true,"value":"#!/bin/bash\n# screenpipe_sync.sh\n# Syncs Screenpipe SQLite data (vision + audio) to a NAS archive database.\n# Append-only, no deletions.\n#\n# Key design points\n# -----------------\n# 1. Multi-install safe via install_id.\n# Source IDs reset to 1 on every screenpipe reinstall. To avoid collisions\n# in the NAS archive, every synced table gets an extra `install_id` column,\n# and the logical primary key becomes (install_id, id) enforced by a\n# unique index. The install_id is a UUID stored in\n# ~/.screenpipe/.sync_install_id — wiping ~/.screenpipe/ (which is what\n# happens on reinstall) discards it, so the next run generates a new one.\n#\n# 2. Schema-drift tolerant. If screenpipe migrations add new columns to the\n# source DB, the NAS gets ALTER TABLE'd to match. Inserts use explicit\n# column lists so positional mismatches can't occur.\n#\n# 3. FTS caveat. FTS tables in the NAS use source `id` as rowid. After a\n# reinstall, INSERT OR IGNORE will silently skip rows whose id collides\n# with a previous install's id, so FTS only reliably indexes the most\n# recent install. Falls back to LIKE queries on the base tables for\n# multi-install searches (which can filter by install_id).\n#\n# Usage\n# -----\n# ./screenpipe_sync.sh # syncs yesterday\n# ./screenpipe_sync.sh 2026-04-15 # syncs a specific date\n# ./screenpipe_sync.sh today # syncs today so far\n# ./screenpipe_sync.sh --reset-install-id # rotate install_id and exit\n# ./screenpipe_sync.sh --show-install-id # print install_id and exit\n\nset -euo pipefail\n\n# ─── CONFIG ───────────────────────────────────────────────────────────────────\nDB_SRC=\"${SCREENPIPE_DB:-$HOME/.screenpipe/db.sqlite}\"\nNAS_MOUNT=\"${NAS_MOUNT:-/Volumes/screenpipe}\"\nNAS_DB=\"$NAS_MOUNT/archive.db\"\nNAS_DATA=\"$NAS_MOUNT/data\"\nLOG_FILE=\"$HOME/.screenpipe/sync.log\"\nINSTALL_ID_FILE=\"$HOME/.screenpipe/.sync_install_id\"\n\n# Sync table groups. Order matters for FK-ish references\n# (parents before children).\nVISION_TABLES=(video_chunks frames elements ocr_text ui_events meetings)\nAUDIO_TABLES=(speakers speaker_embeddings audio_chunks audio_transcriptions audio_tags)\nALL_SYNC_TABLES=(\"${VISION_TABLES[@]}\" \"${AUDIO_TABLES[@]}\")\n# ──────────────────────────────────────────────────────────────────────────────\n\nSCRIPT_START=$(date +%s)\n\n# ─── HELPERS ──────────────────────────────────────────────────────────────────\nlog() {\n local msg=\"[$(date '+%Y-%m-%d %H:%M:%S')] $*\"\n echo \"$msg\" | tee -a \"$LOG_FILE\"\n}\n\nstep() {\n local now=$(date +%s)\n local elapsed=$(( now - SCRIPT_START ))\n local min=$(( elapsed / 60 ))\n local sec=$(( elapsed % 60 ))\n printf \"\\n[+%02dm%02ds] ▶ %s\\n\" \"$min\" \"$sec\" \"$*\" | tee -a \"$LOG_FILE\"\n}\n\nrun_sqlite_heredoc() {\n local label=\"$1\"\n local sql=\"$2\"\n local start=$(date +%s)\n\n printf \" %-36s \" \"$label\"\n\n sqlite3 \"$DB_SRC\" <<< \"$sql\" &\n local pid=$!\n local spin=('⠋' '⠙' '⠹' '⠸' '⠼' '⠴' '⠦' '⠧' '⠇' '⠏')\n local i=0\n while kill -0 \"$pid\" 2>/dev/null; do\n printf \"\\r %-36s %s \" \"$label\" \"${spin[$i]}\"\n i=$(( (i + 1) % 10 ))\n sleep 0.2\n done\n wait \"$pid\"\n local rc=$?\n if [ $rc -ne 0 ]; then\n printf \"\\r %-36s ✗ FAILED\\n\" \"$label\" | tee -a \"$LOG_FILE\"\n exit $rc\n fi\n\n local dur=$(( $(date +%s) - start ))\n printf \"\\r %-36s ✓ %dm%02ds\\n\" \"$label\" \"$(( dur / 60 ))\" \"$(( dur % 60 ))\" | tee -a \"$LOG_FILE\"\n}\n\ncheck() {\n local label=\"$1\" got=\"$2\" expected=\"$3\"\n if [ \"$got\" -eq \"$expected\" ]; then\n printf \" %-25s %s / %s ✓\\n\" \"$label:\" \"$got\" \"$expected\"\n else\n printf \" %-25s %s / %s ✗ MISMATCH\\n\" \"$label:\" \"$got\" \"$expected\"\n fi\n}\n\ntable_columns_with_types() {\n local db=\"$1\" table=\"$2\"\n sqlite3 \"$db\" \"PRAGMA table_info($table);\" | awk -F'|' '{print $2 \"|\" $3}'\n}\n\ntable_columns() {\n local db=\"$1\" table=\"$2\"\n sqlite3 \"$db\" \"PRAGMA table_info($table);\" | awk -F'|' '{print $2}'\n}\n\ntable_exists() {\n local db=\"$1\" table=\"$2\"\n local count\n count=$(sqlite3 \"$db\" \"SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='$table';\")\n [ \"$count\" -gt 0 ]\n}\n\n# Adds any columns present in source but missing in NAS for the given table.\n# Skips install_id (which is NAS-only and managed separately).\nensure_columns() {\n local table=\"$1\"\n local label=\"schema: $table\"\n printf \" %-36s \" \"$label\"\n\n if ! table_exists \"$DB_SRC\" \"$table\"; then\n printf \"✗ source missing — skipping\\n\"\n return 0\n fi\n\n if ! table_exists \"$NAS_DB\" \"$table\"; then\n printf \"✓ fresh (created above)\\n\"\n return 0\n fi\n\n local src_cols\n src_cols=$(table_columns_with_types \"$DB_SRC\" \"$table\")\n local nas_cols\n nas_cols=$(table_columns \"$NAS_DB\" \"$table\")\n\n local added=0\n local added_names=\"\"\n while IFS='|' read -r name type; do\n [ -z \"$name\" ] && continue\n if ! echo \"$nas_cols\" | grep -Fxq \"$name\"; then\n sqlite3 \"$NAS_DB\" \"ALTER TABLE $table ADD COLUMN \\\"$name\\\" $type;\"\n added=$((added + 1))\n added_names=\"$added_names $name\"\n fi\n done <<< \"$src_cols\"\n\n if [ \"$added\" -gt 0 ]; then\n printf \"✓ added %d:%s\\n\" \"$added\" \"$added_names\"\n else\n printf \"✓ in sync\\n\"\n fi\n}\n\n# Comma-separated, double-quoted column list for a table from source DB.\n# Optional alias is prefixed (e.g. `o.\"col\"`) for JOIN selects where column\n# names would otherwise collide.\nbuild_col_list() {\n local table=\"$1\"\n local alias=\"${2:-}\"\n local prefix=\"\"\n [ -n \"$alias\" ] && prefix=\"${alias}.\"\n table_columns \"$DB_SRC\" \"$table\" | awk 'NF' | awk -v p=\"$prefix\" '{print p \"\\\"\" $0 \"\\\"\"}' | paste -sd, -\n}\n# ──────────────────────────────────────────────────────────────────────────────\n\n# ─── ARG HANDLING ─────────────────────────────────────────────────────────────\nif [ \"${1:-}\" = \"--reset-install-id\" ]; then\n if [ -f \"$INSTALL_ID_FILE\" ]; then\n OLD=$(cat \"$INSTALL_ID_FILE\")\n rm -f \"$INSTALL_ID_FILE\"\n echo \"Removed install_id: $OLD\"\n else\n echo \"No install_id file at $INSTALL_ID_FILE\"\n fi\n echo \"A new install_id will be generated on the next sync run.\"\n exit 0\nfi\n\nif [ \"${1:-}\" = \"--show-install-id\" ]; then\n if [ -f \"$INSTALL_ID_FILE\" ]; then\n cat \"$INSTALL_ID_FILE\"\n else\n echo \"(none — will be generated on next run)\"\n fi\n exit 0\nfi\n\nif [ \"${1:-}\" = \"today\" ]; then\n TARGET_DATE=$(date +%Y-%m-%d)\nelif [ -n \"${1:-}\" ]; then\n TARGET_DATE=\"$1\"\n if ! [[ \"$TARGET_DATE\" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then\n echo \"ERROR: Invalid date. Use YYYY-MM-DD, 'today', or no argument for yesterday.\"\n exit 1\n fi\nelse\n TARGET_DATE=$(date -v-1d +%Y-%m-%d)\nfi\n\n# ─── INSTALL ID ───────────────────────────────────────────────────────────────\nINSTALL_ID=\"\"\nif [ -f \"$INSTALL_ID_FILE\" ]; then\n INSTALL_ID=$(tr -d '[:space:]' < \"$INSTALL_ID_FILE\")\nfi\nif [ -z \"$INSTALL_ID\" ]; then\n INSTALL_ID=$(uuidgen | tr 'A-Z' 'a-z')\n echo \"$INSTALL_ID\" > \"$INSTALL_ID_FILE\"\n log \"Generated new install_id: $INSTALL_ID\"\nfi\n\nlog \"========================================\"\nlog \"Screenpipe sync starting for: $TARGET_DATE\"\nlog \"install_id: $INSTALL_ID\"\nlog \"========================================\"\n\n# ─── PREFLIGHT ────────────────────────────────────────────────────────────────\nstep \"Preflight checks\"\n\nif [ ! -f \"$DB_SRC\" ]; then\n log \"ERROR: Source DB not found at $DB_SRC\"; exit 1\nfi\nprintf \" %-25s %s (%s)\\n\" \"Source DB:\" \"OK\" \"$(du -sh \"$DB_SRC\" | cut -f1)\"\n\nif [ ! -d \"$NAS_MOUNT\" ]; then\n log \"ERROR: NAS not mounted at $NAS_MOUNT\"; exit 1\nfi\nprintf \" %-25s %s\\n\" \"NAS mount:\" \"OK $NAS_MOUNT\"\n\n# Check if DB already synced for this date+install_id\nDB_ALREADY_SYNCED=false\nif [ -f \"$NAS_DB\" ]; then\n if table_exists \"$NAS_DB\" \"frames\"; then\n HAS_INSTALL_COL=$(sqlite3 \"$NAS_DB\" \"SELECT COUNT(*) FROM pragma_table_info('frames') WHERE name='install_id';\")\n if [ \"$HAS_INSTALL_COL\" -gt \"0\" ]; then\n EXISTING=$(sqlite3 \"$NAS_DB\" \"SELECT COUNT(*) FROM frames WHERE date(timestamp)='$TARGET_DATE' AND install_id='$INSTALL_ID';\" 2>/dev/null || echo \"0\")\n else\n EXISTING=$(sqlite3 \"$NAS_DB\" \"SELECT COUNT(*) FROM frames WHERE date(timestamp)='$TARGET_DATE';\" 2>/dev/null || echo \"0\")\n fi\n if [ \"$EXISTING\" -gt \"0\" ]; then\n log \"Date $TARGET_DATE / install $INSTALL_ID already has $EXISTING frames — skipping DB sync\"\n DB_ALREADY_SYNCED=true\n else\n printf \" %-25s %s (%s)\\n\" \"Archive DB:\" \"exists\" \"$(du -sh \"$NAS_DB\" | cut -f1)\"\n fi\n else\n printf \" %-25s %s\\n\" \"Archive DB:\" \"exists, no frames table yet\"\n fi\nelse\n printf \" %-25s %s\\n\" \"Archive DB:\" \"will be created\"\nfi\n\n# Source data dir for this date (video frames)\nDATA_SRC=\"$HOME/.screenpipe/data/data/$TARGET_DATE\"\nif [ -d \"$DATA_SRC\" ]; then\n DATA_SIZE=$(du -sh \"$DATA_SRC\" | cut -f1)\n DATA_FILES=$(ls \"$DATA_SRC\" | wc -l | tr -d ' ')\n printf \" %-25s %s (%s files, %s)\\n\" \"Frame data dir:\" \"OK\" \"$DATA_FILES\" \"$DATA_SIZE\"\nelse\n printf \" %-25s %s\\n\" \"Frame data dir:\" \"not found — skipping\"\nfi\n\n# Audio files (flat in ~/.screenpipe/data/, dated by filename)\nshopt -s nullglob\nAUDIO_SRC_FILES=( \"$HOME/.screenpipe/data/\"*_\"${TARGET_DATE}\"_*.mp4 )\nshopt -u nullglob\nif [ ${#AUDIO_SRC_FILES[@]} -gt 0 ]; then\n AUDIO_TOTAL=$(du -ch \"${AUDIO_SRC_FILES[@]}\" | tail -1 | cut -f1)\n printf \" %-25s %s (%s files, %s)\\n\" \"Audio files:\" \"OK\" \"${#AUDIO_SRC_FILES[@]}\" \"$AUDIO_TOTAL\"\nelse\n printf \" %-25s %s\\n\" \"Audio files:\" \"none for this date\"\nfi\n\n# ─── SCHEMA MIGRATION: install_id ─────────────────────────────────────────────\n# Adds install_id column to existing NAS tables, backfills NULLs with a\n# legacy tag, and creates the (install_id, id) unique index. Idempotent.\nif [ -f \"$NAS_DB\" ]; then\n step \"Schema migration: install_id\"\n LEGACY_TAG=\"legacy-$(date +%Y%m%d)\"\n for tbl in \"${ALL_SYNC_TABLES[@]}\"; do\n if ! table_exists \"$NAS_DB\" \"$tbl\"; then\n continue\n fi\n HAS_COL=$(sqlite3 \"$NAS_DB\" \"SELECT COUNT(*) FROM pragma_table_info('$tbl') WHERE name='install_id';\")\n if [ \"$HAS_COL\" = \"0\" ]; then\n ROW_COUNT=$(sqlite3 \"$NAS_DB\" \"SELECT COUNT(*) FROM $tbl;\")\n printf \" %-36s adding install_id, backfill %s rows → %s\\n\" \"$tbl\" \"$ROW_COUNT\" \"$LEGACY_TAG\"\n sqlite3 \"$NAS_DB\" \"ALTER TABLE $tbl ADD COLUMN install_id TEXT;\"\n sqlite3 \"$NAS_DB\" \"UPDATE $tbl SET install_id = '$LEGACY_TAG' WHERE install_id IS NULL;\"\n fi\n sqlite3 \"$NAS_DB\" \"CREATE UNIQUE INDEX IF NOT EXISTS idx_${tbl}_install_pk ON ${tbl}(install_id, id);\"\n done\nfi\n\n# ─── DB SYNC ──────────────────────────────────────────────────────────────────\nif [ \"$DB_ALREADY_SYNCED\" = false ]; then\n\n # ─── COUNT SOURCE ROWS ────────────────────────────────────────────────────\n step \"Counting source rows for $TARGET_DATE\"\n\n SRC_FRAMES=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM frames WHERE date(timestamp) = '$TARGET_DATE';\")\n SRC_ELEMENTS=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM elements WHERE frame_id IN (SELECT id FROM frames WHERE date(timestamp) = '$TARGET_DATE');\")\n SRC_UI=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM ui_events WHERE date(timestamp) = '$TARGET_DATE';\")\n SRC_OCR=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM ocr_text WHERE frame_id IN (SELECT id FROM frames WHERE date(timestamp) = '$TARGET_DATE');\")\n SRC_MEETINGS=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM meetings WHERE date(meeting_start) = '$TARGET_DATE';\")\n\n SRC_ACHUNKS=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM audio_chunks WHERE date(timestamp) = '$TARGET_DATE';\")\n SRC_ATRANS=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM audio_transcriptions WHERE audio_chunk_id IN (SELECT id FROM audio_chunks WHERE date(timestamp) = '$TARGET_DATE');\")\n SRC_ATAGS=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM audio_tags WHERE audio_chunk_id IN (SELECT id FROM audio_chunks WHERE date(timestamp) = '$TARGET_DATE');\")\n # speakers + speaker_embeddings are install-global, not per-date; we sync all.\n SRC_SPEAKERS=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM speakers;\")\n SRC_SEMB=$(sqlite3 \"$DB_SRC\" \"SELECT COUNT(*) FROM speaker_embeddings;\")\n\n printf \" %-25s %s\\n\" \"frames:\" \"$SRC_FRAMES\"\n printf \" %-25s %s\\n\" \"elements:\" \"$SRC_ELEMENTS\"\n printf \" %-25s %s\\n\" \"ui_events:\" \"$SRC_UI\"\n printf \" %-25s %s\\n\" \"ocr_text:\" \"$SRC_OCR\"\n printf \" %-25s %s\\n\" \"meetings:\" \"$SRC_MEETINGS\"\n printf \" %-25s %s\\n\" \"audio_chunks:\" \"$SRC_ACHUNKS\"\n printf \" %-25s %s\\n\" \"audio_transcriptions:\" \"$SRC_ATRANS\"\n printf \" %-25s %s\\n\" \"audio_tags:\" \"$SRC_ATAGS\"\n printf \" %-25s %s (all-time)\\n\" \"speakers:\" \"$SRC_SPEAKERS\"\n printf \" %-25s %s (all-time)\\n\" \"speaker_embeddings:\" \"$SRC_SEMB\"\n\n if [ \"$SRC_FRAMES\" -eq \"0\" ] && [ \"$SRC_ACHUNKS\" -eq \"0\" ]; then\n log \"No frames or audio chunks for $TARGET_DATE — skipping DB sync\"\n DB_ALREADY_SYNCED=true\n fi\n\nfi\n\nif [ \"$DB_ALREADY_SYNCED\" = false ]; then\n\n # ─── INIT TABLES ──────────────────────────────────────────────────────────\n step \"Initialising tables (CREATE IF NOT EXISTS)\"\n\n run_sqlite_heredoc \"creating vision tables\" \"\nATTACH '$NAS_DB' AS nas;\nCREATE TABLE IF NOT EXISTS nas.frames AS SELECT * FROM main.frames WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.elements AS SELECT * FROM main.elements WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.ui_events AS SELECT * FROM main.ui_events WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.ocr_text AS SELECT * FROM main.ocr_text WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.video_chunks AS SELECT * FROM main.video_chunks WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.meetings AS SELECT * FROM main.meetings WHERE 0;\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"creating audio tables\" \"\nATTACH '$NAS_DB' AS nas;\nCREATE TABLE IF NOT EXISTS nas.audio_chunks AS SELECT * FROM main.audio_chunks WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.audio_transcriptions AS SELECT * FROM main.audio_transcriptions WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.speakers AS SELECT * FROM main.speakers WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.speaker_embeddings AS SELECT * FROM main.speaker_embeddings WHERE 0;\nCREATE TABLE IF NOT EXISTS nas.audio_tags AS SELECT * FROM main.audio_tags WHERE 0;\nDETACH nas;\n\"\n\n # Re-run install_id + index setup so freshly-created tables get them too.\n for tbl in \"${ALL_SYNC_TABLES[@]}\"; do\n HAS_COL=$(sqlite3 \"$NAS_DB\" \"SELECT COUNT(*) FROM pragma_table_info('$tbl') WHERE name='install_id';\")\n if [ \"$HAS_COL\" = \"0\" ]; then\n sqlite3 \"$NAS_DB\" \"ALTER TABLE $tbl ADD COLUMN install_id TEXT;\"\n fi\n sqlite3 \"$NAS_DB\" \"CREATE UNIQUE INDEX IF NOT EXISTS idx_${tbl}_install_pk ON ${tbl}(install_id, id);\"\n done\n\n # ─── SCHEMA DRIFT ─────────────────────────────────────────────────────────\n step \"Reconciling NAS schema with source\"\n for tbl in \"${ALL_SYNC_TABLES[@]}\"; do\n ensure_columns \"$tbl\"\n done\n\n run_sqlite_heredoc \"creating indexes\" \"\nATTACH '$NAS_DB' AS nas;\n-- vision\nCREATE INDEX IF NOT EXISTS nas.idx_frames_timestamp ON frames(timestamp);\nCREATE INDEX IF NOT EXISTS nas.idx_frames_app_name ON frames(app_name);\nCREATE INDEX IF NOT EXISTS nas.idx_frames_window_name ON frames(window_name);\nCREATE INDEX IF NOT EXISTS nas.idx_frames_video_chunk_id ON frames(video_chunk_id);\nCREATE INDEX IF NOT EXISTS nas.idx_frames_document_path ON frames(document_path) WHERE document_path IS NOT NULL;\nCREATE INDEX IF NOT EXISTS nas.idx_elements_frame_id ON elements(frame_id);\nCREATE INDEX IF NOT EXISTS nas.idx_elements_frame_src_role ON elements(frame_id, source, role) WHERE text IS NOT NULL;\nCREATE INDEX IF NOT EXISTS nas.idx_elements_onscreen_frame ON elements(frame_id) WHERE on_screen = 1 AND text IS NOT NULL;\nCREATE INDEX IF NOT EXISTS nas.idx_ui_events_timestamp ON ui_events(timestamp);\nCREATE INDEX IF NOT EXISTS nas.idx_ui_events_app_name ON ui_events(app_name);\nCREATE INDEX IF NOT EXISTS nas.idx_ui_events_frame_id ON ui_events(frame_id);\nCREATE INDEX IF NOT EXISTS nas.idx_ocr_text_frame_id ON ocr_text(frame_id);\nCREATE INDEX IF NOT EXISTS nas.idx_meetings_start ON meetings(meeting_start);\nCREATE INDEX IF NOT EXISTS nas.idx_video_chunks_device ON video_chunks(device_name);\n-- audio\nCREATE INDEX IF NOT EXISTS nas.idx_audio_chunks_timestamp ON audio_chunks(timestamp);\nCREATE INDEX IF NOT EXISTS nas.idx_audio_trans_chunk_id ON audio_transcriptions(audio_chunk_id);\nCREATE INDEX IF NOT EXISTS nas.idx_audio_trans_timestamp ON audio_transcriptions(timestamp);\nCREATE INDEX IF NOT EXISTS nas.idx_audio_trans_speaker ON audio_transcriptions(speaker_id, timestamp DESC);\nCREATE INDEX IF NOT EXISTS nas.idx_speaker_emb_speaker_id ON speaker_embeddings(speaker_id);\nCREATE INDEX IF NOT EXISTS nas.idx_audio_tags_chunk_id ON audio_tags(audio_chunk_id);\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"creating FTS tables\" \"\nATTACH '$NAS_DB' AS nas;\nCREATE VIRTUAL TABLE IF NOT EXISTS nas.elements_fts USING fts5(\n text, role, frame_id UNINDEXED,\n content='elements', content_rowid='id', tokenize='unicode61'\n);\nCREATE VIRTUAL TABLE IF NOT EXISTS nas.frames_fts USING fts5(\n full_text, app_name, window_name, browser_url, id UNINDEXED,\n tokenize='unicode61'\n);\nCREATE VIRTUAL TABLE IF NOT EXISTS nas.ui_events_fts USING fts5(\n text_content, app_name, window_title, element_name,\n content='ui_events', content_rowid='id', tokenize='unicode61'\n);\nCREATE VIRTUAL TABLE IF NOT EXISTS nas.audio_transcriptions_fts USING fts5(\n transcription, device, speaker_id UNINDEXED, id UNINDEXED,\n tokenize='unicode61'\n);\nDETACH nas;\n\"\n\n # ─── BUILD EXPLICIT COLUMN LISTS ──────────────────────────────────────────\n # Source columns + install_id appended. Same on both sides of the INSERT.\n FRAMES_COLS=$(build_col_list frames)\n ELEMENTS_COLS=$(build_col_list elements)\n ELEMENTS_COLS_E=$(build_col_list elements e)\n UI_EVENTS_COLS=$(build_col_list ui_events)\n OCR_TEXT_COLS=$(build_col_list ocr_text)\n OCR_TEXT_COLS_O=$(build_col_list ocr_text o)\n VIDEO_CHUNKS_COLS=$(build_col_list video_chunks)\n MEETINGS_COLS=$(build_col_list meetings)\n ACHUNKS_COLS=$(build_col_list audio_chunks)\n ATRANS_COLS=$(build_col_list audio_transcriptions)\n ATRANS_COLS_T=$(build_col_list audio_transcriptions t)\n SPEAKERS_COLS=$(build_col_list speakers)\n SEMB_COLS=$(build_col_list speaker_embeddings)\n ATAGS_COLS=$(build_col_list audio_tags)\n ATAGS_COLS_AT=$(build_col_list audio_tags at)\n\n # ─── SYNC VISION DATA ─────────────────────────────────────────────────────\n step \"Syncing vision data for $TARGET_DATE\"\n\n run_sqlite_heredoc \"video_chunks\" \"\nATTACH '$NAS_DB' AS nas;\nINSERT OR IGNORE INTO nas.video_chunks ($VIDEO_CHUNKS_COLS, install_id)\n SELECT $VIDEO_CHUNKS_COLS, '$INSTALL_ID' FROM main.video_chunks\n WHERE id IN (\n SELECT DISTINCT video_chunk_id FROM main.frames\n WHERE date(timestamp) = '$TARGET_DATE' AND video_chunk_id IS NOT NULL\n );\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"frames ($SRC_FRAMES rows)\" \"\nATTACH '$NAS_DB' AS nas;\nINSERT OR IGNORE INTO nas.frames ($FRAMES_COLS, install_id)\n SELECT $FRAMES_COLS, '$INSTALL_ID' FROM main.frames WHERE date(timestamp) = '$TARGET_DATE';\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"ocr_text ($SRC_OCR rows)\" \"\nATTACH '$NAS_DB' AS nas;\nINSERT OR IGNORE INTO nas.ocr_text ($OCR_TEXT_COLS, install_id)\n SELECT $OCR_TEXT_COLS_O, '$INSTALL_ID' FROM main.ocr_text o\n JOIN main.frames f ON o.frame_id = f.id\n WHERE date(f.timestamp) = '$TARGET_DATE';\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"ui_events ($SRC_UI rows)\" \"\nATTACH '$NAS_DB' AS nas;\nINSERT OR IGNORE INTO nas.ui_events ($UI_EVENTS_COLS, install_id)\n SELECT $UI_EVENTS_COLS, '$INSTALL_ID' FROM main.ui_events WHERE date(timestamp) = '$TARGET_DATE';\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"elements ($SRC_ELEMENTS rows)\" \"\nATTACH '$NAS_DB' AS nas;\nINSERT OR IGNORE INTO nas.elements ($ELEMENTS_COLS, install_id)\n SELECT $ELEMENTS_COLS_E, '$INSTALL_ID' FROM main.elements e\n JOIN main.frames f ON e.frame_id = f.id\n WHERE date(f.timestamp) = '$TARGET_DATE';\nDETACH nas;\n\"\n\n run_sqlite_heredoc \"meetings ($SRC_MEETINGS rows)\" \"\nATTACH '$NAS_DB' AS nas;\nINSERT OR IGNORE INTO nas.meetings ($MEETINGS_COLS, install_id)\n SELECT $MEETINGS_COLS, '$INSTALL_ID' FROM main.meetings WHERE date(meeting_start) = '$TARGET_DATE';\nDETACH nas;\n\"\n\n # ─── SYNC AUDIO DATA ──────────────────────────────────────────────────────\n step \"Syncing audio data for $TARGET_DATE\"\n\n # Speakers + embeddings are install-global, not per-date. Sync everything","role_description":"editor","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false}]...
|
-8030273049412793512
|
8678462245493491461
|
visual_change
|
accessibility
|
NULL
|
Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧ Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧G) - 10 pending changes
10
Run and Debug (⇧⌘D)
Remote Explorer
Extensions (⇧⌘X) - 2 require update
2
Claude Code
Containers
EXPLORER
EXPLORER
Explorer Section: screenpipe [SSH: nas]
Explorer Section: screenpipe [SSH: nas]
SCREENPIPE [SSH: NAS]
#recycle
app
__pycache__
consumers
static
.env
cli.py
M
db.py
docker-compose.yml
Dockerfile
M
main.py
M
requirements.txt
M
data
logs
pipes
.gitignore
app_settings.json
archive.db
archive.db-bak
U
db.sqlite
db.sqlite-shm
db.sqlite-wal
screenpipe_sync_updated.sh
U
screenpipe_sync.sh
screenpipe.db
Outline Section
OUTLINE
OUTLINE
Timeline Section
TIMELINE
TIMELINE
app_settings.json, Editor Group 1
screenpipe_sync.sh, Editor Group 1
screenpipe_sync_updated.sh, preview, Editor Group 1
pipe.md, Editor Group 1
.env, Editor Group 1
#!/bin/bash
# screenpipe_sync.sh
# Syncs Screenpipe SQLite data (vision + audio) to a NAS archive database.
# Append-only, no deletions.
#
# Key design points
# -----------------
# 1. Multi-install safe via install_id.
# Source IDs reset to 1 on every screenpipe reinstall. To avoid collisions
# in the NAS archive, every synced table gets an extra `install_id` column,
# and the logical primary key becomes (install_id, id) enforced by a
# unique index. The install_id is a UUID stored in
# ~/.screenpipe/.sync_install_id — wiping ~/.screenpipe/ (which is what
# happens on reinstall) discards it, so the next run generates a new one.
#
# 2. Schema-drift tolerant. If screenpipe migrations add new columns to the
# source DB, the NAS gets ALTER TABLE'd to match. Inserts use explicit
# column lists so positional mismatches can't occur.
#
# 3. FTS caveat. FTS tables in the NAS use source `id` as rowid. After a
# reinstall, INSERT OR IGNORE will silently skip rows whose id collides
# with a previous install's id, so FTS only reliably indexes the most
# recent install. Falls back to LIKE queries on the base tables for
# multi-install searches (which can filter by install_id).
#
# Usage
# -----
# ./screenpipe_sync.sh # syncs yesterday
# ./screenpipe_sync.sh 2026-04-15 # syncs a specific date
# ./screenpipe_sync.sh today # syncs today so far
# ./screenpipe_sync.sh --reset-install-id # rotate install_id and exit
# ./screenpipe_sync.sh --show-install-id # print install_id and exit
set -euo pipefail
# ─── CONFIG ───────────────────────────────────────────────────────────────────
DB_SRC="${SCREENPIPE_DB:-$HOME/.screenpipe/db.sqlite}"
NAS_MOUNT="${NAS_MOUNT:-/Volumes/screenpipe}"
NAS_DB="$NAS_MOUNT/archive.db"
NAS_DATA="$NAS_MOUNT/data"
LOG_FILE="$HOME/.screenpipe/sync.log"
INSTALL_ID_FILE="$HOME/.screenpipe/.sync_install_id"
# Sync table groups. Order matters for FK-ish references
# (parents before children).
VISION_TABLES=(video_chunks frames elements ocr_text ui_events meetings)
AUDIO_TABLES=(speakers speaker_embeddings audio_chunks audio_transcriptions audio_tags)
ALL_SYNC_TABLES=("${VISION_TABLES[@]}" "${AUDIO_TABLES[@]}")
# ──────────────────────────────────────────────────────────────────────────────
SCRIPT_START=$(date +%s)
# ─── HELPERS ──────────────────────────────────────────────────────────────────
log() {
local msg="[$(date '+%Y-%m-%d %H:%M:%S')] $*"
echo "$msg" | tee -a "$LOG_FILE"
}
step() {
local now=$(date +%s)
local elapsed=$(( now - SCRIPT_START ))
local min=$(( elapsed / 60 ))
local sec=$(( elapsed % 60 ))
printf "\n[+%02dm%02ds] ▶ %s\n" "$min" "$sec" "$*" | tee -a "$LOG_FILE"
}
run_sqlite_heredoc() {
local label="$1"
local sql="$2"
local start=$(date +%s)
printf " %-36s " "$label"
sqlite3 "$DB_SRC" <<< "$sql" &
local pid=$!
local spin=[PASSWORD] '⠙' '⠹' '⠸' '⠼' '⠴' '⠦' '⠧' '⠇' '⠏')
local i=0
while kill -0 "$pid" 2>/dev/null; do
printf "\r %-36s %s " "$label" "${spin[$i]}"
i=$(( (i + 1) % 10 ))
sleep 0.2
done
wait "$pid"
local rc=$?
if [ $rc -ne 0 ]; then
printf "\r %-36s ✗ FAILED\n" "$label" | tee -a "$LOG_FILE"
exit $rc
fi
local dur=$(( $(date +%s) - start ))
printf "\r %-36s ✓ %dm%02ds\n" "$label" "$(( dur / 60 ))" "$(( dur % 60 ))" | tee -a "$LOG_FILE"
}
check() {
local label="$1" got="$2" expected="$3"
if [ "$got" -eq "$expected" ]; then
printf " %-25s %s / %s ✓\n" "$label:" "$got" "$expected"
else
printf " %-25s %s / %s ✗ MISMATCH\n" "$label:" "$got" "$expected"
fi
}
table_columns_with_types() {
local db="$1" table="$2"
sqlite3 "$db" "PRAGMA table_info($table);" | awk -F'|' '{print $2 "|" $3}'
}
table_columns() {
local db="$1" table="$2"
sqlite3 "$db" "PRAGMA table_info($table);" | awk -F'|' '{print $2}'
}
table_exists() {
local db="$1" table="$2"
local count
count=$(sqlite3 "$db" "SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='$table';")
[ "$count" -gt 0 ]
}
# Adds any columns present in source but missing in NAS for the given table.
# Skips install_id (which is NAS-only and managed separately).
ensure_columns() {
local table="$1"
local label="schema: $table"
printf " %-36s " "$label"
if ! table_exists "$DB_SRC" "$table"; then
printf "✗ source missing — skipping\n"
return 0
fi
if ! table_exists "$NAS_DB" "$table"; then
printf "✓ fresh (created above)\n"
return 0
fi
local src_cols
src_cols=$(table_columns_with_types "$DB_SRC" "$table")
local nas_cols
nas_cols=$(table_columns "$NAS_DB" "$table")
local added=0
local added_names=""
while IFS='|' read -r name type; do
[ -z "$name" ] && continue
if ! echo "$nas_cols" | grep -Fxq "$name"; then
sqlite3 "$NAS_DB" "ALTER TABLE $table ADD COLUMN \"$name\" $type;"
added=$((added + 1))
added_names="$added_names $name"
fi
done <<< "$src_cols"
if [ "$added" -gt 0 ]; then
printf "✓ added %d:%s\n" "$added" "$added_names"
else
printf "✓ in sync\n"
fi
}
# Comma-separated, double-quoted column list for a table from source DB.
# Optional alias is prefixed (e.g. `o."col"`) for JOIN selects where column
# names would otherwise collide.
build_col_list() {
local table="$1"
local alias="${2:-}"
local prefix=""
[ -n "$alias" ] && prefix="${alias}."
table_columns "$DB_SRC" "$table" | awk 'NF' | awk -v p="$prefix" '{print p "\"" $0 "\""}' | paste -sd, -
}
# ──────────────────────────────────────────────────────────────────────────────
# ─── ARG HANDLING ─────────────────────────────────────────────────────────────
if [ "${1:-}" = "--reset-install-id" ]; then
if [ -f "$INSTALL_ID_FILE" ]; then
OLD=$(cat "$INSTALL_ID_FILE")
rm -f "$INSTALL_ID_FILE"
echo "Removed install_id: $OLD"
else
echo "No install_id file at $INSTALL_ID_FILE"
fi
echo "A new install_id will be generated on the next sync run."
exit 0
fi
if [ "${1:-}" = "--show-install-id" ]; then
if [ -f "$INSTALL_ID_FILE" ]; then
cat "$INSTALL_ID_FILE"
else
echo "(none — will be generated on next run)"
fi
exit 0
fi
if [ "${1:-}" = "today" ]; then
TARGET_DATE=$(date +%Y-%m-%d)
elif [ -n "${1:-}" ]; then
TARGET_DATE="$1"
if ! [[ "$TARGET_DATE" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then
echo "ERROR: Invalid date. Use YYYY-MM-DD, 'today', or no argument for yesterday."
exit 1
fi
else
TARGET_DATE=$(date -v-1d +%Y-%m-%d)
fi
# ─── INSTALL ID ───────────────────────────────────────────────────────────────
INSTALL_ID=""
if [ -f "$INSTALL_ID_FILE" ]; then
INSTALL_ID=$(tr -d '[:space:]' < "$INSTALL_ID_FILE")
fi
if [ -z "$INSTALL_ID" ]; then
INSTALL_ID=$(uuidgen | tr 'A-Z' 'a-z')
echo "$INSTALL_ID" > "$INSTALL_ID_FILE"
log "Generated new install_id: $INSTALL_ID"
fi
log "========================================"
log "Screenpipe sync starting for: $TARGET_DATE"
log "install_id: $INSTALL_ID"
log "========================================"
# ─── PREFLIGHT ────────────────────────────────────────────────────────────────
step "Preflight checks"
if [ ! -f "$DB_SRC" ]; then
log "ERROR: Source DB not found at $DB_SRC"; exit 1
fi
printf " %-25s %s (%s)\n" "Source DB:" "OK" "$(du -sh "$DB_SRC" | cut -f1)"
if [ ! -d "$NAS_MOUNT" ]; then
log "ERROR: NAS not mounted at $NAS_MOUNT"; exit 1
fi
printf " %-25s %s\n" "NAS mount:" "OK $NAS_MOUNT"
# Check if DB already synced for this date+install_id
DB_ALREADY_SYNCED=false
if [ -f "$NAS_DB" ]; then
if table_exists "$NAS_DB" "frames"; then
HAS_INSTALL_COL=$(sqlite3 "$NAS_DB" "SELECT COUNT(*) FROM pragma_table_info('frames') WHERE name='install_id';")
if [ "$HAS_INSTALL_COL" -gt "0" ]; then
EXISTING=$(sqlite3 "$NAS_DB" "SELECT COUNT(*) FROM frames WHERE date(timestamp)='$TARGET_DATE' AND install_id='$INSTALL_ID';" 2>/dev/null || echo "0")
else
EXISTING=$(sqlite3 "$NAS_DB" "SELECT COUNT(*) FROM frames WHERE date(timestamp)='$TARGET_DATE';" 2>/dev/null || echo "0")
fi
if [ "$EXISTING" -gt "0" ]; then
log "Date $TARGET_DATE / install $INSTALL_ID already has $EXISTING frames — skipping DB sync"
DB_ALREADY_SYNCED=true
else
printf " %-25s %s (%s)\n" "Archive DB:" "exists" "$(du -sh "$NAS_DB" | cut -f1)"
fi
else
printf " %-25s %s\n" "Archive DB:" "exists, no frames table yet"
fi
else
printf " %-25s %s\n" "Archive DB:" "will be created"
fi
# Source data dir for this date (video frames)
DATA_SRC="$HOME/.screenpipe/data/data/$TARGET_DATE"
if [ -d "$DATA_SRC" ]; then
DATA_SIZE=$(du -sh "$DATA_SRC" | cut -f1)
DATA_FILES=$(ls "$DATA_SRC" | wc -l | tr -d ' ')
printf " %-25s %s (%s files, %s)\n" "Frame data dir:" "OK" "$DATA_FILES" "$DATA_SIZE"
else
printf " %-25s %s\n" "Frame data dir:" "not found — skipping"
fi
# Audio files (flat in ~/.screenpipe/data/, dated by filename)
shopt -s nullglob
AUDIO_SRC_FILES=( "$HOME/.screenpipe/data/"*_"${TARGET_DATE}"_*.mp4 )
shopt -u nullglob
if [ ${#AUDIO_SRC_FILES[@]} -gt 0 ]; then
AUDIO_TOTAL=$(du -ch "${AUDIO_SRC_FILES[@]}" | tail -1 | cut -f1)
printf " %-25s %s (%s files, %s)\n" "Audio files:" "OK" "${#AUDIO_SRC_FILES[@]}" "$AUDIO_TOTAL"
else
printf " %-25s %s\n" "Audio files:" "none for this date"
fi
# ─── SCHEMA MIGRATION: install_id ─────────────────────────────────────────────
# Adds install_id column to existing NAS tables, backfills NULLs with a
# legacy tag, and creates the (install_id, id) unique index. Idempotent.
if [ -f "$NAS_DB" ]; then
step "Schema migration: install_id"
LEGACY_TAG="legacy-$(date +%Y%m%d)"
for tbl in "${ALL_SYNC_TABLES[@]}"; do
if ! table_exists "$NAS_DB" "$tbl"; then
continue
fi
HAS_COL=$(sqlite3 "$NAS_DB" "SELECT COUNT(*) FROM pragma_table_info('$tbl') WHERE name='install_id';")
if [ "$HAS_COL" = "0" ]; then
ROW_COUNT=$(sqlite3 "$NAS_DB" "SELECT COUNT(*) FROM $tbl;")
printf " %-36s adding install_id, backfill %s rows → %s\n" "$tbl" "$ROW_COUNT" "$LEGACY_TAG"
sqlite3 "$NAS_DB" "ALTER TABLE $tbl ADD COLUMN install_id TEXT;"
sqlite3 "$NAS_DB" "UPDATE $tbl SET install_id = '$LEGACY_TAG' WHERE install_id IS NULL;"
fi
sqlite3 "$NAS_DB" "CREATE UNIQUE INDEX IF NOT EXISTS idx_${tbl}_install_pk ON ${tbl}(install_id, id);"
done
fi
# ─── DB SYNC ──────────────────────────────────────────────────────────────────
if [ "$DB_ALREADY_SYNCED" = false ]; then
# ─── COUNT SOURCE ROWS ────────────────────────────────────────────────────
step "Counting source rows for $TARGET_DATE"
SRC_FRAMES=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM frames WHERE date(timestamp) = '$TARGET_DATE';")
SRC_ELEMENTS=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM elements WHERE frame_id IN (SELECT id FROM frames WHERE date(timestamp) = '$TARGET_DATE');")
SRC_UI=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM ui_events WHERE date(timestamp) = '$TARGET_DATE';")
SRC_OCR=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM ocr_text WHERE frame_id IN (SELECT id FROM frames WHERE date(timestamp) = '$TARGET_DATE');")
SRC_MEETINGS=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM meetings WHERE date(meeting_start) = '$TARGET_DATE';")
SRC_ACHUNKS=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM audio_chunks WHERE date(timestamp) = '$TARGET_DATE';")
SRC_ATRANS=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM audio_transcriptions WHERE audio_chunk_id IN (SELECT id FROM audio_chunks WHERE date(timestamp) = '$TARGET_DATE');")
SRC_ATAGS=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM audio_tags WHERE audio_chunk_id IN (SELECT id FROM audio_chunks WHERE date(timestamp) = '$TARGET_DATE');")
# speakers + speaker_embeddings are install-global, not per-date; we sync all.
SRC_SPEAKERS=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM speakers;")
SRC_SEMB=$(sqlite3 "$DB_SRC" "SELECT COUNT(*) FROM speaker_embeddings;")
printf " %-25s %s\n" "frames:" "$SRC_FRAMES"
printf " %-25s %s\n" "elements:" "$SRC_ELEMENTS"
printf " %-25s %s\n" "ui_events:" "$SRC_UI"
printf " %-25s %s\n" "ocr_text:" "$SRC_OCR"
printf " %-25s %s\n" "meetings:" "$SRC_MEETINGS"
printf " %-25s %s\n" "audio_chunks:" "$SRC_ACHUNKS"
printf " %-25s %s\n" "audio_transcriptions:" "$SRC_ATRANS"
printf " %-25s %s\n" "audio_tags:" "$SRC_ATAGS"
printf " %-25s %s (all-time)\n" "speakers:" "$SRC_SPEAKERS"
printf " %-25s %s (all-time)\n" "speaker_embeddings:" "$SRC_SEMB"
if [ "$SRC_FRAMES" -eq "0" ] && [ "$SRC_ACHUNKS" -eq "0" ]; then
log "No frames or audio chunks for $TARGET_DATE — skipping DB sync"
DB_ALREADY_SYNCED=true
fi
fi
if [ "$DB_ALREADY_SYNCED" = false ]; then
# ─── INIT TABLES ──────────────────────────────────────────────────────────
step "Initialising tables (CREATE IF NOT EXISTS)"
run_sqlite_heredoc "creating vision tables" "
ATTACH '$NAS_DB' AS nas;
CREATE TABLE IF NOT EXISTS nas.frames AS SELECT * FROM main.frames WHERE 0;
CREATE TABLE IF NOT EXISTS nas.elements AS SELECT * FROM main.elements WHERE 0;
CREATE TABLE IF NOT EXISTS nas.ui_events AS SELECT * FROM main.ui_events WHERE 0;
CREATE TABLE IF NOT EXISTS nas.ocr_text AS SELECT * FROM main.ocr_text WHERE 0;
CREATE TABLE IF NOT EXISTS nas.video_chunks AS SELECT * FROM main.video_chunks WHERE 0;
CREATE TABLE IF NOT EXISTS nas.meetings AS SELECT * FROM main.meetings WHERE 0;
DETACH nas;
"
run_sqlite_heredoc "creating audio tables" "
ATTACH '$NAS_DB' AS nas;
CREATE TABLE IF NOT EXISTS nas.audio_chunks AS SELECT * FROM main.audio_chunks WHERE 0;
CREATE TABLE IF NOT EXISTS nas.audio_transcriptions AS SELECT * FROM main.audio_transcriptions WHERE 0;
CREATE TABLE IF NOT EXISTS nas.speakers AS SELECT * FROM main.speakers WHERE 0;
CREATE TABLE IF NOT EXISTS nas.speaker_embeddings AS SELECT * FROM main.speaker_embeddings WHERE 0;
CREATE TABLE IF NOT EXISTS nas.audio_tags AS SELECT * FROM main.audio_tags WHERE 0;
DETACH nas;
"
# Re-run install_id + index setup so freshly-created tables get them too.
for tbl in "${ALL_SYNC_TABLES[@]}"; do
HAS_COL=$(sqlite3 "$NAS_DB" "SELECT COUNT(*) FROM pragma_table_info('$tbl') WHERE name='install_id';")
if [ "$HAS_COL" = "0" ]; then
sqlite3 "$NAS_DB" "ALTER TABLE $tbl ADD COLUMN install_id TEXT;"
fi
sqlite3 "$NAS_DB" "CREATE UNIQUE INDEX IF NOT EXISTS idx_${tbl}_install_pk ON ${tbl}(install_id, id);"
done
# ─── SCHEMA DRIFT ─────────────────────────────────────────────────────────
step "Reconciling NAS schema with source"
for tbl in "${ALL_SYNC_TABLES[@]}"; do
ensure_columns "$tbl"
done
run_sqlite_heredoc "creating indexes" "
ATTACH '$NAS_DB' AS nas;
-- vision
CREATE INDEX IF NOT EXISTS nas.idx_frames_timestamp ON frames(timestamp);
CREATE INDEX IF NOT EXISTS nas.idx_frames_app_name ON frames(app_name);
CREATE INDEX IF NOT EXISTS nas.idx_frames_window_name ON frames(window_name);
CREATE INDEX IF NOT EXISTS nas.idx_frames_video_chunk_id ON frames(video_chunk_id);
CREATE INDEX IF NOT EXISTS nas.idx_frames_document_path ON frames(document_path) WHERE document_path IS NOT NULL;
CREATE INDEX IF NOT EXISTS nas.idx_elements_frame_id ON elements(frame_id);
CREATE INDEX IF NOT EXISTS nas.idx_elements_frame_src_role ON elements(frame_id, source, role) WHERE text IS NOT NULL;
CREATE INDEX IF NOT EXISTS nas.idx_elements_onscreen_frame ON elements(frame_id) WHERE on_screen = 1 AND text IS NOT NULL;
CREATE INDEX IF NOT EXISTS nas.idx_ui_events_timestamp ON ui_events(timestamp);
CREATE INDEX IF NOT EXISTS nas.idx_ui_events_app_name ON ui_events(app_name);
CREATE INDEX IF NOT EXISTS nas.idx_ui_events_frame_id ON ui_events(frame_id);
CREATE INDEX IF NOT EXISTS nas.idx_ocr_text_frame_id ON ocr_text(frame_id);
CREATE INDEX IF NOT EXISTS nas.idx_meetings_start ON meetings(meeting_start);
CREATE INDEX IF NOT EXISTS nas.idx_video_chunks_device ON video_chunks(device_name);
-- audio
CREATE INDEX IF NOT EXISTS nas.idx_audio_chunks_timestamp ON audio_chunks(timestamp);
CREATE INDEX IF NOT EXISTS nas.idx_audio_trans_chunk_id ON audio_transcriptions(audio_chunk_id);
CREATE INDEX IF NOT EXISTS nas.idx_audio_trans_timestamp ON audio_transcriptions(timestamp);
CREATE INDEX IF NOT EXISTS nas.idx_audio_trans_speaker ON audio_transcriptions(speaker_id, timestamp DESC);
CREATE INDEX IF NOT EXISTS nas.idx_speaker_emb_speaker_id ON speaker_embeddings(speaker_id);
CREATE INDEX IF NOT EXISTS nas.idx_audio_tags_chunk_id ON audio_tags(audio_chunk_id);
DETACH nas;
"
run_sqlite_heredoc "creating FTS tables" "
ATTACH '$NAS_DB' AS nas;
CREATE VIRTUAL TABLE IF NOT EXISTS nas.elements_fts USING fts5(
text, role, frame_id UNINDEXED,
content='elements', content_rowid='id', tokenize='unicode61'
);
CREATE VIRTUAL TABLE IF NOT EXISTS nas.frames_fts USING fts5(
full_text, app_name, window_name, browser_url, id UNINDEXED,
tokenize='unicode61'
);
CREATE VIRTUAL TABLE IF NOT EXISTS nas.ui_events_fts USING fts5(
text_content, app_name, window_title, element_name,
content='ui_events', content_rowid='id', tokenize='unicode61'
);
CREATE VIRTUAL TABLE IF NOT EXISTS nas.audio_transcriptions_fts USING fts5(
transcription, device, speaker_id UNINDEXED, id UNINDEXED,
tokenize='unicode61'
);
DETACH nas;
"
# ─── BUILD EXPLICIT COLUMN LISTS ──────────────────────────────────────────
# Source columns + install_id appended. Same on both sides of the INSERT.
FRAMES_COLS=$(build_col_list frames)
ELEMENTS_COLS=$(build_col_list elements)
ELEMENTS_COLS_E=$(build_col_list elements e)
UI_EVENTS_COLS=$(build_col_list ui_events)
OCR_TEXT_COLS=$(build_col_list ocr_text)
OCR_TEXT_COLS_O=$(build_col_list ocr_text o)
VIDEO_CHUNKS_COLS=$(build_col_list video_chunks)
MEETINGS_COLS=$(build_col_list meetings)
ACHUNKS_COLS=$(build_col_list audio_chunks)
ATRANS_COLS=$(build_col_list audio_transcriptions)
ATRANS_COLS_T=$(build_col_list audio_transcriptions t)
SPEAKERS_COLS=$(build_col_list speakers)
SEMB_COLS=$(build_col_list speaker_embeddings)
ATAGS_COLS=$(build_col_list audio_tags)
ATAGS_COLS_AT=$(build_col_list audio_tags at)
# ─── SYNC VISION DATA ─────────────────────────────────────────────────────
step "Syncing vision data for $TARGET_DATE"
run_sqlite_heredoc "video_chunks" "
ATTACH '$NAS_DB' AS nas;
INSERT OR IGNORE INTO nas.video_chunks ($VIDEO_CHUNKS_COLS, install_id)
SELECT $VIDEO_CHUNKS_COLS, '$INSTALL_ID' FROM main.video_chunks
WHERE id IN (
SELECT DISTINCT video_chunk_id FROM main.frames
WHERE date(timestamp) = '$TARGET_DATE' AND video_chunk_id IS NOT NULL
);
DETACH nas;
"
run_sqlite_heredoc "frames ($SRC_FRAMES rows)" "
ATTACH '$NAS_DB' AS nas;
INSERT OR IGNORE INTO nas.frames ($FRAMES_COLS, install_id)
SELECT $FRAMES_COLS, '$INSTALL_ID' FROM main.frames WHERE date(timestamp) = '$TARGET_DATE';
DETACH nas;
"
run_sqlite_heredoc "ocr_text ($SRC_OCR rows)" "
ATTACH '$NAS_DB' AS nas;
INSERT OR IGNORE INTO nas.ocr_text ($OCR_TEXT_COLS, install_id)
SELECT $OCR_TEXT_COLS_O, '$INSTALL_ID' FROM main.ocr_text o
JOIN main.frames f ON o.frame_id = f.id
WHERE date(f.timestamp) = '$TARGET_DATE';
DETACH nas;
"
run_sqlite_heredoc "ui_events ($SRC_UI rows)" "
ATTACH '$NAS_DB' AS nas;
INSERT OR IGNORE INTO nas.ui_events ($UI_EVENTS_COLS, install_id)
SELECT $UI_EVENTS_COLS, '$INSTALL_ID' FROM main.ui_events WHERE date(timestamp) = '$TARGET_DATE';
DETACH nas;
"
run_sqlite_heredoc "elements ($SRC_ELEMENTS rows)" "
ATTACH '$NAS_DB' AS nas;
INSERT OR IGNORE INTO nas.elements ($ELEMENTS_COLS, install_id)
SELECT $ELEMENTS_COLS_E, '$INSTALL_ID' FROM main.elements e
JOIN main.frames f ON e.frame_id = f.id
WHERE date(f.timestamp) = '$TARGET_DATE';
DETACH nas;
"
run_sqlite_heredoc "meetings ($SRC_MEETINGS rows)" "
ATTACH '$NAS_DB' AS nas;
INSERT OR IGNORE INTO nas.meetings ($MEETINGS_COLS, install_id)
SELECT $MEETINGS_COLS, '$INSTALL_ID' FROM main.meetings WHERE date(meeting_start) = '$TARGET_DATE';
DETACH nas;
"
# ─── SYNC AUDIO DATA ──────────────────────────────────────────────────────
step "Syncing audio data for $TARGET_DATE"
# Speakers + embeddings are install-global, not per-date. Sync everything...
|
21433
|
NULL
|
NULL
|
NULL
|
|
15132
|
676
|
10
|
2026-05-11T06:19:50.986346+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778480390986_m1.jpg...
|
PhpStorm
|
faVsco.js – Client.php
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
2
64
1
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot;
use HubSpot\Client\Crm\Deals\ApiException as DealApiException;
use HubSpot\Client\Crm\Contacts\ApiException as ContactApiException;
use HubSpot\Client\Crm\Companies\ApiException as CompanyApiException;
use HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations as ContactsWithAssociations;
use HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations as CompaniesWithAssociations;
use HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations as DealWithAssociations;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations as ObjectWithAssociations;
use HubSpot\Client\Crm\Pipelines\Model\Error;
use HubSpot\Client\Crm\Pipelines\Model\PipelineStage;
use HubSpot\Client\Crm\Properties\Model\Property;
use HubSpot\Discovery\Discovery;
use Jiminny\Exceptions\CrmException;
use Jiminny\Exceptions\RateLimitException;
use Jiminny\Exceptions\SocialAccountTokenInvalidException;
use Jiminny\Jobs\Crm\NoteObject;
use Jiminny\Models\Crm\Field;
use Jiminny\Services\Crm\BaseClient;
use Jiminny\Services\Crm\Hubspot\DTO\Response\Owner;
use Jiminny\Services\SocialAccountService;
use SevenShores\Hubspot\Exceptions\BadRequest;
use SevenShores\Hubspot\Exceptions\HubspotException;
use SevenShores\Hubspot\Factory;
use SevenShores\Hubspot\Http\Response;
use Jiminny\Services\Crm\Hubspot\Pagination\HubspotPaginationService;
use Throwable;
/**
* @phpstan-type CrmFieldOption array{id:string, label:string, value?:string}
*/
class Client extends BaseClient implements HubspotClientInterface
{
public const string MIN_API_VERSION = '2';
public const string BASE_URL = '[URL_WITH_CREDENTIALS] T
* @param callable(): T $apiCall
* @return T
*
* @throws RateLimitException
*/
private function executeRequest(callable $apiCall)
{
try {
return $apiCall();
} catch (Throwable $e) {
if ($this->isHubspotRateLimit($e)) {
$retryAfter = $this->parseRetryAfter($e);
$this->log->warning('[Hubspot] Received 429 from API', [
'team_id' => $this->config->team_id,
'config_id' => $this->config->getId(),
'retry_after' => $retryAfter,
'reason' => $e->getMessage(),
]);
throw new RateLimitException('Hubspot returned 429', $retryAfter, $e);
}
throw $e;
}
}
public function isHubspotRateLimit(Throwable $e): bool
{
if ($e instanceof BadRequest
|| $e instanceof DealApiException
|| $e instanceof ContactApiException
|| $e instanceof CompanyApiException
|| $e instanceof \GuzzleHttp\Exception\RequestException
) {
return (int) $e->getCode() === 429;
}
return false;
}
public function parseRetryAfter(Throwable $e): int
{
// First try to get Retry-After from response headers
if (method_exists($e, 'getResponseHeaders')) {
$headers = $e->getResponseHeaders() ?: [];
$value = $headers['Retry-After'] ?? $headers['retry-after'] ?? null;
if (is_array($value)) {
$value = $value[0] ?? null;
}
if (is_numeric($value)) {
return (int) $value;
}
}
if (method_exists($e, 'getResponseBody')) {
$body = $e->getResponseBody();
if (is_string($body)) {
$body = json_decode($body, true) ?? [];
}
$policyName = $body['policyName'] ?? $body['policy'] ?? $body['context']['policyName'] ?? null;
if ($policyName === 'TEN_SECONDLY_ROLLING' || $policyName === 'ten_secondly_rolling') {
return 10;
}
if ($policyName === 'SECONDLY' || $policyName === 'secondly') {
return 1;
}
}
$this->log->warning('[Hubspot] No retry-after header or policy name found, using default', [
'exception_class' => get_class($e),
]);
return 10;
}
public function getMinimumApiVersion(): string
{
return self::MIN_API_VERSION;
}
public function getInstance(): Factory
{
return new Factory([
'key' => $this->accessToken,
'oauth2' => true,
'base_url' => $this->baseUrl,
]);
}
public function getNewInstance(): Discovery
{
return \HubSpot\Factory::createWithAccessToken($this->accessToken);
}
/**
* Secondly and daily limits for Hubspot API
*
* Product Tier: Free & Starter | Professional & Enterprise | API add-on (any tier)
* Burst: 100/10 seconds | 150/10 seconds | 200/10 seconds
* Daily: 250,000 | 500,000 | 1,000,000
*
* Official documentation states: The search endpoints are rate limited to five requests per second.
* Since with 5 RPS were still hitting secondly rate limits we lowered it to 4
*/
public function getPaginatedData(array $payload, string $type, int $offset = 0): array
{
$total = 0;
$lastId = null;
$rows = [];
foreach ($this->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastId) as $row) {
$rows[] = $row;
}
return ['results' => $rows, 'total' => $total, 'last_record' => $lastId];
}
/**
* @throws HubspotException
* @throws SocialAccountTokenInvalidException
* @throws BadRequest
*/
public function getPaginatedDataGenerator(
array $payload,
string $type,
int $offset = 0,
int &$total = 0,
?string &$lastRecordId = null
): \Generator {
return $this->paginationService->getPaginatedDataGenerator(
$this,
$payload,
$type,
$offset,
$total,
$lastRecordId
);
}
/**
* Execute a search request against HubSpot CRM objects with rate limiting.
*
* @param string $objectType The object type ('deals', 'companies', 'contacts', 'calls')
* @param array<string, mixed> $payload The search payload with filters, sorts, properties, etc.
* @return array The search response with 'results', 'total', 'paging' keys
* @throws RateLimitException When rate limit is hit
* @throws HubspotException On API errors
*/
public function search(string $objectType, array $payload): array
{
$endpoint = self::BASE_URL . "/crm/v3/objects/{$objectType}/search";
return $this->executeRequest(function () use ($endpoint, $payload) {
$response = $this->getInstance()->getClient()->request('POST', $endpoint, ['json' => $payload]);
return $response->toArray();
});
}
/**
* @throws DealApiException
* @throws CrmException
*/
public function getOpportunityById(string $crmId, array $fields): array
{
try {
// $deal = $this->executeRequest(fn () => $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$deal = $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$crmId,
implode(',', $fields),
'companies,contacts'
);
} catch (DealApiException $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $deal instanceof DealWithAssociations) {
throw new CrmException('Deal not found');
}
return [
'id' => $deal->getId(),
'properties' => $deal->getProperties(),
'associations' => $deal->getAssociations(),
];
}
/**
* Generic batch read method for HubSpot objects
*
* @param string $objectType The object type ('deals', 'companies', 'contacts')
* @param array<string> $crmIds Array of HubSpot object IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with object data
*/
private function batchReadObjects(string $objectType, array $crmIds, array $fields): array
{
if (empty($crmIds)) {
return [];
}
$this->validateBatchSize($objectType, $crmIds);
$this->ensureValidToken();
try {
$batchConfig = $this->createBatchConfiguration($objectType);
$batchReadRequest = $this->prepareBatchRequest($batchConfig, $crmIds, $fields);
$response = $batchConfig['api']->read($batchReadRequest);
$this->validateApiResponse($response, $objectType);
$results = $this->processApiResults($response);
$this->logBatchResults($objectType, $crmIds, $results);
return $results;
} catch (\Throwable $e) {
$this->handleBatchError($e, $objectType, $crmIds);
}
}
private function validateBatchSize(string $objectType, array $crmIds): void
{
if (count($crmIds) > 100) {
throw new \InvalidArgumentException("Batch size cannot exceed 100 {$objectType}");
}
}
private function createBatchConfiguration(string $objectType): array
{
$configurations = [
'deals' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->deals()->batchApi(),
],
'companies' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->companies()->batchApi(),
],
'contacts' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->contacts()->batchApi(),
],
];
if (! isset($configurations[$objectType])) {
throw new \InvalidArgumentException("Unsupported object type: {$objectType}");
}
return $configurations[$objectType];
}
private function prepareBatchRequest(array $batchConfig, array $crmIds, array $fields): object
{
$batchReadRequest = $batchConfig['batchReadRequest'];
$inputClass = $batchConfig['inputClass'];
$inputs = array_map(function ($crmId) use ($inputClass) {
$input = new $inputClass();
$input->setId($crmId);
return $input;
}, $crmIds);
$batchReadRequest->setInputs($inputs);
$batchReadRequest->setProperties($fields);
return $batchReadRequest;
}
private function validateApiResponse($response, string $objectType): void
{
if (! $response) {
throw new CrmException("HubSpot API returned null response for {$objectType} batch read");
}
}
private function processApiResults($response): array
{
$results = [];
$responseResults = $response->getResults();
if ($responseResults) {
foreach ($responseResults as $object) {
if ($object && $object->getId()) {
$results[$object->getId()] = [
'id' => $object->getId(),
'properties' => $object->getProperties() ?: [],
];
}
}
}
return $results;
}
private function logBatchResults(string $objectType, array $crmIds, array $results): void
{
$this->log->info("[HubSpot] Batch fetched {$objectType}", [
'requested_count' => count($crmIds),
'returned_count' => count($results),
'crm_ids' => $crmIds,
]);
}
private function handleBatchError(\Throwable $e, string $objectType, array $crmIds): void
{
$errorMessage = $e->getMessage() ?: 'Unknown error';
$errorTrace = $e->getTraceAsString() ?: 'No trace available';
$this->log->error("[HubSpot] Failed to batch fetch {$objectType}", [
'crm_ids' => $crmIds,
'error' => $errorMessage,
'trace' => $errorTrace,
]);
throw new CrmException("Failed to batch fetch {$objectType}: " . $errorMessage);
}
/**
* Batch read multiple opportunities by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot deal IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with opportunity data
*/
public function getOpportunitiesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('deals', $crmIds, $fields);
}
/**
* Batch read multiple companies by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot company IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with company data
*/
public function getCompaniesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('companies', $crmIds, $fields);
}
/**
* Batch read multiple contacts by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot contact IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with contact data
*/
public function getContactsByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('contacts', $crmIds, $fields);
}
/**
* @throws CompanyApiException
* @throws CrmException
*/
public function getAccountById(string $crmId, array $fields): array
{
try {
$company = $this->getNewInstance()->crm()->companies()->basicApi()->getById(
$crmId,
implode(',', $fields),
);
} catch (CompanyApiException $e) {
$this->log->info('[Hubspot] Failed to fetch account', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $company instanceof CompaniesWithAssociations) {
throw new CrmException('Account not found');
}
return [
'id' => $company->getId(),
'properties' => $company->getProperties(),
];
}
/**
* @throws ContactApiException
* @throws CrmException
*/
public function getContactById(string $crmId, array $fields): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$crmId,
implode(',', $fields)
);
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $contact instanceof ContactsWithAssociations) {
throw new CrmException('Contact not found');
}
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
}
/**
* This is email search request that Hubspot offers as GET (more generous quota)
*/
public function getContactByEmail(string $email, array $fields = []): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$email,
implode(',', $fields),
null,
false,
'email'
);
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'email' => $email,
'reason' => $e->getMessage(),
]);
return [];
}
}
/**
* @throws CrmException
*/
public function fetchProperty(string $objectType, string $propertyId): Property
{
$result = $this->getNewInstance()->crm()->properties()->coreApi()->getByName($objectType, $propertyId);
if (! $result instanceof Property) {
$this->log->error('[Hubspot] Failed to fetch property', [
'object_type' => $objectType,
'property_id' => $propertyId,
'reason' => $result->getMessage(),
]);
throw new CrmException('Failed to fetch property');
}
return $result;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchPropertyOptions(string $objectType, string $propertyId): array
{
/** @var array<CrmFieldOption> */
return $this->fetchProperty($objectType, $propertyId)->getOptions();
}
/**
* @return array<array{id:string, label:string, deleted:bool}>
*/
public function fetchCallDispositions(): array
{
/** @var Response $response */
$response = $this->getInstance()->engagements()->getCallDispositions();
/**
* @var array<array{
* id:string,
* label:string,
* deleted: bool
* }>
*/
return $response->toArray();
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityPipelineStages(): array
{
$stages = [];
$apiResponse = $this->getNewInstance()->crm()->pipelines()->pipelinesApi()->getAll('deals');
if ($apiResponse instanceof Error) {
$this->log->error('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $apiResponse->getMessage(),
]);
return [];
}
foreach ($apiResponse->getResults() as $pipeline) {
$pipelineStages = array_map(
static function (PipelineStage $stage) {
return [
'id' => $stage->getId(),
'label' => $stage->getLabel(),
];
},
$pipeline->getStages()
);
$stages = array_merge($stages, $pipelineStages);
}
return $stages;
}
public function fetchOpportunityPipelines(): array
{
$pipelines = [];
try {
$apiResponse = $this->makeRequest('/crm/v3/pipelines/deals');
} catch (\Exception $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $e->getMessage(),
]);
return [];
}
$response = $apiResponse->toArray();
foreach ($response['results'] as $pipeline) {
$pipelines[] = [
'id' => $pipeline['id'],
'label' => $pipeline['label'],
];
}
return $pipelines;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchMeetingOutcomeFieldOptions(Field $field): array
{
return $field->getCrmProviderId() === 'meetingOutcome'
? $this->fetchMeetingOutcomeTypes()
: $this->fetchCallActivityTypes();
}
public function fetchMeetingOutcomeTypes(): array
{
return $this->extractMeetingTypeOptions(
'[URL_WITH_CREDENTIALS] Response $response */
$response = $this->getInstance()
->getClient()
->request('GET', $endpoint);
/**
* @var array<array{
* value: string,
* label: string,
* displayOrder: int
* }> $optionData
*/
$optionData = $response->toArray()['options'] ?? [];
$options = [];
foreach ($optionData as $item) {
$options[] = [
'id' => $item['value'],
'value' => $item['value'],
'label' => $item['label'],
'display_order' => $item['displayOrder'],
];
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchDispositionFieldOptions(): array
{
$options = [];
$dispositions = $this->fetchCallDispositions();
foreach ($dispositions as $disposition) {
if ($disposition['deleted'] !== false) {
continue;
}
$option['value'] = $disposition['id'];
$option['id'] = $disposition['id'];
$option['label'] = $disposition['label'];
$options[] = $option;
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityFieldOptions(Field $field): array
{
if ($field->isStageField()) {
return $this->fetchOpportunityPipelineStages();
}
if ($field->isPipelineField()) {
return $this->fetchOpportunityPipelines();
}
return $this->fetchPropertyOptions('deals', $field->getCrmProviderId());
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function makeRequest(string $endpoint, $method = 'GET', $payload = [], ?string $queryString = null)
{
$endpoint = self::BASE_URL . $endpoint;
if ($method === 'GET') {
$response = $this->getInstance()->getClient()?->request(
method: $method,
endpoint: $endpoint,
query_string: $queryString
);
} else {
$response = $this->getInstance()->getClient()->request($method, $endpoint, [
'json' => ($payload),
]);
}
//
// $max = $response->getHeaderLine('X-HubSpot-RateLimit-Max'); // "110"
// $remaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'); // "109"
// $interval = $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // "10000"
// $body = json_decode((string) $response->getBody(), true);
//
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$max ' . PHP_EOL . print_r($max, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$remaining ' . PHP_EOL . print_r($remaining, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$interval ' . PHP_EOL . print_r($interval, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$body ' . PHP_EOL . print_r($body, true));
return $response;
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function createMeeting(array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings';
return $this->makeRequest($endpoint, 'POST', $payload);
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function updateMeeting(string $meetingId, array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings/' . $meetingId;
return $this->makeRequest($endpoint, 'PATCH', $payload);
}
/**
* @throws \Exception
*/
public function createNote(
string $body,
string $ownerId,
int $timestamp,
string $objectId,
NoteObject $noteObject
): ?string {
try {
$noteInput = new SimplePublicObjectInput([
'properties' => [
'hs_note_body' => $body,
'hubspot_owner_id' => $ownerId,
'hs_timestamp' => $timestamp,
],
]);
// Create note
$note = $this->getNewInstance()->crm()->objects()->basicApi()->create('note', $noteInput);
$this->getNewInstance()->crm()->objects()->associationsApi()->create(
'note',
$note->getId(),
$this->getNoteObject($noteObject),
$objectId,
$this->getNoteAssociationType($noteObject),
);
return $note->getId();
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to create note', [
'objectId' => $objectId,
'noteObject' => $noteObject->getObjectType(),
'reason' => $e->getMessage(),
]);
\Sentry::captureException($e);
}
return null;
}
public function updateEngagement(string $objectId, array $engagement, array $metadata): void
{
$this->getInstance()->engagements()->update($objectId, $engagement, $metadata);
}
public function getEngagementData(string $engagementId): array
{
$engagement = $this->getInstance()->engagements()->get($engagementId);
return $engagement->toArray();
}
public function createEngagement(array $engagement, array $associations, array $metadata): Response
{
return $this->getInstance()
->engagements()
->create($engagement, $associations, $metadata);
}
public function isUnauthorizedException(\Exception $e): bool
{
if ($e instanceof BadRequest
|| $e instanceof DealApiException
|| $e instanceof ContactApiException
|| $e instanceof CompanyApiException
) {
return (int) $e->getCode() === 401;
}
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
return $e->getResponse()?->getStatusCode() === 401;
}
$message = strtolower($e->getMessage());
return str_contains($message, '401 unauthorized') ||
str_contains($message, 'http 401') ||
str_contains($message, 'status code 401') ||
(preg_match('/\b401\b/', $message) === 1 && str_contains($message, 'unauthorized'));
}
/**
* Validates and refreshes the access token if needed before API requests.
* This ensures long-running processes don't fail due to token expiration.
*
* @throws SocialAccountTokenInvalidException
*/
public function ensureValidToken(): void
{
if ($this->oauthAccount === null) {
return;
}
$newToken = $this->tokenManager->ensureValidToken($this->oauthAccount);
if ($newToken !== null) {
$this->accessToken = $newToken;
}
}
public function getConfig()
{
return $this->config;
}
// returns only active (archived=false)
public function getOwners(): array
{
return $this->getNewInstance()->crm()->owners()->getAll();
}
/**
* @param bool $archived
*
* @return array<Owner>|[]
*/
public function getOwnersArchived(bool $archived = true): array
{
$endpoint = '/crm/v3/owners';
$queryParams = [
'archived' => $archived ? 'true' : 'false',
];
$queryString = http_build_query($queryParams);
$owners = [];
try {
$response = $this->makeRequest(endpoint: $endpoint, queryString: $queryString);
$responseData = $response?->toArray();
foreach ($responseData['results'] as $result) {
try {
$owners[] = Owner::create($result);
} catch (Throwable $e) {
$this->log->error('[HubSpot] Failed to process owner data', [
'result' => $result,
'error' => $e->getMessage(),
]);
continue;
}
}
} catch (Throwable $e) {
$this->log->error('HubSpot] Failed to fetch owners', [
'archived' => $archived,
'error' => $e->getMessage(),
]);
return [];
}
return $owners;
}
public function getMeeting(string $engagementId): ObjectWithAssociations
{
return $this->getNewInstance()->crm()->objects()->basicApi()
->getById('meeting', $engagementId, null, 'contact,company,deal');
}
public function deleteEngagement(string $engagementId): void
{
$this->getInstance()->engagements()->delete((int) $engagementId);
}
public function getAssociationsData(array $ids, string $fromObject, string $toObject): array
{
$associationData = [];
$idChunks = array_chunk($ids, self::ASSOCIATIONS_BATCH_SIZE_LIMIT);
foreach ($idChunks as $idChunk) {
try {
$batchInput = new \HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId();
$batchInput->setInputs(array_map(function ($id) {
$publicObjectId = new \HubSpot\Client\Crm\Associations\Model\PublicObjectId();
$publicObjectId->setId($id);
return $publicObjectId;
}, $idChunk));
$associatedObjectsData = $this
->getNewInstance()
->crm()
->associations()
->batchApi()
->read($fromObject, $toObject, $batchInput);
if ($associatedObjectsData instanceof \HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti) {
foreach ($associatedObjectsData->getResults() as $association) {
$from = $association->getFrom()->getId();
$toAssociations = $association->getTo();
if (! empty($toAssociations)) {
$associationData[$from] = array_map(function ($item) {
return $item->getId();
}, $toAssociations);
}
}
}
} catch (RateLimitException $e) {
throw $e;
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to fetch associations', [
'from_object' => $fromObject,
'to_object' => $toObject,
'reason' => $e->getMessage(),
]);
}
}
return $associationData;
}
/**
* @throws \Exception
*/
private function getNoteAssociationType(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'note_to_deal',
NoteObject::Lead, NoteObject::Contact => 'note_to_contact', // or 'note_to_lead' if your portal supports it
NoteObject::Account => 'note_to_company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
/**
* @throws \Exception
*/
private function getNoteObject(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'deal',
NoteObject::Lead, NoteObject::Contact => 'contact',
NoteObject::Account => 'company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
public function addAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/create";
return $this->makeRequest($endpoint, 'POST', $payload);
}
public function removeAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/archive";
return $this->makeRequest($endpoint, 'POST', $payload);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
19
Previous Highlighted Error
Next Highlighted Error
[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {
"headers":{
"Date":["Thu,07 May 2026 14:21:15 GMT"],
"Content-Type":["application/json;charset=utf-8"],
"Transfer-Encoding":["chunked"],
"Connection":["keep-alive"],
"CF-Ray":["9f80deb8db60dc3a-SOF"],
"CF-Cache-Status":["DYNAMIC"],
"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],
"Vary":["origin,
accept-encoding"],
"access-control-allow-credentials":["false"],
"server-timing":["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\",
cfr;desc=\"9f80deb8e7c6dc3a-IAD\""],
"x-content-type-options":["nosniff"],
"x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],
"Set-Cookie":["__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-[IP_ADDRESS]-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,
07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None"],
"Report-To":["{
\"endpoints\":[{
\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\"}],
\"group\":\"cf-nel\",
\"max_age\":604800}"],
"NEL":["{
\"success_fraction\":0.01,
\"report_to\":\"cf-nel\",
\"max_age\":604800}"],
"Server":["cloudflare"]}} {
"correlation_id":"95236535-ec98-4541-b92a-adfa73b69eab",
"trace_id":"c7ab8365-903f-46d4-9403-0e5b551e3545"}
Project
Project
New File or Directory…...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"64","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Hubspot;\n\nuse HubSpot\\Client\\Crm\\Deals\\ApiException as DealApiException;\nuse HubSpot\\Client\\Crm\\Contacts\\ApiException as ContactApiException;\nuse HubSpot\\Client\\Crm\\Companies\\ApiException as CompanyApiException;\nuse HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations as ContactsWithAssociations;\nuse HubSpot\\Client\\Crm\\Companies\\Model\\SimplePublicObjectWithAssociations as CompaniesWithAssociations;\nuse HubSpot\\Client\\Crm\\Deals\\Model\\SimplePublicObjectWithAssociations as DealWithAssociations;\nuse HubSpot\\Client\\Crm\\Objects\\Model\\SimplePublicObjectInput;\nuse HubSpot\\Client\\Crm\\Objects\\Model\\SimplePublicObjectWithAssociations as ObjectWithAssociations;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\Error;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\PipelineStage;\nuse HubSpot\\Client\\Crm\\Properties\\Model\\Property;\nuse HubSpot\\Discovery\\Discovery;\nuse Jiminny\\Exceptions\\CrmException;\nuse Jiminny\\Exceptions\\RateLimitException;\nuse Jiminny\\Exceptions\\SocialAccountTokenInvalidException;\nuse Jiminny\\Jobs\\Crm\\NoteObject;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Services\\Crm\\BaseClient;\nuse Jiminny\\Services\\Crm\\Hubspot\\DTO\\Response\\Owner;\nuse Jiminny\\Services\\SocialAccountService;\nuse SevenShores\\Hubspot\\Exceptions\\BadRequest;\nuse SevenShores\\Hubspot\\Exceptions\\HubspotException;\nuse SevenShores\\Hubspot\\Factory;\nuse SevenShores\\Hubspot\\Http\\Response;\nuse Jiminny\\Services\\Crm\\Hubspot\\Pagination\\HubspotPaginationService;\nuse Throwable;\n\n/**\n * @phpstan-type CrmFieldOption array{id:string, label:string, value?:string}\n */\nclass Client extends BaseClient implements HubspotClientInterface\n{\n public const string MIN_API_VERSION = '2';\n\n public const string BASE_URL = 'https://api.hubapi.com';\n\n public const int ASSOCIATIONS_BATCH_SIZE_LIMIT = 1000;\n\n private HubspotPaginationService $paginationService;\n private HubspotTokenManager $tokenManager;\n\n public function __construct(\n SocialAccountService $socialAccountService,\n HubspotPaginationService $paginationService,\n HubspotTokenManager $tokenManager,\n ) {\n parent::__construct($socialAccountService);\n $this->paginationService = $paginationService;\n $this->tokenManager = $tokenManager;\n\n $this->setBaseUrl(self::BASE_URL);\n $this->setVersion(self::MIN_API_VERSION);\n }\n\n /**\n * Reacts to a rate limits (429) from HubSpot by translating it\n * into a RateLimitException carrying retry_after.\n *\n * Wrap any outbound HubSpot call (SDK or raw HTTP) like:\n *\n * $this->executeRequest(fn () => $this->getNewInstance()->crm()->...);\n *\n * @template T\n * @param callable(): T $apiCall\n * @return T\n *\n * @throws RateLimitException\n */\n private function executeRequest(callable $apiCall)\n {\n try {\n return $apiCall();\n } catch (Throwable $e) {\n if ($this->isHubspotRateLimit($e)) {\n $retryAfter = $this->parseRetryAfter($e);\n\n $this->log->warning('[Hubspot] Received 429 from API', [\n 'team_id' => $this->config->team_id,\n 'config_id' => $this->config->getId(),\n 'retry_after' => $retryAfter,\n 'reason' => $e->getMessage(),\n ]);\n\n throw new RateLimitException('Hubspot returned 429', $retryAfter, $e);\n }\n\n throw $e;\n }\n }\n\n public function isHubspotRateLimit(Throwable $e): bool\n {\n if ($e instanceof BadRequest\n || $e instanceof DealApiException\n || $e instanceof ContactApiException\n || $e instanceof CompanyApiException\n || $e instanceof \\GuzzleHttp\\Exception\\RequestException\n ) {\n return (int) $e->getCode() === 429;\n }\n\n return false;\n }\n\n public function parseRetryAfter(Throwable $e): int\n {\n // First try to get Retry-After from response headers\n if (method_exists($e, 'getResponseHeaders')) {\n $headers = $e->getResponseHeaders() ?: [];\n $value = $headers['Retry-After'] ?? $headers['retry-after'] ?? null;\n if (is_array($value)) {\n $value = $value[0] ?? null;\n }\n if (is_numeric($value)) {\n return (int) $value;\n }\n }\n\n if (method_exists($e, 'getResponseBody')) {\n $body = $e->getResponseBody();\n if (is_string($body)) {\n $body = json_decode($body, true) ?? [];\n }\n\n $policyName = $body['policyName'] ?? $body['policy'] ?? $body['context']['policyName'] ?? null;\n\n if ($policyName === 'TEN_SECONDLY_ROLLING' || $policyName === 'ten_secondly_rolling') {\n return 10;\n }\n if ($policyName === 'SECONDLY' || $policyName === 'secondly') {\n return 1;\n }\n }\n\n $this->log->warning('[Hubspot] No retry-after header or policy name found, using default', [\n 'exception_class' => get_class($e),\n ]);\n\n return 10;\n }\n\n public function getMinimumApiVersion(): string\n {\n return self::MIN_API_VERSION;\n }\n\n public function getInstance(): Factory\n {\n return new Factory([\n 'key' => $this->accessToken,\n 'oauth2' => true,\n 'base_url' => $this->baseUrl,\n ]);\n }\n\n public function getNewInstance(): Discovery\n {\n return \\HubSpot\\Factory::createWithAccessToken($this->accessToken);\n }\n\n /**\n * Secondly and daily limits for Hubspot API\n *\n * Product Tier: Free & Starter | Professional & Enterprise | API add-on (any tier)\n * Burst: 100/10 seconds | 150/10 seconds | 200/10 seconds\n * Daily: 250,000 | 500,000 | 1,000,000\n *\n * Official documentation states: The search endpoints are rate limited to five requests per second.\n * Since with 5 RPS were still hitting secondly rate limits we lowered it to 4\n */\n public function getPaginatedData(array $payload, string $type, int $offset = 0): array\n {\n $total = 0;\n $lastId = null;\n $rows = [];\n foreach ($this->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastId) as $row) {\n $rows[] = $row;\n }\n\n return ['results' => $rows, 'total' => $total, 'last_record' => $lastId];\n }\n\n /**\n * @throws HubspotException\n * @throws SocialAccountTokenInvalidException\n * @throws BadRequest\n */\n public function getPaginatedDataGenerator(\n array $payload,\n string $type,\n int $offset = 0,\n int &$total = 0,\n ?string &$lastRecordId = null\n ): \\Generator {\n return $this->paginationService->getPaginatedDataGenerator(\n $this,\n $payload,\n $type,\n $offset,\n $total,\n $lastRecordId\n );\n }\n\n /**\n * Execute a search request against HubSpot CRM objects with rate limiting.\n *\n * @param string $objectType The object type ('deals', 'companies', 'contacts', 'calls')\n * @param array<string, mixed> $payload The search payload with filters, sorts, properties, etc.\n * @return array The search response with 'results', 'total', 'paging' keys\n * @throws RateLimitException When rate limit is hit\n * @throws HubspotException On API errors\n */\n public function search(string $objectType, array $payload): array\n {\n $endpoint = self::BASE_URL . \"/crm/v3/objects/{$objectType}/search\";\n\n return $this->executeRequest(function () use ($endpoint, $payload) {\n $response = $this->getInstance()->getClient()->request('POST', $endpoint, ['json' => $payload]);\n\n return $response->toArray();\n });\n }\n\n /**\n * @throws DealApiException\n * @throws CrmException\n */\n public function getOpportunityById(string $crmId, array $fields): array\n {\n try {\n// $deal = $this->executeRequest(fn () => $this->getNewInstance()->crm()->deals()->basicApi()->getById(\n $deal = $this->getNewInstance()->crm()->deals()->basicApi()->getById(\n $crmId,\n implode(',', $fields),\n 'companies,contacts'\n );\n } catch (DealApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch opportunity', [\n 'crm_id' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n\n if (! $deal instanceof DealWithAssociations) {\n throw new CrmException('Deal not found');\n }\n\n return [\n 'id' => $deal->getId(),\n 'properties' => $deal->getProperties(),\n 'associations' => $deal->getAssociations(),\n ];\n }\n\n /**\n * Generic batch read method for HubSpot objects\n *\n * @param string $objectType The object type ('deals', 'companies', 'contacts')\n * @param array<string> $crmIds Array of HubSpot object IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with object data\n */\n private function batchReadObjects(string $objectType, array $crmIds, array $fields): array\n {\n if (empty($crmIds)) {\n return [];\n }\n\n $this->validateBatchSize($objectType, $crmIds);\n $this->ensureValidToken();\n\n try {\n $batchConfig = $this->createBatchConfiguration($objectType);\n $batchReadRequest = $this->prepareBatchRequest($batchConfig, $crmIds, $fields);\n $response = $batchConfig['api']->read($batchReadRequest);\n\n $this->validateApiResponse($response, $objectType);\n\n $results = $this->processApiResults($response);\n $this->logBatchResults($objectType, $crmIds, $results);\n\n return $results;\n } catch (\\Throwable $e) {\n $this->handleBatchError($e, $objectType, $crmIds);\n }\n }\n\n private function validateBatchSize(string $objectType, array $crmIds): void\n {\n if (count($crmIds) > 100) {\n throw new \\InvalidArgumentException(\"Batch size cannot exceed 100 {$objectType}\");\n }\n }\n\n private function createBatchConfiguration(string $objectType): array\n {\n $configurations = [\n 'deals' => [\n 'batchReadRequest' => new \\HubSpot\\Client\\Crm\\Deals\\Model\\BatchReadInputSimplePublicObjectId(),\n 'inputClass' => \\HubSpot\\Client\\Crm\\Deals\\Model\\SimplePublicObjectId::class,\n 'api' => $this->getNewInstance()->crm()->deals()->batchApi(),\n ],\n 'companies' => [\n 'batchReadRequest' => new \\HubSpot\\Client\\Crm\\Companies\\Model\\BatchReadInputSimplePublicObjectId(),\n 'inputClass' => \\HubSpot\\Client\\Crm\\Companies\\Model\\SimplePublicObjectId::class,\n 'api' => $this->getNewInstance()->crm()->companies()->batchApi(),\n ],\n 'contacts' => [\n 'batchReadRequest' => new \\HubSpot\\Client\\Crm\\Contacts\\Model\\BatchReadInputSimplePublicObjectId(),\n 'inputClass' => \\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectId::class,\n 'api' => $this->getNewInstance()->crm()->contacts()->batchApi(),\n ],\n ];\n\n if (! isset($configurations[$objectType])) {\n throw new \\InvalidArgumentException(\"Unsupported object type: {$objectType}\");\n }\n\n return $configurations[$objectType];\n }\n\n private function prepareBatchRequest(array $batchConfig, array $crmIds, array $fields): object\n {\n $batchReadRequest = $batchConfig['batchReadRequest'];\n $inputClass = $batchConfig['inputClass'];\n\n $inputs = array_map(function ($crmId) use ($inputClass) {\n $input = new $inputClass();\n $input->setId($crmId);\n\n return $input;\n }, $crmIds);\n\n $batchReadRequest->setInputs($inputs);\n $batchReadRequest->setProperties($fields);\n\n return $batchReadRequest;\n }\n\n private function validateApiResponse($response, string $objectType): void\n {\n if (! $response) {\n throw new CrmException(\"HubSpot API returned null response for {$objectType} batch read\");\n }\n }\n\n private function processApiResults($response): array\n {\n $results = [];\n $responseResults = $response->getResults();\n\n if ($responseResults) {\n foreach ($responseResults as $object) {\n if ($object && $object->getId()) {\n $results[$object->getId()] = [\n 'id' => $object->getId(),\n 'properties' => $object->getProperties() ?: [],\n ];\n }\n }\n }\n\n return $results;\n }\n\n private function logBatchResults(string $objectType, array $crmIds, array $results): void\n {\n $this->log->info(\"[HubSpot] Batch fetched {$objectType}\", [\n 'requested_count' => count($crmIds),\n 'returned_count' => count($results),\n 'crm_ids' => $crmIds,\n ]);\n }\n\n private function handleBatchError(\\Throwable $e, string $objectType, array $crmIds): void\n {\n $errorMessage = $e->getMessage() ?: 'Unknown error';\n $errorTrace = $e->getTraceAsString() ?: 'No trace available';\n\n $this->log->error(\"[HubSpot] Failed to batch fetch {$objectType}\", [\n 'crm_ids' => $crmIds,\n 'error' => $errorMessage,\n 'trace' => $errorTrace,\n ]);\n\n throw new CrmException(\"Failed to batch fetch {$objectType}: \" . $errorMessage);\n }\n\n /**\n * Batch read multiple opportunities by their CRM IDs\n *\n * @param array<string> $crmIds Array of HubSpot deal IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with opportunity data\n */\n public function getOpportunitiesByIds(array $crmIds, array $fields): array\n {\n return $this->batchReadObjects('deals', $crmIds, $fields);\n }\n\n /**\n * Batch read multiple companies by their CRM IDs\n *\n * @param array<string> $crmIds Array of HubSpot company IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with company data\n */\n public function getCompaniesByIds(array $crmIds, array $fields): array\n {\n return $this->batchReadObjects('companies', $crmIds, $fields);\n }\n\n /**\n * Batch read multiple contacts by their CRM IDs\n *\n * @param array<string> $crmIds Array of HubSpot contact IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with contact data\n */\n public function getContactsByIds(array $crmIds, array $fields): array\n {\n return $this->batchReadObjects('contacts', $crmIds, $fields);\n }\n\n /**\n * @throws CompanyApiException\n * @throws CrmException\n */\n public function getAccountById(string $crmId, array $fields): array\n {\n try {\n $company = $this->getNewInstance()->crm()->companies()->basicApi()->getById(\n $crmId,\n implode(',', $fields),\n );\n } catch (CompanyApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch account', [\n 'crm_id' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n\n if (! $company instanceof CompaniesWithAssociations) {\n throw new CrmException('Account not found');\n }\n\n return [\n 'id' => $company->getId(),\n 'properties' => $company->getProperties(),\n ];\n }\n\n /**\n * @throws ContactApiException\n * @throws CrmException\n */\n public function getContactById(string $crmId, array $fields): array\n {\n try {\n $contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(\n $crmId,\n implode(',', $fields)\n );\n } catch (ContactApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch contact', [\n 'crm_id' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n\n if (! $contact instanceof ContactsWithAssociations) {\n throw new CrmException('Contact not found');\n }\n\n return [\n 'id' => $contact->getId(),\n 'properties' => $contact->getProperties(),\n ];\n }\n\n /**\n * This is email search request that Hubspot offers as GET (more generous quota)\n */\n public function getContactByEmail(string $email, array $fields = []): array\n {\n try {\n $contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(\n $email,\n implode(',', $fields),\n null,\n false,\n 'email'\n );\n\n return [\n 'id' => $contact->getId(),\n 'properties' => $contact->getProperties(),\n ];\n } catch (ContactApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch contact', [\n 'email' => $email,\n 'reason' => $e->getMessage(),\n ]);\n\n return [];\n }\n }\n\n /**\n * @throws CrmException\n */\n public function fetchProperty(string $objectType, string $propertyId): Property\n {\n $result = $this->getNewInstance()->crm()->properties()->coreApi()->getByName($objectType, $propertyId);\n\n if (! $result instanceof Property) {\n $this->log->error('[Hubspot] Failed to fetch property', [\n 'object_type' => $objectType,\n 'property_id' => $propertyId,\n 'reason' => $result->getMessage(),\n ]);\n\n throw new CrmException('Failed to fetch property');\n }\n\n return $result;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchPropertyOptions(string $objectType, string $propertyId): array\n {\n /** @var array<CrmFieldOption> */\n return $this->fetchProperty($objectType, $propertyId)->getOptions();\n }\n\n /**\n * @return array<array{id:string, label:string, deleted:bool}>\n */\n public function fetchCallDispositions(): array\n {\n /** @var Response $response */\n $response = $this->getInstance()->engagements()->getCallDispositions();\n\n /**\n * @var array<array{\n * id:string,\n * label:string,\n * deleted: bool\n * }>\n */\n return $response->toArray();\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchOpportunityPipelineStages(): array\n {\n $stages = [];\n $apiResponse = $this->getNewInstance()->crm()->pipelines()->pipelinesApi()->getAll('deals');\n\n if ($apiResponse instanceof Error) {\n $this->log->error('[Hubspot] Failed to fetch opportunity pipelines', [\n 'reason' => $apiResponse->getMessage(),\n ]);\n\n return [];\n }\n\n foreach ($apiResponse->getResults() as $pipeline) {\n $pipelineStages = array_map(\n static function (PipelineStage $stage) {\n return [\n 'id' => $stage->getId(),\n 'label' => $stage->getLabel(),\n ];\n },\n $pipeline->getStages()\n );\n\n $stages = array_merge($stages, $pipelineStages);\n }\n\n return $stages;\n }\n\n public function fetchOpportunityPipelines(): array\n {\n $pipelines = [];\n\n try {\n $apiResponse = $this->makeRequest('/crm/v3/pipelines/deals');\n } catch (\\Exception $e) {\n $this->log->info('[Hubspot] Failed to fetch opportunity pipelines', [\n 'reason' => $e->getMessage(),\n ]);\n\n return [];\n }\n\n $response = $apiResponse->toArray();\n\n foreach ($response['results'] as $pipeline) {\n $pipelines[] = [\n 'id' => $pipeline['id'],\n 'label' => $pipeline['label'],\n ];\n }\n\n return $pipelines;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchMeetingOutcomeFieldOptions(Field $field): array\n {\n return $field->getCrmProviderId() === 'meetingOutcome'\n ? $this->fetchMeetingOutcomeTypes()\n : $this->fetchCallActivityTypes();\n }\n\n public function fetchMeetingOutcomeTypes(): array\n {\n return $this->extractMeetingTypeOptions(\n 'https://api.hubapi.com/crm/v3/properties/meeting/hs_meeting_outcome'\n );\n }\n\n public function fetchCallActivityTypes(): array\n {\n return $this->extractMeetingTypeOptions(\n 'https://api.hubapi.com/crm/v3/properties/call/hs_activity_type'\n );\n }\n\n private function extractMeetingTypeOptions(string $endpoint): array\n {\n /** @var Response $response */\n $response = $this->getInstance()\n ->getClient()\n ->request('GET', $endpoint);\n\n /**\n * @var array<array{\n * value: string,\n * label: string,\n * displayOrder: int\n * }> $optionData\n */\n $optionData = $response->toArray()['options'] ?? [];\n\n $options = [];\n foreach ($optionData as $item) {\n $options[] = [\n 'id' => $item['value'],\n 'value' => $item['value'],\n 'label' => $item['label'],\n 'display_order' => $item['displayOrder'],\n ];\n }\n\n return $options;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchDispositionFieldOptions(): array\n {\n $options = [];\n\n $dispositions = $this->fetchCallDispositions();\n\n foreach ($dispositions as $disposition) {\n if ($disposition['deleted'] !== false) {\n continue;\n }\n\n $option['value'] = $disposition['id'];\n $option['id'] = $disposition['id'];\n $option['label'] = $disposition['label'];\n\n $options[] = $option;\n }\n\n return $options;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchOpportunityFieldOptions(Field $field): array\n {\n if ($field->isStageField()) {\n return $this->fetchOpportunityPipelineStages();\n }\n\n if ($field->isPipelineField()) {\n return $this->fetchOpportunityPipelines();\n }\n\n return $this->fetchPropertyOptions('deals', $field->getCrmProviderId());\n }\n\n /**\n * @throws BadRequest\n * @throws HubspotException\n */\n public function makeRequest(string $endpoint, $method = 'GET', $payload = [], ?string $queryString = null)\n {\n $endpoint = self::BASE_URL . $endpoint;\n\n if ($method === 'GET') {\n $response = $this->getInstance()->getClient()?->request(\n method: $method,\n endpoint: $endpoint,\n query_string: $queryString\n );\n } else {\n $response = $this->getInstance()->getClient()->request($method, $endpoint, [\n 'json' => ($payload),\n ]);\n }\n//\n// $max = $response->getHeaderLine('X-HubSpot-RateLimit-Max'); // \"110\"\n// $remaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'); // \"109\"\n// $interval = $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // \"10000\"\n// $body = json_decode((string) $response->getBody(), true);\n//\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$max ' . PHP_EOL . print_r($max, true));\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$remaining ' . PHP_EOL . print_r($remaining, true));\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$interval ' . PHP_EOL . print_r($interval, true));\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$body ' . PHP_EOL . print_r($body, true));\n\n return $response;\n }\n\n /**\n * @throws BadRequest\n * @throws HubspotException\n */\n public function createMeeting(array $payload): Response\n {\n $endpoint = '/crm/v3/objects/meetings';\n\n return $this->makeRequest($endpoint, 'POST', $payload);\n }\n\n /**\n * @throws BadRequest\n * @throws HubspotException\n */\n public function updateMeeting(string $meetingId, array $payload): Response\n {\n $endpoint = '/crm/v3/objects/meetings/' . $meetingId;\n\n return $this->makeRequest($endpoint, 'PATCH', $payload);\n }\n\n /**\n * @throws \\Exception\n */\n public function createNote(\n string $body,\n string $ownerId,\n int $timestamp,\n string $objectId,\n NoteObject $noteObject\n ): ?string {\n try {\n $noteInput = new SimplePublicObjectInput([\n 'properties' => [\n 'hs_note_body' => $body,\n 'hubspot_owner_id' => $ownerId,\n 'hs_timestamp' => $timestamp,\n ],\n ]);\n\n // Create note\n $note = $this->getNewInstance()->crm()->objects()->basicApi()->create('note', $noteInput);\n\n $this->getNewInstance()->crm()->objects()->associationsApi()->create(\n 'note',\n $note->getId(),\n $this->getNoteObject($noteObject),\n $objectId,\n $this->getNoteAssociationType($noteObject),\n );\n\n return $note->getId();\n } catch (\\Exception $e) {\n $this->log->error('[Hubspot] Failed to create note', [\n 'objectId' => $objectId,\n 'noteObject' => $noteObject->getObjectType(),\n 'reason' => $e->getMessage(),\n ]);\n\n \\Sentry::captureException($e);\n }\n\n return null;\n }\n\n public function updateEngagement(string $objectId, array $engagement, array $metadata): void\n {\n $this->getInstance()->engagements()->update($objectId, $engagement, $metadata);\n }\n\n public function getEngagementData(string $engagementId): array\n {\n $engagement = $this->getInstance()->engagements()->get($engagementId);\n\n return $engagement->toArray();\n }\n\n public function createEngagement(array $engagement, array $associations, array $metadata): Response\n {\n return $this->getInstance()\n ->engagements()\n ->create($engagement, $associations, $metadata);\n }\n\n public function isUnauthorizedException(\\Exception $e): bool\n {\n if ($e instanceof BadRequest\n || $e instanceof DealApiException\n || $e instanceof ContactApiException\n || $e instanceof CompanyApiException\n ) {\n return (int) $e->getCode() === 401;\n }\n\n if ($e instanceof \\GuzzleHttp\\Exception\\RequestException && $e->hasResponse()) {\n return $e->getResponse()?->getStatusCode() === 401;\n }\n\n $message = strtolower($e->getMessage());\n\n return str_contains($message, '401 unauthorized') ||\n str_contains($message, 'http 401') ||\n str_contains($message, 'status code 401') ||\n (preg_match('/\\b401\\b/', $message) === 1 && str_contains($message, 'unauthorized'));\n }\n\n /**\n * Validates and refreshes the access token if needed before API requests.\n * This ensures long-running processes don't fail due to token expiration.\n *\n * @throws SocialAccountTokenInvalidException\n */\n public function ensureValidToken(): void\n {\n if ($this->oauthAccount === null) {\n return;\n }\n\n $newToken = $this->tokenManager->ensureValidToken($this->oauthAccount);\n if ($newToken !== null) {\n $this->accessToken = $newToken;\n }\n }\n\n public function getConfig()\n {\n return $this->config;\n }\n\n // returns only active (archived=false)\n public function getOwners(): array\n {\n return $this->getNewInstance()->crm()->owners()->getAll();\n }\n\n /**\n * @param bool $archived\n *\n * @return array<Owner>|[]\n */\n public function getOwnersArchived(bool $archived = true): array\n {\n $endpoint = '/crm/v3/owners';\n $queryParams = [\n 'archived' => $archived ? 'true' : 'false',\n ];\n $queryString = http_build_query($queryParams);\n\n $owners = [];\n\n try {\n $response = $this->makeRequest(endpoint: $endpoint, queryString: $queryString);\n $responseData = $response?->toArray();\n\n foreach ($responseData['results'] as $result) {\n try {\n $owners[] = Owner::create($result);\n } catch (Throwable $e) {\n $this->log->error('[HubSpot] Failed to process owner data', [\n 'result' => $result,\n 'error' => $e->getMessage(),\n ]);\n\n continue;\n }\n }\n } catch (Throwable $e) {\n $this->log->error('HubSpot] Failed to fetch owners', [\n 'archived' => $archived,\n 'error' => $e->getMessage(),\n ]);\n\n return [];\n }\n\n return $owners;\n }\n\n public function getMeeting(string $engagementId): ObjectWithAssociations\n {\n return $this->getNewInstance()->crm()->objects()->basicApi()\n ->getById('meeting', $engagementId, null, 'contact,company,deal');\n }\n\n public function deleteEngagement(string $engagementId): void\n {\n $this->getInstance()->engagements()->delete((int) $engagementId);\n }\n\n public function getAssociationsData(array $ids, string $fromObject, string $toObject): array\n {\n $associationData = [];\n $idChunks = array_chunk($ids, self::ASSOCIATIONS_BATCH_SIZE_LIMIT);\n\n foreach ($idChunks as $idChunk) {\n try {\n $batchInput = new \\HubSpot\\Client\\Crm\\Associations\\Model\\BatchInputPublicObjectId();\n $batchInput->setInputs(array_map(function ($id) {\n $publicObjectId = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicObjectId();\n $publicObjectId->setId($id);\n\n return $publicObjectId;\n }, $idChunk));\n\n $associatedObjectsData = $this\n ->getNewInstance()\n ->crm()\n ->associations()\n ->batchApi()\n ->read($fromObject, $toObject, $batchInput);\n\n if ($associatedObjectsData instanceof \\HubSpot\\Client\\Crm\\Associations\\Model\\BatchResponsePublicAssociationMulti) {\n foreach ($associatedObjectsData->getResults() as $association) {\n $from = $association->getFrom()->getId();\n $toAssociations = $association->getTo();\n\n if (! empty($toAssociations)) {\n $associationData[$from] = array_map(function ($item) {\n return $item->getId();\n }, $toAssociations);\n }\n }\n }\n } catch (RateLimitException $e) {\n throw $e;\n } catch (\\Exception $e) {\n $this->log->error('[Hubspot] Failed to fetch associations', [\n 'from_object' => $fromObject,\n 'to_object' => $toObject,\n 'reason' => $e->getMessage(),\n ]);\n }\n }\n\n return $associationData;\n }\n\n /**\n * @throws \\Exception\n */\n private function getNoteAssociationType(NoteObject $noteObject): string\n {\n return match($noteObject) {\n NoteObject::Opportunity => 'note_to_deal',\n NoteObject::Lead, NoteObject::Contact => 'note_to_contact', // or 'note_to_lead' if your portal supports it\n NoteObject::Account => 'note_to_company',\n NoteObject::Call, NoteObject::Event => throw new \\Exception('Not supported'),\n };\n }\n\n /**\n * @throws \\Exception\n */\n private function getNoteObject(NoteObject $noteObject): string\n {\n return match($noteObject) {\n NoteObject::Opportunity => 'deal',\n NoteObject::Lead, NoteObject::Contact => 'contact',\n NoteObject::Account => 'company',\n NoteObject::Call, NoteObject::Event => throw new \\Exception('Not supported'),\n };\n }\n\n public function addAssociations(string $objectType, string $associationType, array $payload): Response\n {\n $endpoint = \"/crm/v4/associations/$objectType/$associationType/batch/create\";\n\n return $this->makeRequest($endpoint, 'POST', $payload);\n }\n\n public function removeAssociations(string $objectType, string $associationType, array $payload): Response\n {\n $endpoint = \"/crm/v4/associations/$objectType/$associationType/batch/archive\";\n\n return $this->makeRequest($endpoint, 'POST', $payload);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Hubspot;\n\nuse HubSpot\\Client\\Crm\\Deals\\ApiException as DealApiException;\nuse HubSpot\\Client\\Crm\\Contacts\\ApiException as ContactApiException;\nuse HubSpot\\Client\\Crm\\Companies\\ApiException as CompanyApiException;\nuse HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations as ContactsWithAssociations;\nuse HubSpot\\Client\\Crm\\Companies\\Model\\SimplePublicObjectWithAssociations as CompaniesWithAssociations;\nuse HubSpot\\Client\\Crm\\Deals\\Model\\SimplePublicObjectWithAssociations as DealWithAssociations;\nuse HubSpot\\Client\\Crm\\Objects\\Model\\SimplePublicObjectInput;\nuse HubSpot\\Client\\Crm\\Objects\\Model\\SimplePublicObjectWithAssociations as ObjectWithAssociations;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\Error;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\PipelineStage;\nuse HubSpot\\Client\\Crm\\Properties\\Model\\Property;\nuse HubSpot\\Discovery\\Discovery;\nuse Jiminny\\Exceptions\\CrmException;\nuse Jiminny\\Exceptions\\RateLimitException;\nuse Jiminny\\Exceptions\\SocialAccountTokenInvalidException;\nuse Jiminny\\Jobs\\Crm\\NoteObject;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Services\\Crm\\BaseClient;\nuse Jiminny\\Services\\Crm\\Hubspot\\DTO\\Response\\Owner;\nuse Jiminny\\Services\\SocialAccountService;\nuse SevenShores\\Hubspot\\Exceptions\\BadRequest;\nuse SevenShores\\Hubspot\\Exceptions\\HubspotException;\nuse SevenShores\\Hubspot\\Factory;\nuse SevenShores\\Hubspot\\Http\\Response;\nuse Jiminny\\Services\\Crm\\Hubspot\\Pagination\\HubspotPaginationService;\nuse Throwable;\n\n/**\n * @phpstan-type CrmFieldOption array{id:string, label:string, value?:string}\n */\nclass Client extends BaseClient implements HubspotClientInterface\n{\n public const string MIN_API_VERSION = '2';\n\n public const string BASE_URL = 'https://api.hubapi.com';\n\n public const int ASSOCIATIONS_BATCH_SIZE_LIMIT = 1000;\n\n private HubspotPaginationService $paginationService;\n private HubspotTokenManager $tokenManager;\n\n public function __construct(\n SocialAccountService $socialAccountService,\n HubspotPaginationService $paginationService,\n HubspotTokenManager $tokenManager,\n ) {\n parent::__construct($socialAccountService);\n $this->paginationService = $paginationService;\n $this->tokenManager = $tokenManager;\n\n $this->setBaseUrl(self::BASE_URL);\n $this->setVersion(self::MIN_API_VERSION);\n }\n\n /**\n * Reacts to a rate limits (429) from HubSpot by translating it\n * into a RateLimitException carrying retry_after.\n *\n * Wrap any outbound HubSpot call (SDK or raw HTTP) like:\n *\n * $this->executeRequest(fn () => $this->getNewInstance()->crm()->...);\n *\n * @template T\n * @param callable(): T $apiCall\n * @return T\n *\n * @throws RateLimitException\n */\n private function executeRequest(callable $apiCall)\n {\n try {\n return $apiCall();\n } catch (Throwable $e) {\n if ($this->isHubspotRateLimit($e)) {\n $retryAfter = $this->parseRetryAfter($e);\n\n $this->log->warning('[Hubspot] Received 429 from API', [\n 'team_id' => $this->config->team_id,\n 'config_id' => $this->config->getId(),\n 'retry_after' => $retryAfter,\n 'reason' => $e->getMessage(),\n ]);\n\n throw new RateLimitException('Hubspot returned 429', $retryAfter, $e);\n }\n\n throw $e;\n }\n }\n\n public function isHubspotRateLimit(Throwable $e): bool\n {\n if ($e instanceof BadRequest\n || $e instanceof DealApiException\n || $e instanceof ContactApiException\n || $e instanceof CompanyApiException\n || $e instanceof \\GuzzleHttp\\Exception\\RequestException\n ) {\n return (int) $e->getCode() === 429;\n }\n\n return false;\n }\n\n public function parseRetryAfter(Throwable $e): int\n {\n // First try to get Retry-After from response headers\n if (method_exists($e, 'getResponseHeaders')) {\n $headers = $e->getResponseHeaders() ?: [];\n $value = $headers['Retry-After'] ?? $headers['retry-after'] ?? null;\n if (is_array($value)) {\n $value = $value[0] ?? null;\n }\n if (is_numeric($value)) {\n return (int) $value;\n }\n }\n\n if (method_exists($e, 'getResponseBody')) {\n $body = $e->getResponseBody();\n if (is_string($body)) {\n $body = json_decode($body, true) ?? [];\n }\n\n $policyName = $body['policyName'] ?? $body['policy'] ?? $body['context']['policyName'] ?? null;\n\n if ($policyName === 'TEN_SECONDLY_ROLLING' || $policyName === 'ten_secondly_rolling') {\n return 10;\n }\n if ($policyName === 'SECONDLY' || $policyName === 'secondly') {\n return 1;\n }\n }\n\n $this->log->warning('[Hubspot] No retry-after header or policy name found, using default', [\n 'exception_class' => get_class($e),\n ]);\n\n return 10;\n }\n\n public function getMinimumApiVersion(): string\n {\n return self::MIN_API_VERSION;\n }\n\n public function getInstance(): Factory\n {\n return new Factory([\n 'key' => $this->accessToken,\n 'oauth2' => true,\n 'base_url' => $this->baseUrl,\n ]);\n }\n\n public function getNewInstance(): Discovery\n {\n return \\HubSpot\\Factory::createWithAccessToken($this->accessToken);\n }\n\n /**\n * Secondly and daily limits for Hubspot API\n *\n * Product Tier: Free & Starter | Professional & Enterprise | API add-on (any tier)\n * Burst: 100/10 seconds | 150/10 seconds | 200/10 seconds\n * Daily: 250,000 | 500,000 | 1,000,000\n *\n * Official documentation states: The search endpoints are rate limited to five requests per second.\n * Since with 5 RPS were still hitting secondly rate limits we lowered it to 4\n */\n public function getPaginatedData(array $payload, string $type, int $offset = 0): array\n {\n $total = 0;\n $lastId = null;\n $rows = [];\n foreach ($this->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastId) as $row) {\n $rows[] = $row;\n }\n\n return ['results' => $rows, 'total' => $total, 'last_record' => $lastId];\n }\n\n /**\n * @throws HubspotException\n * @throws SocialAccountTokenInvalidException\n * @throws BadRequest\n */\n public function getPaginatedDataGenerator(\n array $payload,\n string $type,\n int $offset = 0,\n int &$total = 0,\n ?string &$lastRecordId = null\n ): \\Generator {\n return $this->paginationService->getPaginatedDataGenerator(\n $this,\n $payload,\n $type,\n $offset,\n $total,\n $lastRecordId\n );\n }\n\n /**\n * Execute a search request against HubSpot CRM objects with rate limiting.\n *\n * @param string $objectType The object type ('deals', 'companies', 'contacts', 'calls')\n * @param array<string, mixed> $payload The search payload with filters, sorts, properties, etc.\n * @return array The search response with 'results', 'total', 'paging' keys\n * @throws RateLimitException When rate limit is hit\n * @throws HubspotException On API errors\n */\n public function search(string $objectType, array $payload): array\n {\n $endpoint = self::BASE_URL . \"/crm/v3/objects/{$objectType}/search\";\n\n return $this->executeRequest(function () use ($endpoint, $payload) {\n $response = $this->getInstance()->getClient()->request('POST', $endpoint, ['json' => $payload]);\n\n return $response->toArray();\n });\n }\n\n /**\n * @throws DealApiException\n * @throws CrmException\n */\n public function getOpportunityById(string $crmId, array $fields): array\n {\n try {\n// $deal = $this->executeRequest(fn () => $this->getNewInstance()->crm()->deals()->basicApi()->getById(\n $deal = $this->getNewInstance()->crm()->deals()->basicApi()->getById(\n $crmId,\n implode(',', $fields),\n 'companies,contacts'\n );\n } catch (DealApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch opportunity', [\n 'crm_id' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n\n if (! $deal instanceof DealWithAssociations) {\n throw new CrmException('Deal not found');\n }\n\n return [\n 'id' => $deal->getId(),\n 'properties' => $deal->getProperties(),\n 'associations' => $deal->getAssociations(),\n ];\n }\n\n /**\n * Generic batch read method for HubSpot objects\n *\n * @param string $objectType The object type ('deals', 'companies', 'contacts')\n * @param array<string> $crmIds Array of HubSpot object IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with object data\n */\n private function batchReadObjects(string $objectType, array $crmIds, array $fields): array\n {\n if (empty($crmIds)) {\n return [];\n }\n\n $this->validateBatchSize($objectType, $crmIds);\n $this->ensureValidToken();\n\n try {\n $batchConfig = $this->createBatchConfiguration($objectType);\n $batchReadRequest = $this->prepareBatchRequest($batchConfig, $crmIds, $fields);\n $response = $batchConfig['api']->read($batchReadRequest);\n\n $this->validateApiResponse($response, $objectType);\n\n $results = $this->processApiResults($response);\n $this->logBatchResults($objectType, $crmIds, $results);\n\n return $results;\n } catch (\\Throwable $e) {\n $this->handleBatchError($e, $objectType, $crmIds);\n }\n }\n\n private function validateBatchSize(string $objectType, array $crmIds): void\n {\n if (count($crmIds) > 100) {\n throw new \\InvalidArgumentException(\"Batch size cannot exceed 100 {$objectType}\");\n }\n }\n\n private function createBatchConfiguration(string $objectType): array\n {\n $configurations = [\n 'deals' => [\n 'batchReadRequest' => new \\HubSpot\\Client\\Crm\\Deals\\Model\\BatchReadInputSimplePublicObjectId(),\n 'inputClass' => \\HubSpot\\Client\\Crm\\Deals\\Model\\SimplePublicObjectId::class,\n 'api' => $this->getNewInstance()->crm()->deals()->batchApi(),\n ],\n 'companies' => [\n 'batchReadRequest' => new \\HubSpot\\Client\\Crm\\Companies\\Model\\BatchReadInputSimplePublicObjectId(),\n 'inputClass' => \\HubSpot\\Client\\Crm\\Companies\\Model\\SimplePublicObjectId::class,\n 'api' => $this->getNewInstance()->crm()->companies()->batchApi(),\n ],\n 'contacts' => [\n 'batchReadRequest' => new \\HubSpot\\Client\\Crm\\Contacts\\Model\\BatchReadInputSimplePublicObjectId(),\n 'inputClass' => \\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectId::class,\n 'api' => $this->getNewInstance()->crm()->contacts()->batchApi(),\n ],\n ];\n\n if (! isset($configurations[$objectType])) {\n throw new \\InvalidArgumentException(\"Unsupported object type: {$objectType}\");\n }\n\n return $configurations[$objectType];\n }\n\n private function prepareBatchRequest(array $batchConfig, array $crmIds, array $fields): object\n {\n $batchReadRequest = $batchConfig['batchReadRequest'];\n $inputClass = $batchConfig['inputClass'];\n\n $inputs = array_map(function ($crmId) use ($inputClass) {\n $input = new $inputClass();\n $input->setId($crmId);\n\n return $input;\n }, $crmIds);\n\n $batchReadRequest->setInputs($inputs);\n $batchReadRequest->setProperties($fields);\n\n return $batchReadRequest;\n }\n\n private function validateApiResponse($response, string $objectType): void\n {\n if (! $response) {\n throw new CrmException(\"HubSpot API returned null response for {$objectType} batch read\");\n }\n }\n\n private function processApiResults($response): array\n {\n $results = [];\n $responseResults = $response->getResults();\n\n if ($responseResults) {\n foreach ($responseResults as $object) {\n if ($object && $object->getId()) {\n $results[$object->getId()] = [\n 'id' => $object->getId(),\n 'properties' => $object->getProperties() ?: [],\n ];\n }\n }\n }\n\n return $results;\n }\n\n private function logBatchResults(string $objectType, array $crmIds, array $results): void\n {\n $this->log->info(\"[HubSpot] Batch fetched {$objectType}\", [\n 'requested_count' => count($crmIds),\n 'returned_count' => count($results),\n 'crm_ids' => $crmIds,\n ]);\n }\n\n private function handleBatchError(\\Throwable $e, string $objectType, array $crmIds): void\n {\n $errorMessage = $e->getMessage() ?: 'Unknown error';\n $errorTrace = $e->getTraceAsString() ?: 'No trace available';\n\n $this->log->error(\"[HubSpot] Failed to batch fetch {$objectType}\", [\n 'crm_ids' => $crmIds,\n 'error' => $errorMessage,\n 'trace' => $errorTrace,\n ]);\n\n throw new CrmException(\"Failed to batch fetch {$objectType}: \" . $errorMessage);\n }\n\n /**\n * Batch read multiple opportunities by their CRM IDs\n *\n * @param array<string> $crmIds Array of HubSpot deal IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with opportunity data\n */\n public function getOpportunitiesByIds(array $crmIds, array $fields): array\n {\n return $this->batchReadObjects('deals', $crmIds, $fields);\n }\n\n /**\n * Batch read multiple companies by their CRM IDs\n *\n * @param array<string> $crmIds Array of HubSpot company IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with company data\n */\n public function getCompaniesByIds(array $crmIds, array $fields): array\n {\n return $this->batchReadObjects('companies', $crmIds, $fields);\n }\n\n /**\n * Batch read multiple contacts by their CRM IDs\n *\n * @param array<string> $crmIds Array of HubSpot contact IDs (max 100)\n * @param array<string> $fields Array of property names to fetch\n *\n * @return array<string, array> Array keyed by CRM ID with contact data\n */\n public function getContactsByIds(array $crmIds, array $fields): array\n {\n return $this->batchReadObjects('contacts', $crmIds, $fields);\n }\n\n /**\n * @throws CompanyApiException\n * @throws CrmException\n */\n public function getAccountById(string $crmId, array $fields): array\n {\n try {\n $company = $this->getNewInstance()->crm()->companies()->basicApi()->getById(\n $crmId,\n implode(',', $fields),\n );\n } catch (CompanyApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch account', [\n 'crm_id' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n\n if (! $company instanceof CompaniesWithAssociations) {\n throw new CrmException('Account not found');\n }\n\n return [\n 'id' => $company->getId(),\n 'properties' => $company->getProperties(),\n ];\n }\n\n /**\n * @throws ContactApiException\n * @throws CrmException\n */\n public function getContactById(string $crmId, array $fields): array\n {\n try {\n $contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(\n $crmId,\n implode(',', $fields)\n );\n } catch (ContactApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch contact', [\n 'crm_id' => $crmId,\n 'reason' => $e->getMessage(),\n ]);\n\n throw $e;\n }\n\n if (! $contact instanceof ContactsWithAssociations) {\n throw new CrmException('Contact not found');\n }\n\n return [\n 'id' => $contact->getId(),\n 'properties' => $contact->getProperties(),\n ];\n }\n\n /**\n * This is email search request that Hubspot offers as GET (more generous quota)\n */\n public function getContactByEmail(string $email, array $fields = []): array\n {\n try {\n $contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(\n $email,\n implode(',', $fields),\n null,\n false,\n 'email'\n );\n\n return [\n 'id' => $contact->getId(),\n 'properties' => $contact->getProperties(),\n ];\n } catch (ContactApiException $e) {\n $this->log->info('[Hubspot] Failed to fetch contact', [\n 'email' => $email,\n 'reason' => $e->getMessage(),\n ]);\n\n return [];\n }\n }\n\n /**\n * @throws CrmException\n */\n public function fetchProperty(string $objectType, string $propertyId): Property\n {\n $result = $this->getNewInstance()->crm()->properties()->coreApi()->getByName($objectType, $propertyId);\n\n if (! $result instanceof Property) {\n $this->log->error('[Hubspot] Failed to fetch property', [\n 'object_type' => $objectType,\n 'property_id' => $propertyId,\n 'reason' => $result->getMessage(),\n ]);\n\n throw new CrmException('Failed to fetch property');\n }\n\n return $result;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchPropertyOptions(string $objectType, string $propertyId): array\n {\n /** @var array<CrmFieldOption> */\n return $this->fetchProperty($objectType, $propertyId)->getOptions();\n }\n\n /**\n * @return array<array{id:string, label:string, deleted:bool}>\n */\n public function fetchCallDispositions(): array\n {\n /** @var Response $response */\n $response = $this->getInstance()->engagements()->getCallDispositions();\n\n /**\n * @var array<array{\n * id:string,\n * label:string,\n * deleted: bool\n * }>\n */\n return $response->toArray();\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchOpportunityPipelineStages(): array\n {\n $stages = [];\n $apiResponse = $this->getNewInstance()->crm()->pipelines()->pipelinesApi()->getAll('deals');\n\n if ($apiResponse instanceof Error) {\n $this->log->error('[Hubspot] Failed to fetch opportunity pipelines', [\n 'reason' => $apiResponse->getMessage(),\n ]);\n\n return [];\n }\n\n foreach ($apiResponse->getResults() as $pipeline) {\n $pipelineStages = array_map(\n static function (PipelineStage $stage) {\n return [\n 'id' => $stage->getId(),\n 'label' => $stage->getLabel(),\n ];\n },\n $pipeline->getStages()\n );\n\n $stages = array_merge($stages, $pipelineStages);\n }\n\n return $stages;\n }\n\n public function fetchOpportunityPipelines(): array\n {\n $pipelines = [];\n\n try {\n $apiResponse = $this->makeRequest('/crm/v3/pipelines/deals');\n } catch (\\Exception $e) {\n $this->log->info('[Hubspot] Failed to fetch opportunity pipelines', [\n 'reason' => $e->getMessage(),\n ]);\n\n return [];\n }\n\n $response = $apiResponse->toArray();\n\n foreach ($response['results'] as $pipeline) {\n $pipelines[] = [\n 'id' => $pipeline['id'],\n 'label' => $pipeline['label'],\n ];\n }\n\n return $pipelines;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchMeetingOutcomeFieldOptions(Field $field): array\n {\n return $field->getCrmProviderId() === 'meetingOutcome'\n ? $this->fetchMeetingOutcomeTypes()\n : $this->fetchCallActivityTypes();\n }\n\n public function fetchMeetingOutcomeTypes(): array\n {\n return $this->extractMeetingTypeOptions(\n 'https://api.hubapi.com/crm/v3/properties/meeting/hs_meeting_outcome'\n );\n }\n\n public function fetchCallActivityTypes(): array\n {\n return $this->extractMeetingTypeOptions(\n 'https://api.hubapi.com/crm/v3/properties/call/hs_activity_type'\n );\n }\n\n private function extractMeetingTypeOptions(string $endpoint): array\n {\n /** @var Response $response */\n $response = $this->getInstance()\n ->getClient()\n ->request('GET', $endpoint);\n\n /**\n * @var array<array{\n * value: string,\n * label: string,\n * displayOrder: int\n * }> $optionData\n */\n $optionData = $response->toArray()['options'] ?? [];\n\n $options = [];\n foreach ($optionData as $item) {\n $options[] = [\n 'id' => $item['value'],\n 'value' => $item['value'],\n 'label' => $item['label'],\n 'display_order' => $item['displayOrder'],\n ];\n }\n\n return $options;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchDispositionFieldOptions(): array\n {\n $options = [];\n\n $dispositions = $this->fetchCallDispositions();\n\n foreach ($dispositions as $disposition) {\n if ($disposition['deleted'] !== false) {\n continue;\n }\n\n $option['value'] = $disposition['id'];\n $option['id'] = $disposition['id'];\n $option['label'] = $disposition['label'];\n\n $options[] = $option;\n }\n\n return $options;\n }\n\n /**\n * @return array<CrmFieldOption>\n */\n public function fetchOpportunityFieldOptions(Field $field): array\n {\n if ($field->isStageField()) {\n return $this->fetchOpportunityPipelineStages();\n }\n\n if ($field->isPipelineField()) {\n return $this->fetchOpportunityPipelines();\n }\n\n return $this->fetchPropertyOptions('deals', $field->getCrmProviderId());\n }\n\n /**\n * @throws BadRequest\n * @throws HubspotException\n */\n public function makeRequest(string $endpoint, $method = 'GET', $payload = [], ?string $queryString = null)\n {\n $endpoint = self::BASE_URL . $endpoint;\n\n if ($method === 'GET') {\n $response = $this->getInstance()->getClient()?->request(\n method: $method,\n endpoint: $endpoint,\n query_string: $queryString\n );\n } else {\n $response = $this->getInstance()->getClient()->request($method, $endpoint, [\n 'json' => ($payload),\n ]);\n }\n//\n// $max = $response->getHeaderLine('X-HubSpot-RateLimit-Max'); // \"110\"\n// $remaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'); // \"109\"\n// $interval = $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // \"10000\"\n// $body = json_decode((string) $response->getBody(), true);\n//\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$max ' . PHP_EOL . print_r($max, true));\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$remaining ' . PHP_EOL . print_r($remaining, true));\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$interval ' . PHP_EOL . print_r($interval, true));\n// \\Illuminate\\Support\\Facades\\Log::channel('custom_channel')->info('$body ' . PHP_EOL . print_r($body, true));\n\n return $response;\n }\n\n /**\n * @throws BadRequest\n * @throws HubspotException\n */\n public function createMeeting(array $payload): Response\n {\n $endpoint = '/crm/v3/objects/meetings';\n\n return $this->makeRequest($endpoint, 'POST', $payload);\n }\n\n /**\n * @throws BadRequest\n * @throws HubspotException\n */\n public function updateMeeting(string $meetingId, array $payload): Response\n {\n $endpoint = '/crm/v3/objects/meetings/' . $meetingId;\n\n return $this->makeRequest($endpoint, 'PATCH', $payload);\n }\n\n /**\n * @throws \\Exception\n */\n public function createNote(\n string $body,\n string $ownerId,\n int $timestamp,\n string $objectId,\n NoteObject $noteObject\n ): ?string {\n try {\n $noteInput = new SimplePublicObjectInput([\n 'properties' => [\n 'hs_note_body' => $body,\n 'hubspot_owner_id' => $ownerId,\n 'hs_timestamp' => $timestamp,\n ],\n ]);\n\n // Create note\n $note = $this->getNewInstance()->crm()->objects()->basicApi()->create('note', $noteInput);\n\n $this->getNewInstance()->crm()->objects()->associationsApi()->create(\n 'note',\n $note->getId(),\n $this->getNoteObject($noteObject),\n $objectId,\n $this->getNoteAssociationType($noteObject),\n );\n\n return $note->getId();\n } catch (\\Exception $e) {\n $this->log->error('[Hubspot] Failed to create note', [\n 'objectId' => $objectId,\n 'noteObject' => $noteObject->getObjectType(),\n 'reason' => $e->getMessage(),\n ]);\n\n \\Sentry::captureException($e);\n }\n\n return null;\n }\n\n public function updateEngagement(string $objectId, array $engagement, array $metadata): void\n {\n $this->getInstance()->engagements()->update($objectId, $engagement, $metadata);\n }\n\n public function getEngagementData(string $engagementId): array\n {\n $engagement = $this->getInstance()->engagements()->get($engagementId);\n\n return $engagement->toArray();\n }\n\n public function createEngagement(array $engagement, array $associations, array $metadata): Response\n {\n return $this->getInstance()\n ->engagements()\n ->create($engagement, $associations, $metadata);\n }\n\n public function isUnauthorizedException(\\Exception $e): bool\n {\n if ($e instanceof BadRequest\n || $e instanceof DealApiException\n || $e instanceof ContactApiException\n || $e instanceof CompanyApiException\n ) {\n return (int) $e->getCode() === 401;\n }\n\n if ($e instanceof \\GuzzleHttp\\Exception\\RequestException && $e->hasResponse()) {\n return $e->getResponse()?->getStatusCode() === 401;\n }\n\n $message = strtolower($e->getMessage());\n\n return str_contains($message, '401 unauthorized') ||\n str_contains($message, 'http 401') ||\n str_contains($message, 'status code 401') ||\n (preg_match('/\\b401\\b/', $message) === 1 && str_contains($message, 'unauthorized'));\n }\n\n /**\n * Validates and refreshes the access token if needed before API requests.\n * This ensures long-running processes don't fail due to token expiration.\n *\n * @throws SocialAccountTokenInvalidException\n */\n public function ensureValidToken(): void\n {\n if ($this->oauthAccount === null) {\n return;\n }\n\n $newToken = $this->tokenManager->ensureValidToken($this->oauthAccount);\n if ($newToken !== null) {\n $this->accessToken = $newToken;\n }\n }\n\n public function getConfig()\n {\n return $this->config;\n }\n\n // returns only active (archived=false)\n public function getOwners(): array\n {\n return $this->getNewInstance()->crm()->owners()->getAll();\n }\n\n /**\n * @param bool $archived\n *\n * @return array<Owner>|[]\n */\n public function getOwnersArchived(bool $archived = true): array\n {\n $endpoint = '/crm/v3/owners';\n $queryParams = [\n 'archived' => $archived ? 'true' : 'false',\n ];\n $queryString = http_build_query($queryParams);\n\n $owners = [];\n\n try {\n $response = $this->makeRequest(endpoint: $endpoint, queryString: $queryString);\n $responseData = $response?->toArray();\n\n foreach ($responseData['results'] as $result) {\n try {\n $owners[] = Owner::create($result);\n } catch (Throwable $e) {\n $this->log->error('[HubSpot] Failed to process owner data', [\n 'result' => $result,\n 'error' => $e->getMessage(),\n ]);\n\n continue;\n }\n }\n } catch (Throwable $e) {\n $this->log->error('HubSpot] Failed to fetch owners', [\n 'archived' => $archived,\n 'error' => $e->getMessage(),\n ]);\n\n return [];\n }\n\n return $owners;\n }\n\n public function getMeeting(string $engagementId): ObjectWithAssociations\n {\n return $this->getNewInstance()->crm()->objects()->basicApi()\n ->getById('meeting', $engagementId, null, 'contact,company,deal');\n }\n\n public function deleteEngagement(string $engagementId): void\n {\n $this->getInstance()->engagements()->delete((int) $engagementId);\n }\n\n public function getAssociationsData(array $ids, string $fromObject, string $toObject): array\n {\n $associationData = [];\n $idChunks = array_chunk($ids, self::ASSOCIATIONS_BATCH_SIZE_LIMIT);\n\n foreach ($idChunks as $idChunk) {\n try {\n $batchInput = new \\HubSpot\\Client\\Crm\\Associations\\Model\\BatchInputPublicObjectId();\n $batchInput->setInputs(array_map(function ($id) {\n $publicObjectId = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicObjectId();\n $publicObjectId->setId($id);\n\n return $publicObjectId;\n }, $idChunk));\n\n $associatedObjectsData = $this\n ->getNewInstance()\n ->crm()\n ->associations()\n ->batchApi()\n ->read($fromObject, $toObject, $batchInput);\n\n if ($associatedObjectsData instanceof \\HubSpot\\Client\\Crm\\Associations\\Model\\BatchResponsePublicAssociationMulti) {\n foreach ($associatedObjectsData->getResults() as $association) {\n $from = $association->getFrom()->getId();\n $toAssociations = $association->getTo();\n\n if (! empty($toAssociations)) {\n $associationData[$from] = array_map(function ($item) {\n return $item->getId();\n }, $toAssociations);\n }\n }\n }\n } catch (RateLimitException $e) {\n throw $e;\n } catch (\\Exception $e) {\n $this->log->error('[Hubspot] Failed to fetch associations', [\n 'from_object' => $fromObject,\n 'to_object' => $toObject,\n 'reason' => $e->getMessage(),\n ]);\n }\n }\n\n return $associationData;\n }\n\n /**\n * @throws \\Exception\n */\n private function getNoteAssociationType(NoteObject $noteObject): string\n {\n return match($noteObject) {\n NoteObject::Opportunity => 'note_to_deal',\n NoteObject::Lead, NoteObject::Contact => 'note_to_contact', // or 'note_to_lead' if your portal supports it\n NoteObject::Account => 'note_to_company',\n NoteObject::Call, NoteObject::Event => throw new \\Exception('Not supported'),\n };\n }\n\n /**\n * @throws \\Exception\n */\n private function getNoteObject(NoteObject $noteObject): string\n {\n return match($noteObject) {\n NoteObject::Opportunity => 'deal',\n NoteObject::Lead, NoteObject::Contact => 'contact',\n NoteObject::Account => 'company',\n NoteObject::Call, NoteObject::Event => throw new \\Exception('Not supported'),\n };\n }\n\n public function addAssociations(string $objectType, string $associationType, array $payload): Response\n {\n $endpoint = \"/crm/v4/associations/$objectType/$associationType/batch/create\";\n\n return $this->makeRequest($endpoint, 'POST', $payload);\n }\n\n public function removeAssociations(string $objectType, string $associationType, array $payload): Response\n {\n $endpoint = \"/crm/v4/associations/$objectType/$associationType/batch/archive\";\n\n return $this->makeRequest($endpoint, 'POST', $payload);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"19","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {\n\"headers\":{\n\"Date\":[\"Thu,07 May 2026 14:21:15 GMT\"],\n \"Content-Type\":[\"application/json;charset=utf-8\"],\n \"Transfer-Encoding\":[\"chunked\"],\n \"Connection\":[\"keep-alive\"],\n \"CF-Ray\":[\"9f80deb8db60dc3a-SOF\"],\n \"CF-Cache-Status\":[\"DYNAMIC\"],\n \"Strict-Transport-Security\":[\"max-age=31536000; includeSubDomains; preload\"],\n \"Vary\":[\"origin,\n accept-encoding\"],\n \"access-control-allow-credentials\":[\"false\"],\n \"server-timing\":[\"hcid;desc=\\\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\\\",\n cfr;desc=\\\"9f80deb8e7c6dc3a-IAD\\\"\"],\n \"x-content-type-options\":[\"nosniff\"],\n \"x-hubspot-correlation-id\":[\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\"],\n \"Set-Cookie\":[\"__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-1.0.1.1-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,\n 07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None\"],\n \"Report-To\":[\"{\n\\\"endpoints\\\":[{\n\\\"url\\\":\\\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report\\\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\\\"}],\n\\\"group\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"NEL\":[\"{\n\\\"success_fraction\\\":0.01,\n\\\"report_to\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"Server\":[\"cloudflare\"]}} {\n\"correlation_id\":\"95236535-ec98-4541-b92a-adfa73b69eab\",\n\"trace_id\":\"c7ab8365-903f-46d4-9403-0e5b551e3545\"}","depth":4,"on_screen":true,"value":"[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {\n\"headers\":{\n\"Date\":[\"Thu,07 May 2026 14:21:15 GMT\"],\n \"Content-Type\":[\"application/json;charset=utf-8\"],\n \"Transfer-Encoding\":[\"chunked\"],\n \"Connection\":[\"keep-alive\"],\n \"CF-Ray\":[\"9f80deb8db60dc3a-SOF\"],\n \"CF-Cache-Status\":[\"DYNAMIC\"],\n \"Strict-Transport-Security\":[\"max-age=31536000; includeSubDomains; preload\"],\n \"Vary\":[\"origin,\n accept-encoding\"],\n \"access-control-allow-credentials\":[\"false\"],\n \"server-timing\":[\"hcid;desc=\\\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\\\",\n cfr;desc=\\\"9f80deb8e7c6dc3a-IAD\\\"\"],\n \"x-content-type-options\":[\"nosniff\"],\n \"x-hubspot-correlation-id\":[\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\"],\n \"Set-Cookie\":[\"__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-1.0.1.1-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,\n 07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None\"],\n \"Report-To\":[\"{\n\\\"endpoints\\\":[{\n\\\"url\\\":\\\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report\\\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\\\"}],\n\\\"group\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"NEL\":[\"{\n\\\"success_fraction\\\":0.01,\n\\\"report_to\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"Server\":[\"cloudflare\"]}} {\n\"correlation_id\":\"95236535-ec98-4541-b92a-adfa73b69eab\",\n\"trace_id\":\"c7ab8365-903f-46d4-9403-0e5b551e3545\"}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8029868391092864233
|
-2772555094158342042
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
2
64
1
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot;
use HubSpot\Client\Crm\Deals\ApiException as DealApiException;
use HubSpot\Client\Crm\Contacts\ApiException as ContactApiException;
use HubSpot\Client\Crm\Companies\ApiException as CompanyApiException;
use HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations as ContactsWithAssociations;
use HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations as CompaniesWithAssociations;
use HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations as DealWithAssociations;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations as ObjectWithAssociations;
use HubSpot\Client\Crm\Pipelines\Model\Error;
use HubSpot\Client\Crm\Pipelines\Model\PipelineStage;
use HubSpot\Client\Crm\Properties\Model\Property;
use HubSpot\Discovery\Discovery;
use Jiminny\Exceptions\CrmException;
use Jiminny\Exceptions\RateLimitException;
use Jiminny\Exceptions\SocialAccountTokenInvalidException;
use Jiminny\Jobs\Crm\NoteObject;
use Jiminny\Models\Crm\Field;
use Jiminny\Services\Crm\BaseClient;
use Jiminny\Services\Crm\Hubspot\DTO\Response\Owner;
use Jiminny\Services\SocialAccountService;
use SevenShores\Hubspot\Exceptions\BadRequest;
use SevenShores\Hubspot\Exceptions\HubspotException;
use SevenShores\Hubspot\Factory;
use SevenShores\Hubspot\Http\Response;
use Jiminny\Services\Crm\Hubspot\Pagination\HubspotPaginationService;
use Throwable;
/**
* @phpstan-type CrmFieldOption array{id:string, label:string, value?:string}
*/
class Client extends BaseClient implements HubspotClientInterface
{
public const string MIN_API_VERSION = '2';
public const string BASE_URL = '[URL_WITH_CREDENTIALS] T
* @param callable(): T $apiCall
* @return T
*
* @throws RateLimitException
*/
private function executeRequest(callable $apiCall)
{
try {
return $apiCall();
} catch (Throwable $e) {
if ($this->isHubspotRateLimit($e)) {
$retryAfter = $this->parseRetryAfter($e);
$this->log->warning('[Hubspot] Received 429 from API', [
'team_id' => $this->config->team_id,
'config_id' => $this->config->getId(),
'retry_after' => $retryAfter,
'reason' => $e->getMessage(),
]);
throw new RateLimitException('Hubspot returned 429', $retryAfter, $e);
}
throw $e;
}
}
public function isHubspotRateLimit(Throwable $e): bool
{
if ($e instanceof BadRequest
|| $e instanceof DealApiException
|| $e instanceof ContactApiException
|| $e instanceof CompanyApiException
|| $e instanceof \GuzzleHttp\Exception\RequestException
) {
return (int) $e->getCode() === 429;
}
return false;
}
public function parseRetryAfter(Throwable $e): int
{
// First try to get Retry-After from response headers
if (method_exists($e, 'getResponseHeaders')) {
$headers = $e->getResponseHeaders() ?: [];
$value = $headers['Retry-After'] ?? $headers['retry-after'] ?? null;
if (is_array($value)) {
$value = $value[0] ?? null;
}
if (is_numeric($value)) {
return (int) $value;
}
}
if (method_exists($e, 'getResponseBody')) {
$body = $e->getResponseBody();
if (is_string($body)) {
$body = json_decode($body, true) ?? [];
}
$policyName = $body['policyName'] ?? $body['policy'] ?? $body['context']['policyName'] ?? null;
if ($policyName === 'TEN_SECONDLY_ROLLING' || $policyName === 'ten_secondly_rolling') {
return 10;
}
if ($policyName === 'SECONDLY' || $policyName === 'secondly') {
return 1;
}
}
$this->log->warning('[Hubspot] No retry-after header or policy name found, using default', [
'exception_class' => get_class($e),
]);
return 10;
}
public function getMinimumApiVersion(): string
{
return self::MIN_API_VERSION;
}
public function getInstance(): Factory
{
return new Factory([
'key' => $this->accessToken,
'oauth2' => true,
'base_url' => $this->baseUrl,
]);
}
public function getNewInstance(): Discovery
{
return \HubSpot\Factory::createWithAccessToken($this->accessToken);
}
/**
* Secondly and daily limits for Hubspot API
*
* Product Tier: Free & Starter | Professional & Enterprise | API add-on (any tier)
* Burst: 100/10 seconds | 150/10 seconds | 200/10 seconds
* Daily: 250,000 | 500,000 | 1,000,000
*
* Official documentation states: The search endpoints are rate limited to five requests per second.
* Since with 5 RPS were still hitting secondly rate limits we lowered it to 4
*/
public function getPaginatedData(array $payload, string $type, int $offset = 0): array
{
$total = 0;
$lastId = null;
$rows = [];
foreach ($this->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastId) as $row) {
$rows[] = $row;
}
return ['results' => $rows, 'total' => $total, 'last_record' => $lastId];
}
/**
* @throws HubspotException
* @throws SocialAccountTokenInvalidException
* @throws BadRequest
*/
public function getPaginatedDataGenerator(
array $payload,
string $type,
int $offset = 0,
int &$total = 0,
?string &$lastRecordId = null
): \Generator {
return $this->paginationService->getPaginatedDataGenerator(
$this,
$payload,
$type,
$offset,
$total,
$lastRecordId
);
}
/**
* Execute a search request against HubSpot CRM objects with rate limiting.
*
* @param string $objectType The object type ('deals', 'companies', 'contacts', 'calls')
* @param array<string, mixed> $payload The search payload with filters, sorts, properties, etc.
* @return array The search response with 'results', 'total', 'paging' keys
* @throws RateLimitException When rate limit is hit
* @throws HubspotException On API errors
*/
public function search(string $objectType, array $payload): array
{
$endpoint = self::BASE_URL . "/crm/v3/objects/{$objectType}/search";
return $this->executeRequest(function () use ($endpoint, $payload) {
$response = $this->getInstance()->getClient()->request('POST', $endpoint, ['json' => $payload]);
return $response->toArray();
});
}
/**
* @throws DealApiException
* @throws CrmException
*/
public function getOpportunityById(string $crmId, array $fields): array
{
try {
// $deal = $this->executeRequest(fn () => $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$deal = $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$crmId,
implode(',', $fields),
'companies,contacts'
);
} catch (DealApiException $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $deal instanceof DealWithAssociations) {
throw new CrmException('Deal not found');
}
return [
'id' => $deal->getId(),
'properties' => $deal->getProperties(),
'associations' => $deal->getAssociations(),
];
}
/**
* Generic batch read method for HubSpot objects
*
* @param string $objectType The object type ('deals', 'companies', 'contacts')
* @param array<string> $crmIds Array of HubSpot object IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with object data
*/
private function batchReadObjects(string $objectType, array $crmIds, array $fields): array
{
if (empty($crmIds)) {
return [];
}
$this->validateBatchSize($objectType, $crmIds);
$this->ensureValidToken();
try {
$batchConfig = $this->createBatchConfiguration($objectType);
$batchReadRequest = $this->prepareBatchRequest($batchConfig, $crmIds, $fields);
$response = $batchConfig['api']->read($batchReadRequest);
$this->validateApiResponse($response, $objectType);
$results = $this->processApiResults($response);
$this->logBatchResults($objectType, $crmIds, $results);
return $results;
} catch (\Throwable $e) {
$this->handleBatchError($e, $objectType, $crmIds);
}
}
private function validateBatchSize(string $objectType, array $crmIds): void
{
if (count($crmIds) > 100) {
throw new \InvalidArgumentException("Batch size cannot exceed 100 {$objectType}");
}
}
private function createBatchConfiguration(string $objectType): array
{
$configurations = [
'deals' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->deals()->batchApi(),
],
'companies' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->companies()->batchApi(),
],
'contacts' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->contacts()->batchApi(),
],
];
if (! isset($configurations[$objectType])) {
throw new \InvalidArgumentException("Unsupported object type: {$objectType}");
}
return $configurations[$objectType];
}
private function prepareBatchRequest(array $batchConfig, array $crmIds, array $fields): object
{
$batchReadRequest = $batchConfig['batchReadRequest'];
$inputClass = $batchConfig['inputClass'];
$inputs = array_map(function ($crmId) use ($inputClass) {
$input = new $inputClass();
$input->setId($crmId);
return $input;
}, $crmIds);
$batchReadRequest->setInputs($inputs);
$batchReadRequest->setProperties($fields);
return $batchReadRequest;
}
private function validateApiResponse($response, string $objectType): void
{
if (! $response) {
throw new CrmException("HubSpot API returned null response for {$objectType} batch read");
}
}
private function processApiResults($response): array
{
$results = [];
$responseResults = $response->getResults();
if ($responseResults) {
foreach ($responseResults as $object) {
if ($object && $object->getId()) {
$results[$object->getId()] = [
'id' => $object->getId(),
'properties' => $object->getProperties() ?: [],
];
}
}
}
return $results;
}
private function logBatchResults(string $objectType, array $crmIds, array $results): void
{
$this->log->info("[HubSpot] Batch fetched {$objectType}", [
'requested_count' => count($crmIds),
'returned_count' => count($results),
'crm_ids' => $crmIds,
]);
}
private function handleBatchError(\Throwable $e, string $objectType, array $crmIds): void
{
$errorMessage = $e->getMessage() ?: 'Unknown error';
$errorTrace = $e->getTraceAsString() ?: 'No trace available';
$this->log->error("[HubSpot] Failed to batch fetch {$objectType}", [
'crm_ids' => $crmIds,
'error' => $errorMessage,
'trace' => $errorTrace,
]);
throw new CrmException("Failed to batch fetch {$objectType}: " . $errorMessage);
}
/**
* Batch read multiple opportunities by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot deal IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with opportunity data
*/
public function getOpportunitiesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('deals', $crmIds, $fields);
}
/**
* Batch read multiple companies by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot company IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with company data
*/
public function getCompaniesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('companies', $crmIds, $fields);
}
/**
* Batch read multiple contacts by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot contact IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with contact data
*/
public function getContactsByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('contacts', $crmIds, $fields);
}
/**
* @throws CompanyApiException
* @throws CrmException
*/
public function getAccountById(string $crmId, array $fields): array
{
try {
$company = $this->getNewInstance()->crm()->companies()->basicApi()->getById(
$crmId,
implode(',', $fields),
);
} catch (CompanyApiException $e) {
$this->log->info('[Hubspot] Failed to fetch account', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $company instanceof CompaniesWithAssociations) {
throw new CrmException('Account not found');
}
return [
'id' => $company->getId(),
'properties' => $company->getProperties(),
];
}
/**
* @throws ContactApiException
* @throws CrmException
*/
public function getContactById(string $crmId, array $fields): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$crmId,
implode(',', $fields)
);
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $contact instanceof ContactsWithAssociations) {
throw new CrmException('Contact not found');
}
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
}
/**
* This is email search request that Hubspot offers as GET (more generous quota)
*/
public function getContactByEmail(string $email, array $fields = []): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$email,
implode(',', $fields),
null,
false,
'email'
);
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'email' => $email,
'reason' => $e->getMessage(),
]);
return [];
}
}
/**
* @throws CrmException
*/
public function fetchProperty(string $objectType, string $propertyId): Property
{
$result = $this->getNewInstance()->crm()->properties()->coreApi()->getByName($objectType, $propertyId);
if (! $result instanceof Property) {
$this->log->error('[Hubspot] Failed to fetch property', [
'object_type' => $objectType,
'property_id' => $propertyId,
'reason' => $result->getMessage(),
]);
throw new CrmException('Failed to fetch property');
}
return $result;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchPropertyOptions(string $objectType, string $propertyId): array
{
/** @var array<CrmFieldOption> */
return $this->fetchProperty($objectType, $propertyId)->getOptions();
}
/**
* @return array<array{id:string, label:string, deleted:bool}>
*/
public function fetchCallDispositions(): array
{
/** @var Response $response */
$response = $this->getInstance()->engagements()->getCallDispositions();
/**
* @var array<array{
* id:string,
* label:string,
* deleted: bool
* }>
*/
return $response->toArray();
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityPipelineStages(): array
{
$stages = [];
$apiResponse = $this->getNewInstance()->crm()->pipelines()->pipelinesApi()->getAll('deals');
if ($apiResponse instanceof Error) {
$this->log->error('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $apiResponse->getMessage(),
]);
return [];
}
foreach ($apiResponse->getResults() as $pipeline) {
$pipelineStages = array_map(
static function (PipelineStage $stage) {
return [
'id' => $stage->getId(),
'label' => $stage->getLabel(),
];
},
$pipeline->getStages()
);
$stages = array_merge($stages, $pipelineStages);
}
return $stages;
}
public function fetchOpportunityPipelines(): array
{
$pipelines = [];
try {
$apiResponse = $this->makeRequest('/crm/v3/pipelines/deals');
} catch (\Exception $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $e->getMessage(),
]);
return [];
}
$response = $apiResponse->toArray();
foreach ($response['results'] as $pipeline) {
$pipelines[] = [
'id' => $pipeline['id'],
'label' => $pipeline['label'],
];
}
return $pipelines;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchMeetingOutcomeFieldOptions(Field $field): array
{
return $field->getCrmProviderId() === 'meetingOutcome'
? $this->fetchMeetingOutcomeTypes()
: $this->fetchCallActivityTypes();
}
public function fetchMeetingOutcomeTypes(): array
{
return $this->extractMeetingTypeOptions(
'[URL_WITH_CREDENTIALS] Response $response */
$response = $this->getInstance()
->getClient()
->request('GET', $endpoint);
/**
* @var array<array{
* value: string,
* label: string,
* displayOrder: int
* }> $optionData
*/
$optionData = $response->toArray()['options'] ?? [];
$options = [];
foreach ($optionData as $item) {
$options[] = [
'id' => $item['value'],
'value' => $item['value'],
'label' => $item['label'],
'display_order' => $item['displayOrder'],
];
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchDispositionFieldOptions(): array
{
$options = [];
$dispositions = $this->fetchCallDispositions();
foreach ($dispositions as $disposition) {
if ($disposition['deleted'] !== false) {
continue;
}
$option['value'] = $disposition['id'];
$option['id'] = $disposition['id'];
$option['label'] = $disposition['label'];
$options[] = $option;
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityFieldOptions(Field $field): array
{
if ($field->isStageField()) {
return $this->fetchOpportunityPipelineStages();
}
if ($field->isPipelineField()) {
return $this->fetchOpportunityPipelines();
}
return $this->fetchPropertyOptions('deals', $field->getCrmProviderId());
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function makeRequest(string $endpoint, $method = 'GET', $payload = [], ?string $queryString = null)
{
$endpoint = self::BASE_URL . $endpoint;
if ($method === 'GET') {
$response = $this->getInstance()->getClient()?->request(
method: $method,
endpoint: $endpoint,
query_string: $queryString
);
} else {
$response = $this->getInstance()->getClient()->request($method, $endpoint, [
'json' => ($payload),
]);
}
//
// $max = $response->getHeaderLine('X-HubSpot-RateLimit-Max'); // "110"
// $remaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'); // "109"
// $interval = $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // "10000"
// $body = json_decode((string) $response->getBody(), true);
//
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$max ' . PHP_EOL . print_r($max, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$remaining ' . PHP_EOL . print_r($remaining, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$interval ' . PHP_EOL . print_r($interval, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$body ' . PHP_EOL . print_r($body, true));
return $response;
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function createMeeting(array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings';
return $this->makeRequest($endpoint, 'POST', $payload);
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function updateMeeting(string $meetingId, array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings/' . $meetingId;
return $this->makeRequest($endpoint, 'PATCH', $payload);
}
/**
* @throws \Exception
*/
public function createNote(
string $body,
string $ownerId,
int $timestamp,
string $objectId,
NoteObject $noteObject
): ?string {
try {
$noteInput = new SimplePublicObjectInput([
'properties' => [
'hs_note_body' => $body,
'hubspot_owner_id' => $ownerId,
'hs_timestamp' => $timestamp,
],
]);
// Create note
$note = $this->getNewInstance()->crm()->objects()->basicApi()->create('note', $noteInput);
$this->getNewInstance()->crm()->objects()->associationsApi()->create(
'note',
$note->getId(),
$this->getNoteObject($noteObject),
$objectId,
$this->getNoteAssociationType($noteObject),
);
return $note->getId();
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to create note', [
'objectId' => $objectId,
'noteObject' => $noteObject->getObjectType(),
'reason' => $e->getMessage(),
]);
\Sentry::captureException($e);
}
return null;
}
public function updateEngagement(string $objectId, array $engagement, array $metadata): void
{
$this->getInstance()->engagements()->update($objectId, $engagement, $metadata);
}
public function getEngagementData(string $engagementId): array
{
$engagement = $this->getInstance()->engagements()->get($engagementId);
return $engagement->toArray();
}
public function createEngagement(array $engagement, array $associations, array $metadata): Response
{
return $this->getInstance()
->engagements()
->create($engagement, $associations, $metadata);
}
public function isUnauthorizedException(\Exception $e): bool
{
if ($e instanceof BadRequest
|| $e instanceof DealApiException
|| $e instanceof ContactApiException
|| $e instanceof CompanyApiException
) {
return (int) $e->getCode() === 401;
}
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
return $e->getResponse()?->getStatusCode() === 401;
}
$message = strtolower($e->getMessage());
return str_contains($message, '401 unauthorized') ||
str_contains($message, 'http 401') ||
str_contains($message, 'status code 401') ||
(preg_match('/\b401\b/', $message) === 1 && str_contains($message, 'unauthorized'));
}
/**
* Validates and refreshes the access token if needed before API requests.
* This ensures long-running processes don't fail due to token expiration.
*
* @throws SocialAccountTokenInvalidException
*/
public function ensureValidToken(): void
{
if ($this->oauthAccount === null) {
return;
}
$newToken = $this->tokenManager->ensureValidToken($this->oauthAccount);
if ($newToken !== null) {
$this->accessToken = $newToken;
}
}
public function getConfig()
{
return $this->config;
}
// returns only active (archived=false)
public function getOwners(): array
{
return $this->getNewInstance()->crm()->owners()->getAll();
}
/**
* @param bool $archived
*
* @return array<Owner>|[]
*/
public function getOwnersArchived(bool $archived = true): array
{
$endpoint = '/crm/v3/owners';
$queryParams = [
'archived' => $archived ? 'true' : 'false',
];
$queryString = http_build_query($queryParams);
$owners = [];
try {
$response = $this->makeRequest(endpoint: $endpoint, queryString: $queryString);
$responseData = $response?->toArray();
foreach ($responseData['results'] as $result) {
try {
$owners[] = Owner::create($result);
} catch (Throwable $e) {
$this->log->error('[HubSpot] Failed to process owner data', [
'result' => $result,
'error' => $e->getMessage(),
]);
continue;
}
}
} catch (Throwable $e) {
$this->log->error('HubSpot] Failed to fetch owners', [
'archived' => $archived,
'error' => $e->getMessage(),
]);
return [];
}
return $owners;
}
public function getMeeting(string $engagementId): ObjectWithAssociations
{
return $this->getNewInstance()->crm()->objects()->basicApi()
->getById('meeting', $engagementId, null, 'contact,company,deal');
}
public function deleteEngagement(string $engagementId): void
{
$this->getInstance()->engagements()->delete((int) $engagementId);
}
public function getAssociationsData(array $ids, string $fromObject, string $toObject): array
{
$associationData = [];
$idChunks = array_chunk($ids, self::ASSOCIATIONS_BATCH_SIZE_LIMIT);
foreach ($idChunks as $idChunk) {
try {
$batchInput = new \HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId();
$batchInput->setInputs(array_map(function ($id) {
$publicObjectId = new \HubSpot\Client\Crm\Associations\Model\PublicObjectId();
$publicObjectId->setId($id);
return $publicObjectId;
}, $idChunk));
$associatedObjectsData = $this
->getNewInstance()
->crm()
->associations()
->batchApi()
->read($fromObject, $toObject, $batchInput);
if ($associatedObjectsData instanceof \HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti) {
foreach ($associatedObjectsData->getResults() as $association) {
$from = $association->getFrom()->getId();
$toAssociations = $association->getTo();
if (! empty($toAssociations)) {
$associationData[$from] = array_map(function ($item) {
return $item->getId();
}, $toAssociations);
}
}
}
} catch (RateLimitException $e) {
throw $e;
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to fetch associations', [
'from_object' => $fromObject,
'to_object' => $toObject,
'reason' => $e->getMessage(),
]);
}
}
return $associationData;
}
/**
* @throws \Exception
*/
private function getNoteAssociationType(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'note_to_deal',
NoteObject::Lead, NoteObject::Contact => 'note_to_contact', // or 'note_to_lead' if your portal supports it
NoteObject::Account => 'note_to_company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
/**
* @throws \Exception
*/
private function getNoteObject(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'deal',
NoteObject::Lead, NoteObject::Contact => 'contact',
NoteObject::Account => 'company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
public function addAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/create";
return $this->makeRequest($endpoint, 'POST', $payload);
}
public function removeAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/archive";
return $this->makeRequest($endpoint, 'POST', $payload);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
19
Previous Highlighted Error
Next Highlighted Error
[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {
"headers":{
"Date":["Thu,07 May 2026 14:21:15 GMT"],
"Content-Type":["application/json;charset=utf-8"],
"Transfer-Encoding":["chunked"],
"Connection":["keep-alive"],
"CF-Ray":["9f80deb8db60dc3a-SOF"],
"CF-Cache-Status":["DYNAMIC"],
"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],
"Vary":["origin,
accept-encoding"],
"access-control-allow-credentials":["false"],
"server-timing":["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\",
cfr;desc=\"9f80deb8e7c6dc3a-IAD\""],
"x-content-type-options":["nosniff"],
"x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],
"Set-Cookie":["__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-[IP_ADDRESS]-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,
07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None"],
"Report-To":["{
\"endpoints\":[{
\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\"}],
\"group\":\"cf-nel\",
\"max_age\":604800}"],
"NEL":["{
\"success_fraction\":0.01,
\"report_to\":\"cf-nel\",
\"max_age\":604800}"],
"Server":["cloudflare"]}} {
"correlation_id":"95236535-ec98-4541-b92a-adfa73b69eab",
"trace_id":"c7ab8365-903f-46d4-9403-0e5b551e3545"}
Project
Project
New File or Directory…...
|
15127
|
NULL
|
NULL
|
NULL
|
|
10710
|
480
|
14
|
2026-05-08T17:41:20.783531+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-08/1778 /Users/lukas/.screenpipe/data/data/2026-05-08/1778262080783_m2.jpg...
|
Code
|
docker-compose.yml — docker [SSH: nas]
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧ Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧G) - 55 pending changes
55
Run and Debug (⇧⌘D)
Remote Explorer
Extensions (⇧⌘X) - 2 require update
2
Claude Code
Containers
EXPLORER
EXPLORER
Explorer Section: docker [SSH: nas]
Explorer Section: docker [SSH: nas]
DOCKER [SSH: NAS]
adguard
ai-stack
app-db
appflowy
audiobookshelf
auth
certs
db
media
templates
.env
.env.example
docker-compose.yml
README.md
beszel
bitwarden
dawarich
dsk-uploader
flask-app
garmin-connector
gitea
health
health-tracker
homarr
hst
immich
jellyfinht
kavita
libreoffice
linkwarden
location-logger
alembic
app
mcp-server
.env
.env.example
.gitignore
.mcp.json
M
alembic.ini
docker-compose.yml
M
Dockerfile
README.md
M
requirements.txt
M
today_map.html
mariadb
meeting-detector
mindfulmama
n8n
notifier-app
Outline Section
OUTLINE
OUTLINE
Timeline Section
TIMELINE
TIMELINE
docker-compose.yml, Editor Group 1
docker-compose.yml, Editor Group 1
version: "3.9"
services:
postgres:
image: postgres:15-alpine
container_name: location-logger-postgres
environment:
POSTGRES_DB: location_logger
POSTGRES_USER: location_logger
POSTGRES_PASSWORD: [PASSWORD]
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5438:5432"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U location_logger"]
interval: 10s
timeout: 5s
retries: 5
api:
build: .
container_name: location-logger-api
env_file:
- .env
ports:
- "8050:8000"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python - << 'PY'\nimport urllib.request as u\ntry:\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\n import sys\n sys.exit(0 if r.status == 200 else 1)\nexcept Exception:\n import sys\n sys.exit(1)\nPY\n"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
mcp:
build: ./mcp-server
container_name: location-logger-mcp
environment:
API_BASE_URL: http://api:8000
API_USERNAME: ${MCP_API_USERNAME:-}
API_PASSWORD: [PASSWORD]
MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}
OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}
OAUTH_PASSWORD: [PASSWORD]
ports:
- "8052:8080"
restart: unless-stopped
depends_on:
api:
condition: service_healthy
adminer:
image: adminer:latest
container_name: location-logger-adminer
ports:
- "8051:8080"
restart: unless-stopped
depends_on:
- postgres
volumes:
postgres_data:
networks:
default:
version: "3.9"
services:
postgres:
image: postgres:15-alpine
container_name: location-logger-postgres
environment:
POSTGRES_DB: location_logger
POSTGRES_USER: location_logger
POSTGRES_PASSWORD: [PASSWORD]
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5438:5432"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U location_logger"]
interval: 10s
timeout: 5s
retries: 5
api:
build: .
container_name: location-logger-api
env_file:
- .env
ports:
- "8050:8000"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python - << 'PY'\nimport urllib.request as u\ntry:\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\n import sys\n sys.exit(0 if r.status == 200 else 1)\nexcept Exception:\n import sys\n sys.exit(1)\nPY\n"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
mcp:
build: ./mcp-server
container_name: location-logger-mcp
environment:
API_BASE_URL: http://api:8000
API_USERNAME: ${MCP_API_USERNAME:-}
API_PASSWORD: [PASSWORD]
MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}
OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}
OAUTH_PASSWORD: [PASSWORD]
ports:
- "8052:8080"
restart: unless-stopped
depends_on:
api:
condition: service_healthy
adminer:
image: adminer:latest
container_name: location-logger-adminer
ports:
- "8051:8080"
restart: unless-stopped
depends_on:
- postgres
volumes:
postgres_data:
networks:
default:
Hold
⇧
to drop into editor
Review payment logger au…, Editor Group 2
docker-compose.yml, preview, Editor Group 2
services:
postgresql:
image: docker.io/library/postgres:16-alpine
container_name: Authentik-DB
hostname: authentik-db
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}"]
interval: 5s
timeout: 5s
retries: 5
environment:
POSTGRES_PASSWORD: [PASSWORD]
POSTGRES_USER: authentik
POSTGRES_DB: authentik
volumes:
- /volume2/docker/auth/db:/var/lib/postgresql/data
networks:
- authentik_internal
redis:
image: docker.io/library/redis:alpine
container_name: Authentik-REDIS
hostname: authentik-redis
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 5s
timeout: 3s
retries: 5
networks:
- authentik_internal
server:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Server
hostname: authentik-server
restart: unless-stopped
command: server
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
AUTHENTIK_ERROR_REPORTING__ENABLED: "false"
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}
AUTHENTIK_BOOTSTRAP_PASSWORD: [PASSWORD]
ports:
- "9100:9000"
volumes:
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
- proxy
worker:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Worker
hostname: authentik-worker
restart: unless-stopped
command: worker
user: root
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/certs:/certs
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
outpost:
image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}
container_name: Authentik-Outpost
hostname: authentik-outpost
restart: unless-stopped
environment:
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_INSECURE: "false"
AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}
ports:
- "9101:9000"
depends_on:
- server
networks:
- authentik_internal
- proxy
networks:
authentik_internal:
internal: true
proxy:
external: true
services:
postgresql:
image: docker.io/library/postgres:16-alpine
container_name: Authentik-DB
hostname: authentik-db
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}"]
interval: 5s
timeout: 5s
retries: 5
environment:
POSTGRES_PASSWORD: [PASSWORD]
POSTGRES_USER: authentik
POSTGRES_DB: authentik
volumes:
- /volume2/docker/auth/db:/var/lib/postgresql/data
networks:
- authentik_internal
redis:
image: docker.io/library/redis:alpine
container_name: Authentik-REDIS
hostname: authentik-redis
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 5s
timeout: 3s
retries: 5
networks:
- authentik_internal
server:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Server
hostname: authentik-server
restart: unless-stopped
command: server
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
AUTHENTIK_ERROR_REPORTING__ENABLED: "false"
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}
AUTHENTIK_BOOTSTRAP_PASSWORD: [PASSWORD]
ports:
- "9100:9000"
volumes:
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
- proxy
worker:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Worker
hostname: authentik-worker
restart: unless-stopped
command: worker
user: root
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/certs:/certs
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
outpost:
image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}
container_name: Authentik-Outpost
hostname: authentik-outpost
restart: unless-stopped
environment:
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_INSECURE: "false"
AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}
ports:
- "9101:9000"
depends_on:
- server
networks:
- authentik_internal
- proxy
networks:
authentik_internal:
internal: true
proxy:
external: true
Problems (⇧⌘M)
PROBLEMS
Output (⇧⌘U)
OUTPUT
Debug Console (⇧⌘Y)
DEBUG CONSOLE
Terminal (⌃`)
TERMINAL
Ports
PORTS
remote SSH: nas
SSH: nas
location-logger (Git)
location-logger
location-logger (Git) - main*, Checkout Branch/Tag...
main*
location-logger (Git) - Synchronize Changes
No Problems
0
0
No Ports Forwarded
0
Notifications
Sign In
Sign In
Compose
Editor Language Status: $(copilot) No inline suggestion available, Inline suggestions
LF
UTF-8
Spaces: 2
Ln 1, Col 1
expanded
Command Succeeded...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Explorer (⇧⌘E)","depth":19,"bounds":{"left":0.0,"top":0.047885075,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":true},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.057462092,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Search (⇧⌘F)","depth":19,"bounds":{"left":0.0,"top":0.08619314,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.09577015,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Source Control (⌃⇧G) - 55 pending changes","depth":19,"bounds":{"left":0.0,"top":0.1245012,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.13407822,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"55","depth":22,"bounds":{"left":0.0076462766,"top":0.1452514,"width":0.0043218085,"height":0.008778931},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Run and Debug (⇧⌘D)","depth":19,"bounds":{"left":0.0,"top":0.16280925,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.17238627,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Remote Explorer","depth":19,"bounds":{"left":0.0,"top":0.20111732,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.21069433,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Extensions (⇧⌘X) - 2 require update","depth":19,"bounds":{"left":0.0,"top":0.23942538,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"bounds":{"left":0.0039893617,"top":0.2490024,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":22,"bounds":{"left":0.009640957,"top":0.2601756,"width":0.0019946808,"height":0.008778931},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Claude Code","depth":19,"bounds":{"left":0.0,"top":0.27773345,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Containers","depth":19,"bounds":{"left":0.0,"top":0.3160415,"width":0.015957447,"height":0.03830806},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"EXPLORER","depth":17,"bounds":{"left":0.022606382,"top":0.047885075,"width":0.018949468,"height":0.02793296},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"EXPLORER","depth":18,"bounds":{"left":0.022606382,"top":0.056664005,"width":0.018949468,"height":0.0103751},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.022606382,"top":0.056664005,"width":0.0023271276,"height":0.0103751}},{"char_start":1,"char_count":7,"bounds":{"left":0.024933511,"top":0.056664005,"width":0.01662234,"height":0.0103751}}],"role_description":"text"},{"role":"AXButton","text":"Explorer Section: docker [SSH: nas]","depth":21,"bounds":{"left":0.015957447,"top":0.07581804,"width":0.09940159,"height":0.017557861},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"","depth":23,"bounds":{"left":0.01662234,"top":0.07821229,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"Explorer Section: docker [SSH: nas]","depth":22,"bounds":{"left":0.022606382,"top":0.07581804,"width":0.038231384,"height":0.017557861},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"DOCKER [SSH: NAS]","depth":23,"bounds":{"left":0.022606382,"top":0.079010375,"width":0.038231384,"height":0.0103751},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.022606382,"top":0.07980846,"width":0.0029920214,"height":0.0103751}},{"char_start":1,"char_count":16,"bounds":{"left":0.025598405,"top":0.07980846,"width":0.03523936,"height":0.0103751}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.09577015,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"adguard","depth":27,"bounds":{"left":0.025930852,"top":0.09577015,"width":0.01662234,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.096568234,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":6,"bounds":{"left":0.02825798,"top":0.096568234,"width":0.014295213,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.11332801,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"ai-stack","depth":27,"bounds":{"left":0.025930852,"top":0.11332801,"width":0.016289894,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.11412609,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":7,"bounds":{"left":0.02825798,"top":0.11412609,"width":0.013962766,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.13088587,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"app-db","depth":27,"bounds":{"left":0.025930852,"top":0.13088587,"width":0.014960106,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.13168396,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":5,"bounds":{"left":0.02825798,"top":0.13168396,"width":0.012632979,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.14844373,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"appflowy","depth":27,"bounds":{"left":0.025930852,"top":0.14844373,"width":0.018284574,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.14924182,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":7,"bounds":{"left":0.02825798,"top":0.14924182,"width":0.015957447,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.1660016,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"audiobookshelf","depth":27,"bounds":{"left":0.025930852,"top":0.1660016,"width":0.030917553,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.16679968,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":13,"bounds":{"left":0.02825798,"top":0.16679968,"width":0.028590426,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.18355946,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"auth","depth":27,"bounds":{"left":0.025930852,"top":0.18355946,"width":0.008976064,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.18435754,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":3,"bounds":{"left":0.02825798,"top":0.18435754,"width":0.0066489363,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.20111732,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"certs","depth":27,"bounds":{"left":0.028590426,"top":0.20111732,"width":0.010305851,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.2019154,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":4,"bounds":{"left":0.030917553,"top":0.2019154,"width":0.007978723,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.21867518,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"db","depth":27,"bounds":{"left":0.028590426,"top":0.21867518,"width":0.005319149,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.21947326,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":1,"bounds":{"left":0.03125,"top":0.21947326,"width":0.0026595744,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.23623304,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"media","depth":27,"bounds":{"left":0.028590426,"top":0.23623304,"width":0.012300532,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.23703113,"width":0.003656915,"height":0.011971269}},{"char_start":1,"char_count":4,"bounds":{"left":0.032247342,"top":0.23703113,"width":0.008643617,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.25379092,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"templates","depth":27,"bounds":{"left":0.028590426,"top":0.25379092,"width":0.019946808,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.254589,"width":0.0016622341,"height":0.011971269}},{"char_start":1,"char_count":8,"bounds":{"left":0.03025266,"top":0.254589,"width":0.018284574,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.2697526,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".env","depth":27,"bounds":{"left":0.028590426,"top":0.27134877,"width":0.00831117,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.27214685,"width":0.0013297872,"height":0.011971269}},{"char_start":1,"char_count":3,"bounds":{"left":0.029920213,"top":0.27214685,"width":0.006981383,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.28731045,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".env.example","depth":27,"bounds":{"left":0.028590426,"top":0.28890663,"width":0.025930852,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.2897047,"width":0.0013297872,"height":0.011971269}},{"char_start":1,"char_count":11,"bounds":{"left":0.029920213,"top":0.2897047,"width":0.024933511,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.3048683,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"docker-compose.yml","depth":27,"bounds":{"left":0.028590426,"top":0.3064645,"width":0.042220745,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.30726257,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":17,"bounds":{"left":0.03125,"top":0.30726257,"width":0.03956117,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.32242617,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"README.md","depth":27,"bounds":{"left":0.028590426,"top":0.32402235,"width":0.025265958,"height":0.011971269},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.3415802,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"beszel","depth":27,"bounds":{"left":0.025930852,"top":0.3415802,"width":0.012965426,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.3423783,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":5,"bounds":{"left":0.028590426,"top":0.3423783,"width":0.010638298,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.35913807,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"bitwarden","depth":27,"bounds":{"left":0.025930852,"top":0.35913807,"width":0.019946808,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.35993615,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":8,"bounds":{"left":0.028590426,"top":0.35993615,"width":0.017287234,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.37669593,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"dawarich","depth":27,"bounds":{"left":0.025930852,"top":0.37669593,"width":0.017952127,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.377494,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":7,"bounds":{"left":0.028590426,"top":0.377494,"width":0.015625,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.3942538,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"dsk-uploader","depth":27,"bounds":{"left":0.025930852,"top":0.3942538,"width":0.026928192,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.39505187,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":11,"bounds":{"left":0.028590426,"top":0.39505187,"width":0.024268618,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.10605053,"top":0.39505187,"width":0.004654255,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.41181165,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"flask-app","depth":27,"bounds":{"left":0.025930852,"top":0.41181165,"width":0.018949468,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.41260973,"width":0.0016622341,"height":0.011971269}},{"char_start":1,"char_count":8,"bounds":{"left":0.027593086,"top":0.41260973,"width":0.017287234,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.10605053,"top":0.41260973,"width":0.004654255,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.4293695,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"garmin-connector","depth":27,"bounds":{"left":0.025930852,"top":0.4293695,"width":0.036236703,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.4301676,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":15,"bounds":{"left":0.028590426,"top":0.4301676,"width":0.033909574,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.44692737,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"gitea","depth":27,"bounds":{"left":0.025930852,"top":0.44692737,"width":0.009973404,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.44772545,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":4,"bounds":{"left":0.028590426,"top":0.44772545,"width":0.00731383,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.46448523,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"health","depth":27,"bounds":{"left":0.025930852,"top":0.46448523,"width":0.012300532,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.46528333,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":5,"bounds":{"left":0.028590426,"top":0.46528333,"width":0.009973404,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.4820431,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"health-tracker","depth":27,"bounds":{"left":0.025930852,"top":0.4820431,"width":0.028590426,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.4828412,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":13,"bounds":{"left":0.028590426,"top":0.4828412,"width":0.025930852,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.49960095,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"homarr","depth":27,"bounds":{"left":0.025930852,"top":0.49960095,"width":0.014295213,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.50039905,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":5,"bounds":{"left":0.028590426,"top":0.50039905,"width":0.011968086,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.5171588,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"hst","depth":27,"bounds":{"left":0.025930852,"top":0.5171588,"width":0.0063164895,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.5179569,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":2,"bounds":{"left":0.028590426,"top":0.5179569,"width":0.003656915,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.53471667,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"immich","depth":27,"bounds":{"left":0.025930852,"top":0.53471667,"width":0.01462766,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.5355148,"width":0.0009973404,"height":0.011971269}},{"char_start":1,"char_count":5,"bounds":{"left":0.026928192,"top":0.5355148,"width":0.013630319,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.5522745,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"jellyfinht","depth":27,"bounds":{"left":0.025930852,"top":0.5522745,"width":0.016954787,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.55307263,"width":0.0009973404,"height":0.011971269}},{"char_start":1,"char_count":9,"bounds":{"left":0.026928192,"top":0.55307263,"width":0.016289894,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.5698324,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"kavita","depth":27,"bounds":{"left":0.025930852,"top":0.5698324,"width":0.011635638,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.5706305,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":5,"bounds":{"left":0.02825798,"top":0.5706305,"width":0.009640957,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.58739024,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"libreoffice","depth":27,"bounds":{"left":0.025930852,"top":0.58739024,"width":0.020279255,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.58818835,"width":0.0009973404,"height":0.011971269}},{"char_start":1,"char_count":10,"bounds":{"left":0.026928192,"top":0.58818835,"width":0.019281914,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.6049481,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"linkwarden","depth":27,"bounds":{"left":0.025930852,"top":0.6049481,"width":0.021609042,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.6057462,"width":0.0009973404,"height":0.011971269}},{"char_start":1,"char_count":9,"bounds":{"left":0.026928192,"top":0.6057462,"width":0.020611702,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.62250596,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"location-logger","depth":27,"bounds":{"left":0.025930852,"top":0.62250596,"width":0.030917553,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.62330407,"width":0.0009973404,"height":0.011971269}},{"char_start":1,"char_count":14,"bounds":{"left":0.026928192,"top":0.62330407,"width":0.029920213,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.10605053,"top":0.62330407,"width":0.004654255,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.6400638,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"alembic","depth":27,"bounds":{"left":0.028590426,"top":0.6400638,"width":0.015625,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.6408619,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":6,"bounds":{"left":0.030917553,"top":0.6408619,"width":0.013297873,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.10605053,"top":0.6408619,"width":0.004654255,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.6576217,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"app","depth":27,"bounds":{"left":0.028590426,"top":0.6576217,"width":0.0076462766,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.6584198,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":2,"bounds":{"left":0.030917553,"top":0.6584198,"width":0.005319149,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.10605053,"top":0.6584198,"width":0.004654255,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.022273935,"top":0.67517954,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"mcp-server","depth":27,"bounds":{"left":0.028590426,"top":0.67517954,"width":0.023271276,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.67597765,"width":0.003656915,"height":0.011971269}},{"char_start":1,"char_count":9,"bounds":{"left":0.032247342,"top":0.67597765,"width":0.019946808,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.69114125,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".env","depth":27,"bounds":{"left":0.028590426,"top":0.6927374,"width":0.00831117,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.6935355,"width":0.0013297872,"height":0.011971269}},{"char_start":1,"char_count":3,"bounds":{"left":0.029920213,"top":0.6935355,"width":0.006981383,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.7086991,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".env.example","depth":27,"bounds":{"left":0.028590426,"top":0.7102953,"width":0.025930852,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.71109337,"width":0.0013297872,"height":0.011971269}},{"char_start":1,"char_count":11,"bounds":{"left":0.029920213,"top":0.71109337,"width":0.024933511,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.72625697,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".gitignore","depth":27,"bounds":{"left":0.028590426,"top":0.7278532,"width":0.018949468,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.7286512,"width":0.0013297872,"height":0.011971269}},{"char_start":1,"char_count":9,"bounds":{"left":0.029920213,"top":0.7286512,"width":0.017952127,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.7438148,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".mcp.json","depth":27,"bounds":{"left":0.028590426,"top":0.74541104,"width":0.019614361,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.7462091,"width":0.0013297872,"height":0.011971269}},{"char_start":1,"char_count":8,"bounds":{"left":0.029920213,"top":0.7462091,"width":0.018284574,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"bounds":{"left":0.10638298,"top":0.7462091,"width":0.003656915,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.7613727,"width":0.0076462766,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"alembic.ini","depth":27,"bounds":{"left":0.028590426,"top":0.7629689,"width":0.021609042,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.76376694,"width":0.0023271276,"height":0.011971269}},{"char_start":1,"char_count":10,"bounds":{"left":0.030917553,"top":0.76376694,"width":0.019281914,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.77893054,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"docker-compose.yml","depth":27,"bounds":{"left":0.028590426,"top":0.78052676,"width":0.042220745,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.7813248,"width":0.0026595744,"height":0.011971269}},{"char_start":1,"char_count":17,"bounds":{"left":0.03125,"top":0.7813248,"width":0.03956117,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"bounds":{"left":0.10638298,"top":0.7813248,"width":0.003656915,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.7964884,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Dockerfile","depth":27,"bounds":{"left":0.028590426,"top":0.7980846,"width":0.020611702,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.79888266,"width":0.0033244682,"height":0.011971269}},{"char_start":1,"char_count":9,"bounds":{"left":0.031914894,"top":0.79888266,"width":0.017287234,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.81404626,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"README.md","depth":27,"bounds":{"left":0.028590426,"top":0.8156425,"width":0.025265958,"height":0.011971269},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"bounds":{"left":0.10638298,"top":0.8164405,"width":0.003656915,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.8316041,"width":0.0076462766,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"requirements.txt","depth":27,"bounds":{"left":0.028590426,"top":0.83320034,"width":0.032912236,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.8339984,"width":0.0016622341,"height":0.011971269}},{"char_start":1,"char_count":15,"bounds":{"left":0.03025266,"top":0.8339984,"width":0.03158245,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"bounds":{"left":0.10638298,"top":0.8339984,"width":0.003656915,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"bounds":{"left":0.021276595,"top":0.849162,"width":0.0063164895,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"today_map.html","depth":27,"bounds":{"left":0.028590426,"top":0.8507582,"width":0.032247342,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.028590426,"top":0.85155624,"width":0.0016622341,"height":0.011971269}},{"char_start":1,"char_count":13,"bounds":{"left":0.03025266,"top":0.85155624,"width":0.030585106,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.86831605,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"mariadb","depth":27,"bounds":{"left":0.025930852,"top":0.86831605,"width":0.016289894,"height":0.011971269},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.025930852,"top":0.8691141,"width":0.003656915,"height":0.011971269}},{"char_start":1,"char_count":6,"bounds":{"left":0.029587766,"top":0.8691141,"width":0.012965426,"height":0.011971269}}],"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.8858739,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"meeting-detector","depth":27,"bounds":{"left":0.025930852,"top":0.8858739,"width":0.03557181,"height":0.011971269},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.9034318,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"mindfulmama","depth":27,"bounds":{"left":0.025930852,"top":0.9034318,"width":0.027260639,"height":0.011971269},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.92098963,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"n8n","depth":27,"bounds":{"left":0.025930852,"top":0.92098963,"width":0.0076462766,"height":0.011971269},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"bounds":{"left":0.019614361,"top":0.9385475,"width":0.005319149,"height":0.008778931},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"notifier-app","depth":27,"bounds":{"left":0.025930852,"top":0.9385475,"width":0.023603724,"height":0.008778931},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Outline Section","depth":21,"bounds":{"left":0.015957447,"top":0.9473264,"width":0.09940159,"height":0.017557861},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"bounds":{"left":0.01662234,"top":0.9497207,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"OUTLINE","depth":22,"bounds":{"left":0.022606382,"top":0.9473264,"width":0.01662234,"height":0.017557861},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"OUTLINE","depth":23,"bounds":{"left":0.022606382,"top":0.95131683,"width":0.01662234,"height":0.0103751},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Timeline Section","depth":21,"bounds":{"left":0.015957447,"top":0.9648843,"width":0.09940159,"height":0.017557861},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"bounds":{"left":0.01662234,"top":0.96727854,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"TIMELINE","depth":22,"bounds":{"left":0.022606382,"top":0.9648843,"width":0.01761968,"height":0.017557861},"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"TIMELINE","depth":23,"bounds":{"left":0.022606382,"top":0.9688747,"width":0.01761968,"height":0.0103751},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"docker-compose.yml, Editor Group 1","depth":28,"bounds":{"left":0.11569149,"top":0.047885075,"width":0.09773936,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXRadioButton","text":"docker-compose.yml, Editor Group 1","depth":28,"bounds":{"left":0.21343085,"top":0.047885075,"width":0.09607713,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":29,"bounds":{"left":0.15159574,"top":0.07821229,"width":0.0056515955,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"version: \"3.9\"\n\nservices:\n postgres:\n image: postgres:15-alpine\n container_name: location-logger-postgres\n environment:\n POSTGRES_DB: location_logger\n POSTGRES_USER: location_logger\n POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-location_logger}\n volumes:\n - postgres_data:/var/lib/postgresql/data\n ports:\n - \"5438:5432\"\n restart: unless-stopped\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -U location_logger\"]\n interval: 10s\n timeout: 5s\n retries: 5\n\n api:\n build: .\n container_name: location-logger-api\n env_file:\n - .env\n ports:\n - \"8050:8000\"\n restart: unless-stopped\n depends_on:\n postgres:\n condition: service_healthy\n healthcheck:\n test: [\"CMD-SHELL\", \"python - << 'PY'\\nimport urllib.request as u\\ntry:\\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\\n import sys\\n sys.exit(0 if r.status == 200 else 1)\\nexcept Exception:\\n import sys\\n sys.exit(1)\\nPY\\n\"]\n interval: 10s\n timeout: 5s\n retries: 5\n start_period: 5s\n\n mcp:\n build: ./mcp-server\n container_name: location-logger-mcp\n environment:\n API_BASE_URL: http://api:8000\n API_USERNAME: ${MCP_API_USERNAME:-}\n API_PASSWORD: ${MCP_API_PASSWORD:-}\n MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}\n OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}\n OAUTH_PASSWORD: ${MCP_OAUTH_PASSWORD:-}\n ports:\n - \"8052:8080\"\n restart: unless-stopped\n depends_on:\n api:\n condition: service_healthy\n\n adminer:\n image: adminer:latest\n container_name: location-logger-adminer\n ports:\n - \"8051:8080\"\n restart: unless-stopped\n depends_on:\n - postgres\n\nvolumes:\n postgres_data:\n\nnetworks:\n default:","depth":28,"bounds":{"left":0.11569149,"top":0.0933759,"width":0.38031915,"height":0.0007980846},"on_screen":true,"value":"version: \"3.9\"\n\nservices:\n postgres:\n image: postgres:15-alpine\n container_name: location-logger-postgres\n environment:\n POSTGRES_DB: location_logger\n POSTGRES_USER: location_logger\n POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-location_logger}\n volumes:\n - postgres_data:/var/lib/postgresql/data\n ports:\n - \"5438:5432\"\n restart: unless-stopped\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -U location_logger\"]\n interval: 10s\n timeout: 5s\n retries: 5\n\n api:\n build: .\n container_name: location-logger-api\n env_file:\n - .env\n ports:\n - \"8050:8000\"\n restart: unless-stopped\n depends_on:\n postgres:\n condition: service_healthy\n healthcheck:\n test: [\"CMD-SHELL\", \"python - << 'PY'\\nimport urllib.request as u\\ntry:\\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\\n import sys\\n sys.exit(0 if r.status == 200 else 1)\\nexcept Exception:\\n import sys\\n sys.exit(1)\\nPY\\n\"]\n interval: 10s\n timeout: 5s\n retries: 5\n start_period: 5s\n\n mcp:\n build: ./mcp-server\n container_name: location-logger-mcp\n environment:\n API_BASE_URL: http://api:8000\n API_USERNAME: ${MCP_API_USERNAME:-}\n API_PASSWORD: ${MCP_API_PASSWORD:-}\n MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}\n OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}\n OAUTH_PASSWORD: ${MCP_OAUTH_PASSWORD:-}\n ports:\n - \"8052:8080\"\n restart: unless-stopped\n depends_on:\n api:\n condition: service_healthy\n\n adminer:\n image: adminer:latest\n container_name: location-logger-adminer\n ports:\n - \"8051:8080\"\n restart: unless-stopped\n depends_on:\n - postgres\n\nvolumes:\n postgres_data:\n\nnetworks:\n default:","role_description":"editor","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"version: \"3.9\"\n\nservices:\n postgres:\n image: postgres:15-alpine\n container_name: location-logger-postgres\n environment:\n POSTGRES_DB: location_logger\n POSTGRES_USER: location_logger\n POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-location_logger}\n volumes:\n - postgres_data:/var/lib/postgresql/data\n ports:\n - \"5438:5432\"\n restart: unless-stopped\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -U location_logger\"]\n interval: 10s\n timeout: 5s\n retries: 5\n\n api:\n build: .\n container_name: location-logger-api\n env_file:\n - .env\n ports:\n - \"8050:8000\"\n restart: unless-stopped\n depends_on:\n postgres:\n condition: service_healthy\n healthcheck:\n test: [\"CMD-SHELL\", \"python - << 'PY'\\nimport urllib.request as u\\ntry:\\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\\n import sys\\n sys.exit(0 if r.status == 200 else 1)\\nexcept Exception:\\n import sys\\n sys.exit(1)\\nPY\\n\"]\n interval: 10s\n timeout: 5s\n retries: 5\n start_period: 5s\n\n mcp:\n build: ./mcp-server\n container_name: location-logger-mcp\n environment:\n API_BASE_URL: http://api:8000\n API_USERNAME: ${MCP_API_USERNAME:-}\n API_PASSWORD: ${MCP_API_PASSWORD:-}\n MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}\n OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}\n OAUTH_PASSWORD: ${MCP_OAUTH_PASSWORD:-}\n ports:\n - \"8052:8080\"\n restart: unless-stopped\n depends_on:\n api:\n condition: service_healthy\n\n adminer:\n image: adminer:latest\n container_name: location-logger-adminer\n ports:\n - \"8051:8080\"\n restart: unless-stopped\n depends_on:\n - postgres\n\nvolumes:\n postgres_data:\n\nnetworks:\n default:","depth":29,"bounds":{"left":0.11569149,"top":0.0933759,"width":0.38031915,"height":0.0007980846},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Hold","depth":28,"bounds":{"left":0.30718085,"top":0.4094174,"width":0.010970744,"height":0.011971269},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"⇧","depth":28,"bounds":{"left":0.32114363,"top":0.4094174,"width":0.0043218085,"height":0.011971269},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"to drop into editor","depth":28,"bounds":{"left":0.3287899,"top":0.4094174,"width":0.03756649,"height":0.011971269},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Review payment logger au…, Editor Group 2","depth":28,"bounds":{"left":0.5578458,"top":0.047885075,"width":0.07679521,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"docker-compose.yml, preview, Editor Group 2","depth":28,"bounds":{"left":0.63464093,"top":0.047885075,"width":0.0631649,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"","depth":29,"bounds":{"left":0.57214093,"top":0.07821229,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"services:\n\n postgresql:\n image: docker.io/library/postgres:16-alpine\n container_name: Authentik-DB\n hostname: authentik-db\n restart: unless-stopped\n security_opt:\n - no-new-privileges:true\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}\"]\n interval: 5s\n timeout: 5s\n retries: 5\n environment:\n POSTGRES_PASSWORD: ${PG_PASS}\n POSTGRES_USER: authentik\n POSTGRES_DB: authentik\n volumes:\n - /volume2/docker/auth/db:/var/lib/postgresql/data\n networks:\n - authentik_internal\n\n redis:\n image: docker.io/library/redis:alpine\n container_name: Authentik-REDIS\n hostname: authentik-redis\n restart: unless-stopped\n security_opt:\n - no-new-privileges:true\n healthcheck:\n test: [\"CMD-SHELL\", \"redis-cli ping | grep PONG\"]\n interval: 5s\n timeout: 3s\n retries: 5\n networks:\n - authentik_internal\n\n server:\n image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}\n container_name: Authentik-Server\n hostname: authentik-server\n restart: unless-stopped\n command: server\n environment:\n AUTHENTIK_REDIS__HOST: authentik-redis\n AUTHENTIK_POSTGRESQL__HOST: authentik-db\n AUTHENTIK_POSTGRESQL__USER: authentik\n AUTHENTIK_POSTGRESQL__NAME: authentik\n AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}\n AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}\n AUTHENTIK_ERROR_REPORTING__ENABLED: \"false\"\n AUTHENTIK_HOST: ${AUTHENTIK_HOST}\n AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}\n AUTHENTIK_BOOTSTRAP_PASSWORD: ${AUTHENTIK_BOOTSTRAP_PASSWORD}\n ports:\n - \"9100:9000\"\n volumes:\n - /volume2/docker/auth/media:/media\n - /volume2/docker/auth/templates:/templates\n depends_on:\n postgresql:\n condition: service_healthy\n redis:\n condition: service_healthy\n networks:\n - authentik_internal\n - proxy\n\n worker:\n image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}\n container_name: Authentik-Worker\n hostname: authentik-worker\n restart: unless-stopped\n command: worker\n user: root\n environment:\n AUTHENTIK_REDIS__HOST: authentik-redis\n AUTHENTIK_POSTGRESQL__HOST: authentik-db\n AUTHENTIK_POSTGRESQL__USER: authentik\n AUTHENTIK_POSTGRESQL__NAME: authentik\n AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}\n AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}\n volumes:\n - /var/run/docker.sock:/var/run/docker.sock\n - /volume2/docker/auth/media:/media\n - /volume2/docker/auth/certs:/certs\n - /volume2/docker/auth/templates:/templates\n depends_on:\n postgresql:\n condition: service_healthy\n redis:\n condition: service_healthy\n networks:\n - authentik_internal\n\n outpost:\n image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}\n container_name: Authentik-Outpost\n hostname: authentik-outpost\n restart: unless-stopped\n environment:\n AUTHENTIK_HOST: ${AUTHENTIK_HOST}\n AUTHENTIK_INSECURE: \"false\"\n AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}\n ports:\n - \"9101:9000\"\n depends_on:\n - server\n networks:\n - authentik_internal\n - proxy\n\nnetworks:\n authentik_internal:\n internal: true\n proxy:\n external: true","depth":28,"bounds":{"left":0.57978725,"top":0.105347164,"width":0.38031915,"height":0.014365523},"on_screen":true,"value":"services:\n\n postgresql:\n image: docker.io/library/postgres:16-alpine\n container_name: Authentik-DB\n hostname: authentik-db\n restart: unless-stopped\n security_opt:\n - no-new-privileges:true\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}\"]\n interval: 5s\n timeout: 5s\n retries: 5\n environment:\n POSTGRES_PASSWORD: ${PG_PASS}\n POSTGRES_USER: authentik\n POSTGRES_DB: authentik\n volumes:\n - /volume2/docker/auth/db:/var/lib/postgresql/data\n networks:\n - authentik_internal\n\n redis:\n image: docker.io/library/redis:alpine\n container_name: Authentik-REDIS\n hostname: authentik-redis\n restart: unless-stopped\n security_opt:\n - no-new-privileges:true\n healthcheck:\n test: [\"CMD-SHELL\", \"redis-cli ping | grep PONG\"]\n interval: 5s\n timeout: 3s\n retries: 5\n networks:\n - authentik_internal\n\n server:\n image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}\n container_name: Authentik-Server\n hostname: authentik-server\n restart: unless-stopped\n command: server\n environment:\n AUTHENTIK_REDIS__HOST: authentik-redis\n AUTHENTIK_POSTGRESQL__HOST: authentik-db\n AUTHENTIK_POSTGRESQL__USER: authentik\n AUTHENTIK_POSTGRESQL__NAME: authentik\n AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}\n AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}\n AUTHENTIK_ERROR_REPORTING__ENABLED: \"false\"\n AUTHENTIK_HOST: ${AUTHENTIK_HOST}\n AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}\n AUTHENTIK_BOOTSTRAP_PASSWORD: ${AUTHENTIK_BOOTSTRAP_PASSWORD}\n ports:\n - \"9100:9000\"\n volumes:\n - /volume2/docker/auth/media:/media\n - /volume2/docker/auth/templates:/templates\n depends_on:\n postgresql:\n condition: service_healthy\n redis:\n condition: service_healthy\n networks:\n - authentik_internal\n - proxy\n\n worker:\n image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}\n container_name: Authentik-Worker\n hostname: authentik-worker\n restart: unless-stopped\n command: worker\n user: root\n environment:\n AUTHENTIK_REDIS__HOST: authentik-redis\n AUTHENTIK_POSTGRESQL__HOST: authentik-db\n AUTHENTIK_POSTGRESQL__USER: authentik\n AUTHENTIK_POSTGRESQL__NAME: authentik\n AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}\n AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}\n volumes:\n - /var/run/docker.sock:/var/run/docker.sock\n - /volume2/docker/auth/media:/media\n - /volume2/docker/auth/certs:/certs\n - /volume2/docker/auth/templates:/templates\n depends_on:\n postgresql:\n condition: service_healthy\n redis:\n condition: service_healthy\n networks:\n - authentik_internal\n\n outpost:\n image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}\n container_name: Authentik-Outpost\n hostname: authentik-outpost\n restart: unless-stopped\n environment:\n AUTHENTIK_HOST: ${AUTHENTIK_HOST}\n AUTHENTIK_INSECURE: \"false\"\n AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}\n ports:\n - \"9101:9000\"\n depends_on:\n - server\n networks:\n - authentik_internal\n - proxy\n\nnetworks:\n authentik_internal:\n internal: true\n proxy:\n external: true","role_description":"editor","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"services:\n\n postgresql:\n image: docker.io/library/postgres:16-alpine\n container_name: Authentik-DB\n hostname: authentik-db\n restart: unless-stopped\n security_opt:\n - no-new-privileges:true\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}\"]\n interval: 5s\n timeout: 5s\n retries: 5\n environment:\n POSTGRES_PASSWORD: ${PG_PASS}\n POSTGRES_USER: authentik\n POSTGRES_DB: authentik\n volumes:\n - /volume2/docker/auth/db:/var/lib/postgresql/data\n networks:\n - authentik_internal\n\n redis:\n image: docker.io/library/redis:alpine\n container_name: Authentik-REDIS\n hostname: authentik-redis\n restart: unless-stopped\n security_opt:\n - no-new-privileges:true\n healthcheck:\n test: [\"CMD-SHELL\", \"redis-cli ping | grep PONG\"]\n interval: 5s\n timeout: 3s\n retries: 5\n networks:\n - authentik_internal\n\n server:\n image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}\n container_name: Authentik-Server\n hostname: authentik-server\n restart: unless-stopped\n command: server\n environment:\n AUTHENTIK_REDIS__HOST: authentik-redis\n AUTHENTIK_POSTGRESQL__HOST: authentik-db\n AUTHENTIK_POSTGRESQL__USER: authentik\n AUTHENTIK_POSTGRESQL__NAME: authentik\n AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}\n AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}\n AUTHENTIK_ERROR_REPORTING__ENABLED: \"false\"\n AUTHENTIK_HOST: ${AUTHENTIK_HOST}\n AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}\n AUTHENTIK_BOOTSTRAP_PASSWORD: ${AUTHENTIK_BOOTSTRAP_PASSWORD}\n ports:\n - \"9100:9000\"\n volumes:\n - /volume2/docker/auth/media:/media\n - /volume2/docker/auth/templates:/templates\n depends_on:\n postgresql:\n condition: service_healthy\n redis:\n condition: service_healthy\n networks:\n - authentik_internal\n - proxy\n\n worker:\n image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}\n container_name: Authentik-Worker\n hostname: authentik-worker\n restart: unless-stopped\n command: worker\n user: root\n environment:\n AUTHENTIK_REDIS__HOST: authentik-redis\n AUTHENTIK_POSTGRESQL__HOST: authentik-db\n AUTHENTIK_POSTGRESQL__USER: authentik\n AUTHENTIK_POSTGRESQL__NAME: authentik\n AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}\n AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}\n volumes:\n - /var/run/docker.sock:/var/run/docker.sock\n - /volume2/docker/auth/media:/media\n - /volume2/docker/auth/certs:/certs\n - /volume2/docker/auth/templates:/templates\n depends_on:\n postgresql:\n condition: service_healthy\n redis:\n condition: service_healthy\n networks:\n - authentik_internal\n\n outpost:\n image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}\n container_name: Authentik-Outpost\n hostname: authentik-outpost\n restart: unless-stopped\n environment:\n AUTHENTIK_HOST: ${AUTHENTIK_HOST}\n AUTHENTIK_INSECURE: \"false\"\n AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}\n ports:\n - \"9101:9000\"\n depends_on:\n - server\n networks:\n - authentik_internal\n - proxy\n\nnetworks:\n authentik_internal:\n internal: true\n proxy:\n external: true","depth":29,"bounds":{"left":0.57978725,"top":0.10694334,"width":0.23803191,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Problems (⇧⌘M)","depth":22,"bounds":{"left":0.118351065,"top":0.7278532,"width":0.027925532,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"PROBLEMS","depth":24,"bounds":{"left":0.122340426,"top":0.7366321,"width":0.019946808,"height":0.0103751},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Output (⇧⌘U)","depth":22,"bounds":{"left":0.14594415,"top":0.7278532,"width":0.023603724,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"OUTPUT","depth":24,"bounds":{"left":0.14993352,"top":0.7366321,"width":0.015625,"height":0.0103751},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Debug Console (⇧⌘Y)","depth":22,"bounds":{"left":0.16921543,"top":0.7278532,"width":0.039893616,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DEBUG CONSOLE","depth":24,"bounds":{"left":0.1732048,"top":0.7366321,"width":0.031914894,"height":0.0103751},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Terminal (⌃`)","depth":22,"bounds":{"left":0.2087766,"top":0.7278532,"width":0.026595745,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":true},{"role":"AXStaticText","text":"TERMINAL","depth":24,"bounds":{"left":0.21276596,"top":0.7366321,"width":0.01861702,"height":0.0103751},"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Ports","depth":22,"bounds":{"left":0.23537233,"top":0.7278532,"width":0.020279255,"height":0.02793296},"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"PORTS","depth":24,"bounds":{"left":0.2393617,"top":0.7366321,"width":0.012300532,"height":0.0103751},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"remote SSH: nas","depth":16,"bounds":{"left":0.0006648936,"top":0.98244214,"width":0.028590426,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"bounds":{"left":0.0033244682,"top":0.9848364,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SSH: nas","depth":17,"bounds":{"left":0.008643617,"top":0.9856345,"width":0.017952127,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"location-logger (Git)","depth":16,"bounds":{"left":0.030917553,"top":0.98244214,"width":0.03756649,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"bounds":{"left":0.031914894,"top":0.9848364,"width":0.005319149,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"location-logger","depth":17,"bounds":{"left":0.03723404,"top":0.9856345,"width":0.03025266,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"location-logger (Git) - main*, Checkout Branch/Tag...","depth":16,"bounds":{"left":0.06815159,"top":0.98244214,"width":0.019614361,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"bounds":{"left":0.069148935,"top":0.9848364,"width":0.0056515955,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"main*","depth":17,"bounds":{"left":0.07446808,"top":0.9856345,"width":0.012300532,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"location-logger (Git) - Synchronize Changes","depth":16,"bounds":{"left":0.08743351,"top":0.98244214,"width":0.0076462766,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"No Problems","depth":16,"bounds":{"left":0.09740692,"top":0.98244214,"width":0.022606382,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"bounds":{"left":0.09906915,"top":0.9848364,"width":0.0056515955,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"bounds":{"left":0.1043883,"top":0.9856345,"width":0.004986702,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":17,"bounds":{"left":0.109042555,"top":0.9848364,"width":0.0056515955,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"bounds":{"left":0.1143617,"top":0.9856345,"width":0.0039893617,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"No Ports Forwarded","depth":16,"bounds":{"left":0.12167553,"top":0.98244214,"width":0.012632979,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"bounds":{"left":0.12333777,"top":0.9848364,"width":0.0056515955,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"bounds":{"left":0.12865691,"top":0.9856345,"width":0.0039893617,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Notifications","depth":16,"bounds":{"left":0.9886968,"top":0.98244214,"width":0.010638298,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sign In","depth":16,"bounds":{"left":0.9650931,"top":0.98244214,"width":0.022606382,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"bounds":{"left":0.96675533,"top":0.9848364,"width":0.0056515955,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sign In","depth":17,"bounds":{"left":0.97207445,"top":0.9856345,"width":0.013962766,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Compose","depth":16,"bounds":{"left":0.9424867,"top":0.98244214,"width":0.020279255,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Editor Language Status: $(copilot) No inline suggestion available, Inline suggestions","depth":16,"bounds":{"left":0.93517286,"top":0.98244214,"width":0.0076462766,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"LF","depth":16,"bounds":{"left":0.92486703,"top":0.98244214,"width":0.007978723,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"UTF-8","depth":16,"bounds":{"left":0.90724736,"top":0.98244214,"width":0.015625,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Spaces: 2","depth":16,"bounds":{"left":0.88331115,"top":0.98244214,"width":0.022273935,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Ln 1, Col 1","depth":16,"bounds":{"left":0.85771275,"top":0.98244214,"width":0.023936171,"height":0.01755786},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"expanded","depth":12,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Command Succeeded","depth":12,"on_screen":false,"role_description":"text"}]...
|
-8028424180562631063
|
4002798401039655210
|
click
|
accessibility
|
NULL
|
Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧ Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧G) - 55 pending changes
55
Run and Debug (⇧⌘D)
Remote Explorer
Extensions (⇧⌘X) - 2 require update
2
Claude Code
Containers
EXPLORER
EXPLORER
Explorer Section: docker [SSH: nas]
Explorer Section: docker [SSH: nas]
DOCKER [SSH: NAS]
adguard
ai-stack
app-db
appflowy
audiobookshelf
auth
certs
db
media
templates
.env
.env.example
docker-compose.yml
README.md
beszel
bitwarden
dawarich
dsk-uploader
flask-app
garmin-connector
gitea
health
health-tracker
homarr
hst
immich
jellyfinht
kavita
libreoffice
linkwarden
location-logger
alembic
app
mcp-server
.env
.env.example
.gitignore
.mcp.json
M
alembic.ini
docker-compose.yml
M
Dockerfile
README.md
M
requirements.txt
M
today_map.html
mariadb
meeting-detector
mindfulmama
n8n
notifier-app
Outline Section
OUTLINE
OUTLINE
Timeline Section
TIMELINE
TIMELINE
docker-compose.yml, Editor Group 1
docker-compose.yml, Editor Group 1
version: "3.9"
services:
postgres:
image: postgres:15-alpine
container_name: location-logger-postgres
environment:
POSTGRES_DB: location_logger
POSTGRES_USER: location_logger
POSTGRES_PASSWORD: [PASSWORD]
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5438:5432"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U location_logger"]
interval: 10s
timeout: 5s
retries: 5
api:
build: .
container_name: location-logger-api
env_file:
- .env
ports:
- "8050:8000"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python - << 'PY'\nimport urllib.request as u\ntry:\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\n import sys\n sys.exit(0 if r.status == 200 else 1)\nexcept Exception:\n import sys\n sys.exit(1)\nPY\n"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
mcp:
build: ./mcp-server
container_name: location-logger-mcp
environment:
API_BASE_URL: http://api:8000
API_USERNAME: ${MCP_API_USERNAME:-}
API_PASSWORD: [PASSWORD]
MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}
OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}
OAUTH_PASSWORD: [PASSWORD]
ports:
- "8052:8080"
restart: unless-stopped
depends_on:
api:
condition: service_healthy
adminer:
image: adminer:latest
container_name: location-logger-adminer
ports:
- "8051:8080"
restart: unless-stopped
depends_on:
- postgres
volumes:
postgres_data:
networks:
default:
version: "3.9"
services:
postgres:
image: postgres:15-alpine
container_name: location-logger-postgres
environment:
POSTGRES_DB: location_logger
POSTGRES_USER: location_logger
POSTGRES_PASSWORD: [PASSWORD]
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5438:5432"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U location_logger"]
interval: 10s
timeout: 5s
retries: 5
api:
build: .
container_name: location-logger-api
env_file:
- .env
ports:
- "8050:8000"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python - << 'PY'\nimport urllib.request as u\ntry:\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\n import sys\n sys.exit(0 if r.status == 200 else 1)\nexcept Exception:\n import sys\n sys.exit(1)\nPY\n"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
mcp:
build: ./mcp-server
container_name: location-logger-mcp
environment:
API_BASE_URL: http://api:8000
API_USERNAME: ${MCP_API_USERNAME:-}
API_PASSWORD: [PASSWORD]
MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}
OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}
OAUTH_PASSWORD: [PASSWORD]
ports:
- "8052:8080"
restart: unless-stopped
depends_on:
api:
condition: service_healthy
adminer:
image: adminer:latest
container_name: location-logger-adminer
ports:
- "8051:8080"
restart: unless-stopped
depends_on:
- postgres
volumes:
postgres_data:
networks:
default:
Hold
⇧
to drop into editor
Review payment logger au…, Editor Group 2
docker-compose.yml, preview, Editor Group 2
services:
postgresql:
image: docker.io/library/postgres:16-alpine
container_name: Authentik-DB
hostname: authentik-db
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}"]
interval: 5s
timeout: 5s
retries: 5
environment:
POSTGRES_PASSWORD: [PASSWORD]
POSTGRES_USER: authentik
POSTGRES_DB: authentik
volumes:
- /volume2/docker/auth/db:/var/lib/postgresql/data
networks:
- authentik_internal
redis:
image: docker.io/library/redis:alpine
container_name: Authentik-REDIS
hostname: authentik-redis
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 5s
timeout: 3s
retries: 5
networks:
- authentik_internal
server:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Server
hostname: authentik-server
restart: unless-stopped
command: server
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
AUTHENTIK_ERROR_REPORTING__ENABLED: "false"
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}
AUTHENTIK_BOOTSTRAP_PASSWORD: [PASSWORD]
ports:
- "9100:9000"
volumes:
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
- proxy
worker:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Worker
hostname: authentik-worker
restart: unless-stopped
command: worker
user: root
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/certs:/certs
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
outpost:
image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}
container_name: Authentik-Outpost
hostname: authentik-outpost
restart: unless-stopped
environment:
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_INSECURE: "false"
AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}
ports:
- "9101:9000"
depends_on:
- server
networks:
- authentik_internal
- proxy
networks:
authentik_internal:
internal: true
proxy:
external: true
services:
postgresql:
image: docker.io/library/postgres:16-alpine
container_name: Authentik-DB
hostname: authentik-db
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}"]
interval: 5s
timeout: 5s
retries: 5
environment:
POSTGRES_PASSWORD: [PASSWORD]
POSTGRES_USER: authentik
POSTGRES_DB: authentik
volumes:
- /volume2/docker/auth/db:/var/lib/postgresql/data
networks:
- authentik_internal
redis:
image: docker.io/library/redis:alpine
container_name: Authentik-REDIS
hostname: authentik-redis
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 5s
timeout: 3s
retries: 5
networks:
- authentik_internal
server:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Server
hostname: authentik-server
restart: unless-stopped
command: server
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
AUTHENTIK_ERROR_REPORTING__ENABLED: "false"
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}
AUTHENTIK_BOOTSTRAP_PASSWORD: [PASSWORD]
ports:
- "9100:9000"
volumes:
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
- proxy
worker:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Worker
hostname: authentik-worker
restart: unless-stopped
command: worker
user: root
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/certs:/certs
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
outpost:
image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}
container_name: Authentik-Outpost
hostname: authentik-outpost
restart: unless-stopped
environment:
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_INSECURE: "false"
AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}
ports:
- "9101:9000"
depends_on:
- server
networks:
- authentik_internal
- proxy
networks:
authentik_internal:
internal: true
proxy:
external: true
Problems (⇧⌘M)
PROBLEMS
Output (⇧⌘U)
OUTPUT
Debug Console (⇧⌘Y)
DEBUG CONSOLE
Terminal (⌃`)
TERMINAL
Ports
PORTS
remote SSH: nas
SSH: nas
location-logger (Git)
location-logger
location-logger (Git) - main*, Checkout Branch/Tag...
main*
location-logger (Git) - Synchronize Changes
No Problems
0
0
No Ports Forwarded
0
Notifications
Sign In
Sign In
Compose
Editor Language Status: $(copilot) No inline suggestion available, Inline suggestions
LF
UTF-8
Spaces: 2
Ln 1, Col 1
expanded
Command Succeeded...
|
10709
|
NULL
|
NULL
|
NULL
|
|
10711
|
479
|
13
|
2026-05-08T17:41:20.783534+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-08/1778 /Users/lukas/.screenpipe/data/data/2026-05-08/1778262080783_m1.jpg...
|
Code
|
docker-compose.yml — docker [SSH: nas]
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧ Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧G) - 55 pending changes
55
Run and Debug (⇧⌘D)
Remote Explorer
Extensions (⇧⌘X) - 2 require update
2
Claude Code
Containers
EXPLORER
EXPLORER
Explorer Section: docker [SSH: nas]
Explorer Section: docker [SSH: nas]
DOCKER [SSH: NAS]
adguard
ai-stack
app-db
appflowy
audiobookshelf
auth
certs
db
media
templates
.env
.env.example
docker-compose.yml
README.md
beszel
bitwarden
dawarich
dsk-uploader
flask-app
garmin-connector
gitea
health
health-tracker
homarr
hst
immich
jellyfinht
kavita
libreoffice
linkwarden
location-logger
alembic
app
mcp-server
.env
.env.example
.gitignore
.mcp.json
M
alembic.ini
docker-compose.yml
M
Dockerfile
README.md
M
requirements.txt
M
today_map.html
mariadb
meeting-detector
mindfulmama
n8n
notifier-app
Outline Section
OUTLINE
OUTLINE
Timeline Section
TIMELINE
TIMELINE
docker-compose.yml, Editor Group 1
docker-compose.yml, Editor Group 1
version: "3.9"
services:
postgres:
image: postgres:15-alpine
container_name: location-logger-postgres
environment:
POSTGRES_DB: location_logger
POSTGRES_USER: location_logger
POSTGRES_PASSWORD: [PASSWORD]
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5438:5432"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U location_logger"]
interval: 10s
timeout: 5s
retries: 5
api:
build: .
container_name: location-logger-api
env_file:
- .env
ports:
- "8050:8000"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python - << 'PY'\nimport urllib.request as u\ntry:\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\n import sys\n sys.exit(0 if r.status == 200 else 1)\nexcept Exception:\n import sys\n sys.exit(1)\nPY\n"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
mcp:
build: ./mcp-server
container_name: location-logger-mcp
environment:
API_BASE_URL: http://api:8000
API_USERNAME: ${MCP_API_USERNAME:-}
API_PASSWORD: [PASSWORD]
MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}
OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}
OAUTH_PASSWORD: [PASSWORD]
ports:
- "8052:8080"
restart: unless-stopped
depends_on:
api:
condition: service_healthy
adminer:
image: adminer:latest
container_name: location-logger-adminer
ports:
- "8051:8080"
restart: unless-stopped
depends_on:
- postgres
volumes:
postgres_data:
networks:
default:
version: "3.9"
services:
postgres:
image: postgres:15-alpine
container_name: location-logger-postgres
environment:
POSTGRES_DB: location_logger
POSTGRES_USER: location_logger
POSTGRES_PASSWORD: [PASSWORD]
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5438:5432"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U location_logger"]
interval: 10s
timeout: 5s
retries: 5
api:
build: .
container_name: location-logger-api
env_file:
- .env
ports:
- "8050:8000"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python - << 'PY'\nimport urllib.request as u\ntry:\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\n import sys\n sys.exit(0 if r.status == 200 else 1)\nexcept Exception:\n import sys\n sys.exit(1)\nPY\n"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
mcp:
build: ./mcp-server
container_name: location-logger-mcp
environment:
API_BASE_URL: http://api:8000
API_USERNAME: ${MCP_API_USERNAME:-}
API_PASSWORD: [PASSWORD]
MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}
OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}
OAUTH_PASSWORD: [PASSWORD]
ports:
- "8052:8080"
restart: unless-stopped
depends_on:
api:
condition: service_healthy
adminer:
image: adminer:latest
container_name: location-logger-adminer
ports:
- "8051:8080"
restart: unless-stopped
depends_on:
- postgres
volumes:
postgres_data:
networks:
default:
Hold
⇧
to drop into editor
Review payment logger au…, Editor Group 2
docker-compose.yml, preview, Editor Group 2
services:
postgresql:
image: docker.io/library/postgres:16-alpine
container_name: Authentik-DB
hostname: authentik-db
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}"]
interval: 5s
timeout: 5s
retries: 5
environment:
POSTGRES_PASSWORD: [PASSWORD]
POSTGRES_USER: authentik
POSTGRES_DB: authentik
volumes:
- /volume2/docker/auth/db:/var/lib/postgresql/data
networks:
- authentik_internal
redis:
image: docker.io/library/redis:alpine
container_name: Authentik-REDIS
hostname: authentik-redis
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 5s
timeout: 3s
retries: 5
networks:
- authentik_internal
server:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Server
hostname: authentik-server
restart: unless-stopped
command: server
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
AUTHENTIK_ERROR_REPORTING__ENABLED: "false"
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}
AUTHENTIK_BOOTSTRAP_PASSWORD: [PASSWORD]
ports:
- "9100:9000"
volumes:
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
- proxy
worker:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Worker
hostname: authentik-worker
restart: unless-stopped
command: worker
user: root
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/certs:/certs
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
outpost:
image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}
container_name: Authentik-Outpost
hostname: authentik-outpost
restart: unless-stopped
environment:
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_INSECURE: "false"
AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}
ports:
- "9101:9000"
depends_on:
- server
networks:
- authentik_internal
- proxy
networks:
authentik_internal:
internal: true
proxy:
external: true
services:
postgresql:
image: docker.io/library/postgres:16-alpine
container_name: Authentik-DB
hostname: authentik-db
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}"]
interval: 5s
timeout: 5s
retries: 5
environment:
POSTGRES_PASSWORD: [PASSWORD]
POSTGRES_USER: authentik
POSTGRES_DB: authentik
volumes:
- /volume2/docker/auth/db:/var/lib/postgresql/data
networks:
- authentik_internal
redis:
image: docker.io/library/redis:alpine
container_name: Authentik-REDIS
hostname: authentik-redis
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 5s
timeout: 3s
retries: 5
networks:
- authentik_internal
server:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Server
hostname: authentik-server
restart: unless-stopped
command: server
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
AUTHENTIK_ERROR_REPORTING__ENABLED: "false"
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}
AUTHENTIK_BOOTSTRAP_PASSWORD: [PASSWORD]
ports:
- "9100:9000"
volumes:
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
- proxy
worker:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Worker
hostname: authentik-worker
restart: unless-stopped
command: worker
user: root
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/certs:/certs
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
outpost:
image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}
container_name: Authentik-Outpost
hostname: authentik-outpost
restart: unless-stopped
environment:
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_INSECURE: "false"
AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}
ports:
- "9101:9000"
depends_on:
- server
networks:
- authentik_internal
- proxy
networks:
authentik_internal:
internal: true
proxy:
external: true
Problems (⇧⌘M)
PROBLEMS
Output (⇧⌘U)
OUTPUT
Debug Console (⇧⌘Y)
DEBUG CONSOLE
Terminal (⌃`)
TERMINAL
Ports
PORTS
remote SSH: nas
SSH: nas
location-logger (Git)
location-logger
location-logger (Git) - main*, Checkout Branch/Tag...
main*
location-logger (Git) - Synchronize Changes
No Problems
0
0
No Ports Forwarded
0
Notifications
Sign In
Sign In
Compose
Editor Language Status: $(copilot) No inline suggestion available, Inline suggestions
LF
UTF-8
Spaces: 2
Ln 1, Col 1
expanded
Command Succeeded...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Explorer (⇧⌘E)","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":true},{"role":"AXStaticText","text":"","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Search (⇧⌘F)","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Source Control (⌃⇧G) - 55 pending changes","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"55","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Run and Debug (⇧⌘D)","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Remote Explorer","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Extensions (⇧⌘X) - 2 require update","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Claude Code","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Containers","depth":19,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"EXPLORER","depth":17,"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"EXPLORER","depth":18,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Explorer Section: docker [SSH: nas]","depth":21,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"Explorer Section: docker [SSH: nas]","depth":22,"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"DOCKER [SSH: NAS]","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"adguard","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"ai-stack","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"app-db","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"appflowy","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"audiobookshelf","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"auth","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"certs","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"db","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"media","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"templates","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".env","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".env.example","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"docker-compose.yml","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"README.md","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"beszel","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"bitwarden","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"dawarich","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"dsk-uploader","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"flask-app","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"garmin-connector","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"gitea","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"health","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"health-tracker","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"homarr","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"hst","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"immich","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"jellyfinht","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"kavita","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"libreoffice","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"linkwarden","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"location-logger","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"alembic","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"app","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"mcp-server","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".env","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".env.example","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".gitignore","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".mcp.json","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"alembic.ini","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"docker-compose.yml","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Dockerfile","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"README.md","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"requirements.txt","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"today_map.html","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"mariadb","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"meeting-detector","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"mindfulmama","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"n8n","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"notifier-app","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Outline Section","depth":21,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"OUTLINE","depth":22,"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"OUTLINE","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Timeline Section","depth":21,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"TIMELINE","depth":22,"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"TIMELINE","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"docker-compose.yml, Editor Group 1","depth":28,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXRadioButton","text":"docker-compose.yml, Editor Group 1","depth":28,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":29,"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"version: \"3.9\"\n\nservices:\n postgres:\n image: postgres:15-alpine\n container_name: location-logger-postgres\n environment:\n POSTGRES_DB: location_logger\n POSTGRES_USER: location_logger\n POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-location_logger}\n volumes:\n - postgres_data:/var/lib/postgresql/data\n ports:\n - \"5438:5432\"\n restart: unless-stopped\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -U location_logger\"]\n interval: 10s\n timeout: 5s\n retries: 5\n\n api:\n build: .\n container_name: location-logger-api\n env_file:\n - .env\n ports:\n - \"8050:8000\"\n restart: unless-stopped\n depends_on:\n postgres:\n condition: service_healthy\n healthcheck:\n test: [\"CMD-SHELL\", \"python - << 'PY'\\nimport urllib.request as u\\ntry:\\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\\n import sys\\n sys.exit(0 if r.status == 200 else 1)\\nexcept Exception:\\n import sys\\n sys.exit(1)\\nPY\\n\"]\n interval: 10s\n timeout: 5s\n retries: 5\n start_period: 5s\n\n mcp:\n build: ./mcp-server\n container_name: location-logger-mcp\n environment:\n API_BASE_URL: http://api:8000\n API_USERNAME: ${MCP_API_USERNAME:-}\n API_PASSWORD: ${MCP_API_PASSWORD:-}\n MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}\n OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}\n OAUTH_PASSWORD: ${MCP_OAUTH_PASSWORD:-}\n ports:\n - \"8052:8080\"\n restart: unless-stopped\n depends_on:\n api:\n condition: service_healthy\n\n adminer:\n image: adminer:latest\n container_name: location-logger-adminer\n ports:\n - \"8051:8080\"\n restart: unless-stopped\n depends_on:\n - postgres\n\nvolumes:\n postgres_data:\n\nnetworks:\n default:","depth":28,"on_screen":true,"value":"version: \"3.9\"\n\nservices:\n postgres:\n image: postgres:15-alpine\n container_name: location-logger-postgres\n environment:\n POSTGRES_DB: location_logger\n POSTGRES_USER: location_logger\n POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-location_logger}\n volumes:\n - postgres_data:/var/lib/postgresql/data\n ports:\n - \"5438:5432\"\n restart: unless-stopped\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -U location_logger\"]\n interval: 10s\n timeout: 5s\n retries: 5\n\n api:\n build: .\n container_name: location-logger-api\n env_file:\n - .env\n ports:\n - \"8050:8000\"\n restart: unless-stopped\n depends_on:\n postgres:\n condition: service_healthy\n healthcheck:\n test: [\"CMD-SHELL\", \"python - << 'PY'\\nimport urllib.request as u\\ntry:\\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\\n import sys\\n sys.exit(0 if r.status == 200 else 1)\\nexcept Exception:\\n import sys\\n sys.exit(1)\\nPY\\n\"]\n interval: 10s\n timeout: 5s\n retries: 5\n start_period: 5s\n\n mcp:\n build: ./mcp-server\n container_name: location-logger-mcp\n environment:\n API_BASE_URL: http://api:8000\n API_USERNAME: ${MCP_API_USERNAME:-}\n API_PASSWORD: ${MCP_API_PASSWORD:-}\n MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}\n OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}\n OAUTH_PASSWORD: ${MCP_OAUTH_PASSWORD:-}\n ports:\n - \"8052:8080\"\n restart: unless-stopped\n depends_on:\n api:\n condition: service_healthy\n\n adminer:\n image: adminer:latest\n container_name: location-logger-adminer\n ports:\n - \"8051:8080\"\n restart: unless-stopped\n depends_on:\n - postgres\n\nvolumes:\n postgres_data:\n\nnetworks:\n default:","role_description":"editor","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"version: \"3.9\"\n\nservices:\n postgres:\n image: postgres:15-alpine\n container_name: location-logger-postgres\n environment:\n POSTGRES_DB: location_logger\n POSTGRES_USER: location_logger\n POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-location_logger}\n volumes:\n - postgres_data:/var/lib/postgresql/data\n ports:\n - \"5438:5432\"\n restart: unless-stopped\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -U location_logger\"]\n interval: 10s\n timeout: 5s\n retries: 5\n\n api:\n build: .\n container_name: location-logger-api\n env_file:\n - .env\n ports:\n - \"8050:8000\"\n restart: unless-stopped\n depends_on:\n postgres:\n condition: service_healthy\n healthcheck:\n test: [\"CMD-SHELL\", \"python - << 'PY'\\nimport urllib.request as u\\ntry:\\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\\n import sys\\n sys.exit(0 if r.status == 200 else 1)\\nexcept Exception:\\n import sys\\n sys.exit(1)\\nPY\\n\"]\n interval: 10s\n timeout: 5s\n retries: 5\n start_period: 5s\n\n mcp:\n build: ./mcp-server\n container_name: location-logger-mcp\n environment:\n API_BASE_URL: http://api:8000\n API_USERNAME: ${MCP_API_USERNAME:-}\n API_PASSWORD: ${MCP_API_PASSWORD:-}\n MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}\n OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}\n OAUTH_PASSWORD: ${MCP_OAUTH_PASSWORD:-}\n ports:\n - \"8052:8080\"\n restart: unless-stopped\n depends_on:\n api:\n condition: service_healthy\n\n adminer:\n image: adminer:latest\n container_name: location-logger-adminer\n ports:\n - \"8051:8080\"\n restart: unless-stopped\n depends_on:\n - postgres\n\nvolumes:\n postgres_data:\n\nnetworks:\n default:","depth":29,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Hold","depth":28,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"⇧","depth":28,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"to drop into editor","depth":28,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Review payment logger au…, Editor Group 2","depth":28,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"docker-compose.yml, preview, Editor Group 2","depth":28,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"","depth":29,"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"services:\n\n postgresql:\n image: docker.io/library/postgres:16-alpine\n container_name: Authentik-DB\n hostname: authentik-db\n restart: unless-stopped\n security_opt:\n - no-new-privileges:true\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}\"]\n interval: 5s\n timeout: 5s\n retries: 5\n environment:\n POSTGRES_PASSWORD: ${PG_PASS}\n POSTGRES_USER: authentik\n POSTGRES_DB: authentik\n volumes:\n - /volume2/docker/auth/db:/var/lib/postgresql/data\n networks:\n - authentik_internal\n\n redis:\n image: docker.io/library/redis:alpine\n container_name: Authentik-REDIS\n hostname: authentik-redis\n restart: unless-stopped\n security_opt:\n - no-new-privileges:true\n healthcheck:\n test: [\"CMD-SHELL\", \"redis-cli ping | grep PONG\"]\n interval: 5s\n timeout: 3s\n retries: 5\n networks:\n - authentik_internal\n\n server:\n image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}\n container_name: Authentik-Server\n hostname: authentik-server\n restart: unless-stopped\n command: server\n environment:\n AUTHENTIK_REDIS__HOST: authentik-redis\n AUTHENTIK_POSTGRESQL__HOST: authentik-db\n AUTHENTIK_POSTGRESQL__USER: authentik\n AUTHENTIK_POSTGRESQL__NAME: authentik\n AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}\n AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}\n AUTHENTIK_ERROR_REPORTING__ENABLED: \"false\"\n AUTHENTIK_HOST: ${AUTHENTIK_HOST}\n AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}\n AUTHENTIK_BOOTSTRAP_PASSWORD: ${AUTHENTIK_BOOTSTRAP_PASSWORD}\n ports:\n - \"9100:9000\"\n volumes:\n - /volume2/docker/auth/media:/media\n - /volume2/docker/auth/templates:/templates\n depends_on:\n postgresql:\n condition: service_healthy\n redis:\n condition: service_healthy\n networks:\n - authentik_internal\n - proxy\n\n worker:\n image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}\n container_name: Authentik-Worker\n hostname: authentik-worker\n restart: unless-stopped\n command: worker\n user: root\n environment:\n AUTHENTIK_REDIS__HOST: authentik-redis\n AUTHENTIK_POSTGRESQL__HOST: authentik-db\n AUTHENTIK_POSTGRESQL__USER: authentik\n AUTHENTIK_POSTGRESQL__NAME: authentik\n AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}\n AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}\n volumes:\n - /var/run/docker.sock:/var/run/docker.sock\n - /volume2/docker/auth/media:/media\n - /volume2/docker/auth/certs:/certs\n - /volume2/docker/auth/templates:/templates\n depends_on:\n postgresql:\n condition: service_healthy\n redis:\n condition: service_healthy\n networks:\n - authentik_internal\n\n outpost:\n image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}\n container_name: Authentik-Outpost\n hostname: authentik-outpost\n restart: unless-stopped\n environment:\n AUTHENTIK_HOST: ${AUTHENTIK_HOST}\n AUTHENTIK_INSECURE: \"false\"\n AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}\n ports:\n - \"9101:9000\"\n depends_on:\n - server\n networks:\n - authentik_internal\n - proxy\n\nnetworks:\n authentik_internal:\n internal: true\n proxy:\n external: true","depth":28,"on_screen":true,"value":"services:\n\n postgresql:\n image: docker.io/library/postgres:16-alpine\n container_name: Authentik-DB\n hostname: authentik-db\n restart: unless-stopped\n security_opt:\n - no-new-privileges:true\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}\"]\n interval: 5s\n timeout: 5s\n retries: 5\n environment:\n POSTGRES_PASSWORD: ${PG_PASS}\n POSTGRES_USER: authentik\n POSTGRES_DB: authentik\n volumes:\n - /volume2/docker/auth/db:/var/lib/postgresql/data\n networks:\n - authentik_internal\n\n redis:\n image: docker.io/library/redis:alpine\n container_name: Authentik-REDIS\n hostname: authentik-redis\n restart: unless-stopped\n security_opt:\n - no-new-privileges:true\n healthcheck:\n test: [\"CMD-SHELL\", \"redis-cli ping | grep PONG\"]\n interval: 5s\n timeout: 3s\n retries: 5\n networks:\n - authentik_internal\n\n server:\n image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}\n container_name: Authentik-Server\n hostname: authentik-server\n restart: unless-stopped\n command: server\n environment:\n AUTHENTIK_REDIS__HOST: authentik-redis\n AUTHENTIK_POSTGRESQL__HOST: authentik-db\n AUTHENTIK_POSTGRESQL__USER: authentik\n AUTHENTIK_POSTGRESQL__NAME: authentik\n AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}\n AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}\n AUTHENTIK_ERROR_REPORTING__ENABLED: \"false\"\n AUTHENTIK_HOST: ${AUTHENTIK_HOST}\n AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}\n AUTHENTIK_BOOTSTRAP_PASSWORD: ${AUTHENTIK_BOOTSTRAP_PASSWORD}\n ports:\n - \"9100:9000\"\n volumes:\n - /volume2/docker/auth/media:/media\n - /volume2/docker/auth/templates:/templates\n depends_on:\n postgresql:\n condition: service_healthy\n redis:\n condition: service_healthy\n networks:\n - authentik_internal\n - proxy\n\n worker:\n image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}\n container_name: Authentik-Worker\n hostname: authentik-worker\n restart: unless-stopped\n command: worker\n user: root\n environment:\n AUTHENTIK_REDIS__HOST: authentik-redis\n AUTHENTIK_POSTGRESQL__HOST: authentik-db\n AUTHENTIK_POSTGRESQL__USER: authentik\n AUTHENTIK_POSTGRESQL__NAME: authentik\n AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}\n AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}\n volumes:\n - /var/run/docker.sock:/var/run/docker.sock\n - /volume2/docker/auth/media:/media\n - /volume2/docker/auth/certs:/certs\n - /volume2/docker/auth/templates:/templates\n depends_on:\n postgresql:\n condition: service_healthy\n redis:\n condition: service_healthy\n networks:\n - authentik_internal\n\n outpost:\n image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}\n container_name: Authentik-Outpost\n hostname: authentik-outpost\n restart: unless-stopped\n environment:\n AUTHENTIK_HOST: ${AUTHENTIK_HOST}\n AUTHENTIK_INSECURE: \"false\"\n AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}\n ports:\n - \"9101:9000\"\n depends_on:\n - server\n networks:\n - authentik_internal\n - proxy\n\nnetworks:\n authentik_internal:\n internal: true\n proxy:\n external: true","role_description":"editor","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"services:\n\n postgresql:\n image: docker.io/library/postgres:16-alpine\n container_name: Authentik-DB\n hostname: authentik-db\n restart: unless-stopped\n security_opt:\n - no-new-privileges:true\n healthcheck:\n test: [\"CMD-SHELL\", \"pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}\"]\n interval: 5s\n timeout: 5s\n retries: 5\n environment:\n POSTGRES_PASSWORD: ${PG_PASS}\n POSTGRES_USER: authentik\n POSTGRES_DB: authentik\n volumes:\n - /volume2/docker/auth/db:/var/lib/postgresql/data\n networks:\n - authentik_internal\n\n redis:\n image: docker.io/library/redis:alpine\n container_name: Authentik-REDIS\n hostname: authentik-redis\n restart: unless-stopped\n security_opt:\n - no-new-privileges:true\n healthcheck:\n test: [\"CMD-SHELL\", \"redis-cli ping | grep PONG\"]\n interval: 5s\n timeout: 3s\n retries: 5\n networks:\n - authentik_internal\n\n server:\n image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}\n container_name: Authentik-Server\n hostname: authentik-server\n restart: unless-stopped\n command: server\n environment:\n AUTHENTIK_REDIS__HOST: authentik-redis\n AUTHENTIK_POSTGRESQL__HOST: authentik-db\n AUTHENTIK_POSTGRESQL__USER: authentik\n AUTHENTIK_POSTGRESQL__NAME: authentik\n AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}\n AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}\n AUTHENTIK_ERROR_REPORTING__ENABLED: \"false\"\n AUTHENTIK_HOST: ${AUTHENTIK_HOST}\n AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}\n AUTHENTIK_BOOTSTRAP_PASSWORD: ${AUTHENTIK_BOOTSTRAP_PASSWORD}\n ports:\n - \"9100:9000\"\n volumes:\n - /volume2/docker/auth/media:/media\n - /volume2/docker/auth/templates:/templates\n depends_on:\n postgresql:\n condition: service_healthy\n redis:\n condition: service_healthy\n networks:\n - authentik_internal\n - proxy\n\n worker:\n image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}\n container_name: Authentik-Worker\n hostname: authentik-worker\n restart: unless-stopped\n command: worker\n user: root\n environment:\n AUTHENTIK_REDIS__HOST: authentik-redis\n AUTHENTIK_POSTGRESQL__HOST: authentik-db\n AUTHENTIK_POSTGRESQL__USER: authentik\n AUTHENTIK_POSTGRESQL__NAME: authentik\n AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}\n AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}\n volumes:\n - /var/run/docker.sock:/var/run/docker.sock\n - /volume2/docker/auth/media:/media\n - /volume2/docker/auth/certs:/certs\n - /volume2/docker/auth/templates:/templates\n depends_on:\n postgresql:\n condition: service_healthy\n redis:\n condition: service_healthy\n networks:\n - authentik_internal\n\n outpost:\n image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}\n container_name: Authentik-Outpost\n hostname: authentik-outpost\n restart: unless-stopped\n environment:\n AUTHENTIK_HOST: ${AUTHENTIK_HOST}\n AUTHENTIK_INSECURE: \"false\"\n AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}\n ports:\n - \"9101:9000\"\n depends_on:\n - server\n networks:\n - authentik_internal\n - proxy\n\nnetworks:\n authentik_internal:\n internal: true\n proxy:\n external: true","depth":29,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Problems (⇧⌘M)","depth":22,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"PROBLEMS","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Output (⇧⌘U)","depth":22,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"OUTPUT","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Debug Console (⇧⌘Y)","depth":22,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DEBUG CONSOLE","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Terminal (⌃`)","depth":22,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":true},{"role":"AXStaticText","text":"TERMINAL","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Ports","depth":22,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"PORTS","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"remote SSH: nas","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SSH: nas","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"location-logger (Git)","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"location-logger","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"location-logger (Git) - main*, Checkout Branch/Tag...","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"main*","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"location-logger (Git) - Synchronize Changes","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"No Problems","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"No Ports Forwarded","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Notifications","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sign In","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sign In","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Compose","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Editor Language Status: $(copilot) No inline suggestion available, Inline suggestions","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"LF","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"UTF-8","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Spaces: 2","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Ln 1, Col 1","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"expanded","depth":12,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Command Succeeded","depth":12,"on_screen":false,"role_description":"text"}]...
|
-8028424180562631063
|
4002798401039655210
|
click
|
accessibility
|
NULL
|
Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧ Explorer (⇧⌘E)
Search (⇧⌘F)
Source Control (⌃⇧G) - 55 pending changes
55
Run and Debug (⇧⌘D)
Remote Explorer
Extensions (⇧⌘X) - 2 require update
2
Claude Code
Containers
EXPLORER
EXPLORER
Explorer Section: docker [SSH: nas]
Explorer Section: docker [SSH: nas]
DOCKER [SSH: NAS]
adguard
ai-stack
app-db
appflowy
audiobookshelf
auth
certs
db
media
templates
.env
.env.example
docker-compose.yml
README.md
beszel
bitwarden
dawarich
dsk-uploader
flask-app
garmin-connector
gitea
health
health-tracker
homarr
hst
immich
jellyfinht
kavita
libreoffice
linkwarden
location-logger
alembic
app
mcp-server
.env
.env.example
.gitignore
.mcp.json
M
alembic.ini
docker-compose.yml
M
Dockerfile
README.md
M
requirements.txt
M
today_map.html
mariadb
meeting-detector
mindfulmama
n8n
notifier-app
Outline Section
OUTLINE
OUTLINE
Timeline Section
TIMELINE
TIMELINE
docker-compose.yml, Editor Group 1
docker-compose.yml, Editor Group 1
version: "3.9"
services:
postgres:
image: postgres:15-alpine
container_name: location-logger-postgres
environment:
POSTGRES_DB: location_logger
POSTGRES_USER: location_logger
POSTGRES_PASSWORD: [PASSWORD]
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5438:5432"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U location_logger"]
interval: 10s
timeout: 5s
retries: 5
api:
build: .
container_name: location-logger-api
env_file:
- .env
ports:
- "8050:8000"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python - << 'PY'\nimport urllib.request as u\ntry:\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\n import sys\n sys.exit(0 if r.status == 200 else 1)\nexcept Exception:\n import sys\n sys.exit(1)\nPY\n"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
mcp:
build: ./mcp-server
container_name: location-logger-mcp
environment:
API_BASE_URL: http://api:8000
API_USERNAME: ${MCP_API_USERNAME:-}
API_PASSWORD: [PASSWORD]
MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}
OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}
OAUTH_PASSWORD: [PASSWORD]
ports:
- "8052:8080"
restart: unless-stopped
depends_on:
api:
condition: service_healthy
adminer:
image: adminer:latest
container_name: location-logger-adminer
ports:
- "8051:8080"
restart: unless-stopped
depends_on:
- postgres
volumes:
postgres_data:
networks:
default:
version: "3.9"
services:
postgres:
image: postgres:15-alpine
container_name: location-logger-postgres
environment:
POSTGRES_DB: location_logger
POSTGRES_USER: location_logger
POSTGRES_PASSWORD: [PASSWORD]
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5438:5432"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U location_logger"]
interval: 10s
timeout: 5s
retries: 5
api:
build: .
container_name: location-logger-api
env_file:
- .env
ports:
- "8050:8000"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python - << 'PY'\nimport urllib.request as u\ntry:\n with u.urlopen('http://localhost:8000/health', timeout=5) as r:\n import sys\n sys.exit(0 if r.status == 200 else 1)\nexcept Exception:\n import sys\n sys.exit(1)\nPY\n"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
mcp:
build: ./mcp-server
container_name: location-logger-mcp
environment:
API_BASE_URL: http://api:8000
API_USERNAME: ${MCP_API_USERNAME:-}
API_PASSWORD: [PASSWORD]
MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:-}
OAUTH_SERVER_URL: ${MCP_OAUTH_SERVER_URL:-https://mcp.location.lakylak.xyz}
OAUTH_PASSWORD: [PASSWORD]
ports:
- "8052:8080"
restart: unless-stopped
depends_on:
api:
condition: service_healthy
adminer:
image: adminer:latest
container_name: location-logger-adminer
ports:
- "8051:8080"
restart: unless-stopped
depends_on:
- postgres
volumes:
postgres_data:
networks:
default:
Hold
⇧
to drop into editor
Review payment logger au…, Editor Group 2
docker-compose.yml, preview, Editor Group 2
services:
postgresql:
image: docker.io/library/postgres:16-alpine
container_name: Authentik-DB
hostname: authentik-db
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}"]
interval: 5s
timeout: 5s
retries: 5
environment:
POSTGRES_PASSWORD: [PASSWORD]
POSTGRES_USER: authentik
POSTGRES_DB: authentik
volumes:
- /volume2/docker/auth/db:/var/lib/postgresql/data
networks:
- authentik_internal
redis:
image: docker.io/library/redis:alpine
container_name: Authentik-REDIS
hostname: authentik-redis
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 5s
timeout: 3s
retries: 5
networks:
- authentik_internal
server:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Server
hostname: authentik-server
restart: unless-stopped
command: server
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
AUTHENTIK_ERROR_REPORTING__ENABLED: "false"
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}
AUTHENTIK_BOOTSTRAP_PASSWORD: [PASSWORD]
ports:
- "9100:9000"
volumes:
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
- proxy
worker:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Worker
hostname: authentik-worker
restart: unless-stopped
command: worker
user: root
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/certs:/certs
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
outpost:
image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}
container_name: Authentik-Outpost
hostname: authentik-outpost
restart: unless-stopped
environment:
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_INSECURE: "false"
AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}
ports:
- "9101:9000"
depends_on:
- server
networks:
- authentik_internal
- proxy
networks:
authentik_internal:
internal: true
proxy:
external: true
services:
postgresql:
image: docker.io/library/postgres:16-alpine
container_name: Authentik-DB
hostname: authentik-db
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB:-authentik} -U ${POSTGRES_USER:-authentik}"]
interval: 5s
timeout: 5s
retries: 5
environment:
POSTGRES_PASSWORD: [PASSWORD]
POSTGRES_USER: authentik
POSTGRES_DB: authentik
volumes:
- /volume2/docker/auth/db:/var/lib/postgresql/data
networks:
- authentik_internal
redis:
image: docker.io/library/redis:alpine
container_name: Authentik-REDIS
hostname: authentik-redis
restart: unless-stopped
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 5s
timeout: 3s
retries: 5
networks:
- authentik_internal
server:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Server
hostname: authentik-server
restart: unless-stopped
command: server
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
AUTHENTIK_ERROR_REPORTING__ENABLED: "false"
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_BOOTSTRAP_EMAIL: ${AUTHENTIK_BOOTSTRAP_EMAIL}
AUTHENTIK_BOOTSTRAP_PASSWORD: [PASSWORD]
ports:
- "9100:9000"
volumes:
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
- proxy
worker:
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
container_name: Authentik-Worker
hostname: authentik-worker
restart: unless-stopped
command: worker
user: root
environment:
AUTHENTIK_REDIS__HOST: authentik-redis
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: [PASSWORD]
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /volume2/docker/auth/media:/media
- /volume2/docker/auth/certs:/certs
- /volume2/docker/auth/templates:/templates
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik_internal
outpost:
image: ghcr.io/goauthentik/proxy:${AUTHENTIK_TAG}
container_name: Authentik-Outpost
hostname: authentik-outpost
restart: unless-stopped
environment:
AUTHENTIK_HOST: ${AUTHENTIK_HOST}
AUTHENTIK_INSECURE: "false"
AUTHENTIK_TOKEN: ${AUTHENTIK_OUTPOST_TOKEN}
ports:
- "9101:9000"
depends_on:
- server
networks:
- authentik_internal
- proxy
networks:
authentik_internal:
internal: true
proxy:
external: true
Problems (⇧⌘M)
PROBLEMS
Output (⇧⌘U)
OUTPUT
Debug Console (⇧⌘Y)
DEBUG CONSOLE
Terminal (⌃`)
TERMINAL
Ports
PORTS
remote SSH: nas
SSH: nas
location-logger (Git)
location-logger
location-logger (Git) - main*, Checkout Branch/Tag...
main*
location-logger (Git) - Synchronize Changes
No Problems
0
0
No Ports Forwarded
0
Notifications
Sign In
Sign In
Compose
Editor Language Status: $(copilot) No inline suggestion available, Inline suggestions
LF
UTF-8
Spaces: 2
Ln 1, Col 1
expanded
Command Succeeded...
|
10708
|
NULL
|
NULL
|
NULL
|
|
18180
|
788
|
21
|
2026-05-11T11:01:53.316976+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778497313316_m1.jpg...
|
PhpStorm
|
faVsco.js – Client.php
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
SlackFileEditViewGoHistoryWindowHelpDOCKERO ₴1DEV SlackFileEditViewGoHistoryWindowHelpDOCKERO ₴1DEV (docker)$2APP (-zsh)883viewsjiminny-worker-processing-2:jiminny-worker-processing-2_00: stoppedjiminny-worker-processing-3:jiminny-worker-processing-3_00: stoppedjiminny-worker-processing-4: jiminny-worker-processing-4_00: stoppedjiminny-worker-processing-5:jiminny-worker-processing-5_00:jiminny-worker-processing-delayed: jiminny-worker-processing-delayed_00: stoppedworker-analytics:worker-analytics_00: stoppedworker-conferences:worker-conferences_00: stoppedworker-crm-update:worker-crm-update_00: stoppedworker-download:worker-download_00: stoppedworker-emails:worker-emails_00:worker-nudges:worker-nudges_00: stoppedworker:worker_00: stoppedworker-audio:worker-audio_00: stoppedworker-calendar:worker-calendar_00: stoppedworker-crm-sync:worker-crm-sync_00: stoppedartisan-schedule:artisan-schedule_00: stoppedworker-es-update:worker-es-update_00: stoppedjiminny-worker-processing-1:jiminny-worker-processing-1_00: stoppedartisan-schedule:artisan-schedule_00: startedjiminny-worker-processing-1:jiminny-worker-processing-1_00: startedjiminny-worker-processing-2:jiminny-worker-processing-2_00: startedjiminny-worker-processing-3:jiminny-worker-processing-3_00: startedjiminny-worker-processing-4:jiminny-worker-processing-4_00: startedjiminny-worker-processing-5:jiminny-worker-processing-5_00:jiminny-worker-processing-delayed: jiminny-worker-processing-delayed_00: startedworker:worker_00: startedworker-analytics:worker-analytics_00: startedworker-audio:worker-audio_00: startedworker-calendar:worker-calendar_00: startedworker-conferences:worker-conferences_00: startedworker-crm-sync:worker-crm-sync_00: startedworker-crm-update:worker-crm-update_00: startedworker-download:worker-download_00: startedworker-emails:worker-emails_00: startedworker-es-update:worker-es-update_00: startedworker-nudges:worker-nudges_00: startedroot@docker_lamp_1:/home/jiminny#php artisan jiminny:debugDispatching 100 MatchActivityCrmData jobs (portal=2)Done. Watch logs and run jiminny:debug observeRateLimit to inspect cache state.root@docker_lamp_1:/home/jiminny# php artisan jiminny:debugDispatching 100 MatchActivityCrmData jobs (portal=2)Done. Watch logs and run jiminny:debug observeRateLimit to inspect cache state.root@docker_lamp_1:/home/jiminny# ]DEV (d)-zshHomeDMsActivityLater...alo)Preparation for Refi... in 59 m100% <78• Mon 11 May 14:01:52→Describe what you are looking forJiminny ...# contusion-clinic# curiosity_lab# engineering# general# jiminny-bg# platform-tickets# product_launches# random# releases# sofia-office# support# thank-yous# the_people_of jimi...ToastHomeMessages^ Direct messages®. Aneliya Angelova®. Galya Dimitrova I& Petko Kashinski&. Stefka StoyanovaVasil Vasilev&. Nikolay IvanovAneliya Angelova, ...Stoyan Tanev®. VesE Lukas Kovalik y... 0AboutFriday, May 8th~iminnyAdded by Toast for GitHubToday ~Toast APP10:00 AMReviewapp#12059 Jy 20820 es reindexstream model hydration2 days old • 12 files changed •@Vasil VasilevAdded by Toast for GitHubResolve Conflictsapp#11443 Test hublets latency5 months old • 20 files changed#11327 JY-19501 webhookbased opportunity syncShow moreAdded by Toast for GitHubNeeds Loveapp#12024 JY-20773 fix user pilottracking ofr automated reportgenerated12 days old • 1 file changedE:: AppsMessage ToastJira CloudToast+AaConala CalaNew...
|
NULL
|
-8020300776480668610
|
NULL
|
click
|
ocr
|
NULL
|
SlackFileEditViewGoHistoryWindowHelpDOCKERO ₴1DEV SlackFileEditViewGoHistoryWindowHelpDOCKERO ₴1DEV (docker)$2APP (-zsh)883viewsjiminny-worker-processing-2:jiminny-worker-processing-2_00: stoppedjiminny-worker-processing-3:jiminny-worker-processing-3_00: stoppedjiminny-worker-processing-4: jiminny-worker-processing-4_00: stoppedjiminny-worker-processing-5:jiminny-worker-processing-5_00:jiminny-worker-processing-delayed: jiminny-worker-processing-delayed_00: stoppedworker-analytics:worker-analytics_00: stoppedworker-conferences:worker-conferences_00: stoppedworker-crm-update:worker-crm-update_00: stoppedworker-download:worker-download_00: stoppedworker-emails:worker-emails_00:worker-nudges:worker-nudges_00: stoppedworker:worker_00: stoppedworker-audio:worker-audio_00: stoppedworker-calendar:worker-calendar_00: stoppedworker-crm-sync:worker-crm-sync_00: stoppedartisan-schedule:artisan-schedule_00: stoppedworker-es-update:worker-es-update_00: stoppedjiminny-worker-processing-1:jiminny-worker-processing-1_00: stoppedartisan-schedule:artisan-schedule_00: startedjiminny-worker-processing-1:jiminny-worker-processing-1_00: startedjiminny-worker-processing-2:jiminny-worker-processing-2_00: startedjiminny-worker-processing-3:jiminny-worker-processing-3_00: startedjiminny-worker-processing-4:jiminny-worker-processing-4_00: startedjiminny-worker-processing-5:jiminny-worker-processing-5_00:jiminny-worker-processing-delayed: jiminny-worker-processing-delayed_00: startedworker:worker_00: startedworker-analytics:worker-analytics_00: startedworker-audio:worker-audio_00: startedworker-calendar:worker-calendar_00: startedworker-conferences:worker-conferences_00: startedworker-crm-sync:worker-crm-sync_00: startedworker-crm-update:worker-crm-update_00: startedworker-download:worker-download_00: startedworker-emails:worker-emails_00: startedworker-es-update:worker-es-update_00: startedworker-nudges:worker-nudges_00: startedroot@docker_lamp_1:/home/jiminny#php artisan jiminny:debugDispatching 100 MatchActivityCrmData jobs (portal=2)Done. Watch logs and run jiminny:debug observeRateLimit to inspect cache state.root@docker_lamp_1:/home/jiminny# php artisan jiminny:debugDispatching 100 MatchActivityCrmData jobs (portal=2)Done. Watch logs and run jiminny:debug observeRateLimit to inspect cache state.root@docker_lamp_1:/home/jiminny# ]DEV (d)-zshHomeDMsActivityLater...alo)Preparation for Refi... in 59 m100% <78• Mon 11 May 14:01:52→Describe what you are looking forJiminny ...# contusion-clinic# curiosity_lab# engineering# general# jiminny-bg# platform-tickets# product_launches# random# releases# sofia-office# support# thank-yous# the_people_of jimi...ToastHomeMessages^ Direct messages®. Aneliya Angelova®. Galya Dimitrova I& Petko Kashinski&. Stefka StoyanovaVasil Vasilev&. Nikolay IvanovAneliya Angelova, ...Stoyan Tanev®. VesE Lukas Kovalik y... 0AboutFriday, May 8th~iminnyAdded by Toast for GitHubToday ~Toast APP10:00 AMReviewapp#12059 Jy 20820 es reindexstream model hydration2 days old • 12 files changed •@Vasil VasilevAdded by Toast for GitHubResolve Conflictsapp#11443 Test hublets latency5 months old • 20 files changed#11327 JY-19501 webhookbased opportunity syncShow moreAdded by Toast for GitHubNeeds Loveapp#12024 JY-20773 fix user pilottracking ofr automated reportgenerated12 days old • 1 file changedE:: AppsMessage ToastJira CloudToast+AaConala CalaNew...
|
18178
|
NULL
|
NULL
|
NULL
|
|
24534
|
1025
|
1
|
2026-05-12T09:22:25.963091+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-12/1778 /Users/lukas/.screenpipe/data/data/2026-05-12/1778577745963_m2.jpg...
|
Firefox
|
JY-20725 add HS rate limit handling on activities JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app — Work...
|
True
|
github.com/jiminny/app/pull/12066#discussion_r3225 github.com/jiminny/app/pull/12066#discussion_r3225003426...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Unnamed Group
TypeError: League\Flysystem\Filesyst Unnamed Group
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
CloudWatch | us-east-2
CloudWatch | us-east-2
Unnamed Group
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
Pipelines - jiminny/app
Pipelines - jiminny/app
Pull requests · jiminny/app
Pull requests · jiminny/app
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
Data Explorer
Data Explorer
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
Jiminny
Jiminny
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Skip to content
Skip to content
Open menu
Homepage (g then d)
jiminny
jiminny
app
app
Search or jump to…
Type
/
to search
Chat with Copilot
Open Copilot…
Create new...
All issues(g then i)
All pull requests
All repositories
You have unread notifications(g then n)
Open user navigation menu
Repository navigation
Repository navigation
Code
Code
Pull requests (33)
Pull requests
(
33
)
Agents
Agents
Actions
Actions
Wiki
Wiki
Security and quality (4)
Security and quality
(
4
)
Insights
Insights
Settings
Settings
Important update
Important update
On April 24 we'll start using GitHub Copilot interaction data for AI model training unless you opt out.
Review this update
Review this update
and manage your preferences in your
GitHub account settings
GitHub account settings
.
Dismiss banner
JY-20725 add HS rate limit handling on activities rematching #12066 Edit title
JY-20725 add HS rate limit handling on activities rematching
#
12066
Edit title
Unable to merge
Unable to merge
Code
Code
Open
LakyLak
LakyLak
wants to merge 4 commits into
master
master
from
JY-20725-handle-HS-search-rate-limit
JY-20725-handle-HS-search-rate-limit
Copy head branch name to clipboard
Lines changed: 775 additions & 249 deletions
Conversation (7)
Conversation
(
7
)
Commits (4)
Commits
(
4
)
Checks (6)
Checks
(
6
)
Files changed (12)
Files changed
(
12
)
Conversation
Conversation
@LakyLak
Show options
LakyLak commented 20 hours ago •
LakyLak
LakyLak
commented
20 hours ago
20 hours ago
•
edited
edited
JIRA: JY-20725
JIRA:
JY-20725
JY-20725
Changes:
Changes:
The purpose is to handle rate limit on search requests (from getPaginatedData) used during activity rematching.
Adds
HandleHubspotRateLimit
middleware (release jobs with delay)
Adds
executeRequest
wrapper in Hubspot Client. It handles 429 errors and throws
RateLimitException
Add or remove reactions
LakyLak
LakyLak
added
2
commits
20 hours ago
20 hours ago
@LakyLak
JY-20725
JY-20725
add HS rate limit handling on activities rematching
add HS rate limit handling on activities rematching
8 / 10 checks OK
44d5678
44d5678
@LakyLak
JY-20725
JY-20725
add tests
add tests
11 / 12 checks OK
cbed2c9
cbed2c9
@LakyLak
Show options
Author
LakyLak commented 19 hours ago
LakyLak
LakyLak
commented
19 hours ago
19 hours ago
@claude
@claude
Add or remove reactions
react with eyes
👀
1
@claude...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Unnamed Group","depth":4,"bounds":{"left":0.0028257978,"top":0.057063047,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXRadioButton","text":"TypeError: League\\Flysystem\\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app","depth":4,"bounds":{"left":0.0028257978,"top":0.08060654,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"TypeError: League\\Flysystem\\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app","depth":5,"bounds":{"left":0.015957447,"top":0.09217877,"width":0.40492022,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"CloudWatch | us-east-2","depth":4,"bounds":{"left":0.0028257978,"top":0.11332801,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"CloudWatch | us-east-2","depth":5,"bounds":{"left":0.015957447,"top":0.12490024,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Unnamed Group","depth":4,"bounds":{"left":0.0028257978,"top":0.15123703,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXRadioButton","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":4,"bounds":{"left":0.0028257978,"top":0.17478053,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":5,"bounds":{"left":0.015957447,"top":0.18635276,"width":0.16888298,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira","depth":4,"bounds":{"left":0.0,"top":0.207502,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.21907422,"width":0.16140293,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.24022347,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.25179568,"width":0.18816489,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.27294493,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.28451717,"width":0.039228722,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pull requests · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.3056664,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.31723863,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":4,"bounds":{"left":0.0,"top":0.33838788,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.3499601,"width":0.1200133,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.37110934,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.38268158,"width":0.19331782,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20776] Automated report - sentry - Jira","depth":4,"bounds":{"left":0.0,"top":0.4038308,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20776] Automated report - sentry - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.41540304,"width":0.07646277,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.0,"top":0.4365523,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.4481245,"width":0.10106383,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.46927375,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.48084596,"width":0.15159574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Data Explorer","depth":4,"bounds":{"left":0.0,"top":0.5019952,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Data Explorer","depth":5,"bounds":{"left":0.013297873,"top":0.51356745,"width":0.0234375,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20776] Automated report - sentry - Jira","depth":4,"bounds":{"left":0.0,"top":0.53471667,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20776] Automated report - sentry - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.5462889,"width":0.07646277,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.5674381,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.57901037,"width":0.013131649,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.60015965,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.6117318,"width":0.18816489,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.06732048,"top":0.60734236,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.63447726,"width":0.07413564,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0028257978,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.013796543,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.024933511,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.036070477,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.04720745,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Skip to content","depth":6,"bounds":{"left":0.07962101,"top":0.0518755,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Skip to content","depth":7,"bounds":{"left":0.07962101,"top":0.05347167,"width":0.0029920214,"height":0.21468475},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Open menu","depth":10,"bounds":{"left":0.08494016,"top":0.06464485,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Homepage (g then d)","depth":9,"bounds":{"left":0.099567816,"top":0.06464485,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"jiminny","depth":12,"bounds":{"left":0.112865694,"top":0.06464485,"width":0.018949468,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"jiminny","depth":14,"bounds":{"left":0.11486037,"top":0.07063048,"width":0.014960106,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"app","depth":12,"bounds":{"left":0.13680187,"top":0.06464485,"width":0.017785905,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"app","depth":14,"bounds":{"left":0.13879654,"top":0.07063048,"width":0.008477394,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Search or jump to…","depth":9,"bounds":{"left":0.31698802,"top":0.06464485,"width":0.06565824,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Type","depth":12,"bounds":{"left":0.32928857,"top":0.07063048,"width":0.011801862,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/","depth":12,"bounds":{"left":0.34242022,"top":0.07222666,"width":0.002493351,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to search","depth":12,"bounds":{"left":0.3464096,"top":0.07063048,"width":0.021276595,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Chat with Copilot","depth":10,"bounds":{"left":0.38464096,"top":0.06464485,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"Open Copilot…","depth":9,"bounds":{"left":0.3949468,"top":0.06464485,"width":0.008643617,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXMenuButton","text":"Create new...","depth":9,"bounds":{"left":0.41156915,"top":0.06464485,"width":0.01662234,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"All issues(g then i)","depth":9,"bounds":{"left":0.43085107,"top":0.06464485,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"All pull requests","depth":9,"bounds":{"left":0.44414893,"top":0.06464485,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"All repositories","depth":9,"bounds":{"left":0.4574468,"top":0.06464485,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"You have unread notifications(g then n)","depth":9,"bounds":{"left":0.47074467,"top":0.06464485,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open user navigation menu","depth":9,"bounds":{"left":0.48404256,"top":0.06464485,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Repository navigation","depth":9,"bounds":{"left":0.079288565,"top":0.051077414,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Repository navigation","depth":10,"bounds":{"left":0.079288565,"top":0.05387071,"width":0.0787899,"height":0.023144454},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Code","depth":12,"bounds":{"left":0.08494016,"top":0.09936153,"width":0.025099734,"height":0.026336791},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Code","depth":14,"bounds":{"left":0.095744684,"top":0.10574621,"width":0.011469414,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Pull requests (33)","depth":12,"bounds":{"left":0.11269947,"top":0.09936153,"width":0.05518617,"height":0.026336791},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests","depth":14,"bounds":{"left":0.12333777,"top":0.10574621,"width":0.02925532,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":14,"bounds":{"left":0.15525267,"top":0.113727055,"width":0.0029920214,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"33","depth":14,"bounds":{"left":0.15824468,"top":0.113727055,"width":0.005817819,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":14,"bounds":{"left":0.1640625,"top":0.113727055,"width":0.0016622341,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Agents","depth":12,"bounds":{"left":0.1705452,"top":0.09936153,"width":0.029089095,"height":0.026336791},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Agents","depth":14,"bounds":{"left":0.18151596,"top":0.10574621,"width":0.014960106,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Actions","depth":12,"bounds":{"left":0.20229389,"top":0.09936153,"width":0.03025266,"height":0.026336791},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Actions","depth":14,"bounds":{"left":0.21326463,"top":0.10574621,"width":0.016123671,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Wiki","depth":12,"bounds":{"left":0.23520611,"top":0.09936153,"width":0.022938829,"height":0.026336791},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Wiki","depth":14,"bounds":{"left":0.24601063,"top":0.10574621,"width":0.009142287,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Security and quality (4)","depth":12,"bounds":{"left":0.26080453,"top":0.09936153,"width":0.06815159,"height":0.026336791},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Security and quality","depth":14,"bounds":{"left":0.27260637,"top":0.10574621,"width":0.04255319,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":14,"bounds":{"left":0.31898272,"top":0.113727055,"width":0.0029920214,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4","depth":14,"bounds":{"left":0.32197472,"top":0.113727055,"width":0.0028257978,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":14,"bounds":{"left":0.32480052,"top":0.113727055,"width":0.0018284575,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Insights","depth":12,"bounds":{"left":0.3316157,"top":0.09936153,"width":0.031083776,"height":0.026336791},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Insights","depth":14,"bounds":{"left":0.34275267,"top":0.10574621,"width":0.016788565,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Settings","depth":12,"bounds":{"left":0.36535904,"top":0.09936153,"width":0.032081116,"height":0.026336791},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Settings","depth":14,"bounds":{"left":0.37666222,"top":0.10574621,"width":0.01761968,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Important update","depth":10,"bounds":{"left":0.09325133,"top":0.14365523,"width":0.0003324468,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Important update","depth":11,"bounds":{"left":0.09325133,"top":0.1452514,"width":0.039228722,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"On April 24 we'll start using GitHub Copilot interaction data for AI model training unless you opt out.","depth":10,"bounds":{"left":0.09325133,"top":0.1452514,"width":0.2159242,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Review this update","depth":10,"bounds":{"left":0.30917552,"top":0.1452514,"width":0.04055851,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Review this update","depth":11,"bounds":{"left":0.30917552,"top":0.1452514,"width":0.04055851,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"and manage your preferences in your","depth":10,"bounds":{"left":0.34973404,"top":0.1452514,"width":0.08261303,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"GitHub account settings","depth":10,"bounds":{"left":0.09325133,"top":0.1452514,"width":0.3728391,"height":0.030327214},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"GitHub account settings","depth":11,"bounds":{"left":0.09325133,"top":0.1452514,"width":0.3728391,"height":0.030327214},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":10,"bounds":{"left":0.110538565,"top":0.16201118,"width":0.0013297872,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Dismiss banner","depth":9,"bounds":{"left":0.48636967,"top":0.13886672,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"JY-20725 add HS rate limit handling on activities rematching #12066 Edit title","depth":13,"bounds":{"left":0.090259306,"top":0.20830008,"width":0.3125,"height":0.06384677},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"JY-20725 add HS rate limit handling on activities rematching","depth":14,"bounds":{"left":0.090259306,"top":0.20909816,"width":0.27543217,"height":0.030327214},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"#","depth":15,"bounds":{"left":0.09291888,"top":0.24102154,"width":0.006482713,"height":0.030327214},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12066","depth":15,"bounds":{"left":0.09940159,"top":0.24102154,"width":0.030418882,"height":0.030327214},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Edit title","depth":14,"bounds":{"left":0.13115026,"top":0.2434158,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Unable to merge","depth":13,"bounds":{"left":0.40541887,"top":0.2150838,"width":0.053025264,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Unable to merge","depth":15,"bounds":{"left":0.41771942,"top":0.22106944,"width":0.036402926,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Code","depth":13,"bounds":{"left":0.46110374,"top":0.2150838,"width":0.02825798,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Code","depth":15,"bounds":{"left":0.46542552,"top":0.22106944,"width":0.011635638,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open","depth":13,"bounds":{"left":0.1008976,"top":0.28451717,"width":0.011968086,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"LakyLak","depth":15,"bounds":{"left":0.11951463,"top":0.28132483,"width":0.01861702,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LakyLak","depth":16,"bounds":{"left":0.11951463,"top":0.282921,"width":0.01861702,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"wants to merge 4 commits into","depth":15,"bounds":{"left":0.13946144,"top":0.282921,"width":0.06648936,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"master","depth":15,"bounds":{"left":0.20728059,"top":0.28092578,"width":0.018450798,"height":0.017557861},"on_screen":true,"role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"master","depth":16,"bounds":{"left":0.20927526,"top":0.28411812,"width":0.014461436,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"from","depth":16,"bounds":{"left":0.22706117,"top":0.282921,"width":0.009973404,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20725-handle-HS-search-rate-limit","depth":16,"bounds":{"left":0.23836437,"top":0.28092578,"width":0.090259306,"height":0.017557861},"on_screen":true,"role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725-handle-HS-search-rate-limit","depth":17,"bounds":{"left":0.24035904,"top":0.28411812,"width":0.086269945,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy head branch name to clipboard","depth":16,"bounds":{"left":0.32995346,"top":0.27853152,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Lines changed: 775 additions & 249 deletions","depth":14,"bounds":{"left":0.45196143,"top":0.3347965,"width":0.019946808,"height":0.11412609},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Conversation (7)","depth":16,"bounds":{"left":0.090259306,"top":0.31683958,"width":0.054521278,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Conversation","depth":17,"bounds":{"left":0.10255984,"top":0.3264166,"width":0.02825798,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":18,"bounds":{"left":0.14045878,"top":0.3264166,"width":0.0029920214,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"7","depth":18,"bounds":{"left":0.1434508,"top":0.3264166,"width":0.0026595744,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":18,"bounds":{"left":0.14611037,"top":0.3264166,"width":0.0016622341,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Commits (4)","depth":16,"bounds":{"left":0.14478059,"top":0.31683958,"width":0.045711435,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Commits","depth":17,"bounds":{"left":0.15708111,"top":0.3264166,"width":0.019115692,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":18,"bounds":{"left":0.1861702,"top":0.3264166,"width":0.0029920214,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4","depth":18,"bounds":{"left":0.18916224,"top":0.3264166,"width":0.0029920214,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":18,"bounds":{"left":0.19215426,"top":0.3264166,"width":0.0016622341,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Checks (6)","depth":16,"bounds":{"left":0.19049202,"top":0.31683958,"width":0.04255319,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Checks","depth":17,"bounds":{"left":0.20279256,"top":0.3264166,"width":0.015957447,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":18,"bounds":{"left":0.2287234,"top":0.3264166,"width":0.0029920214,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6","depth":18,"bounds":{"left":0.23171543,"top":0.3264166,"width":0.0028257978,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":18,"bounds":{"left":0.23454122,"top":0.3264166,"width":0.0018284575,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Files changed (12)","depth":16,"bounds":{"left":0.2330452,"top":0.31683958,"width":0.05817819,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":true,"is_selected":false},{"role":"AXStaticText","text":"Files changed","depth":17,"bounds":{"left":0.24534574,"top":0.3264166,"width":0.029753989,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":18,"bounds":{"left":0.2869016,"top":0.3264166,"width":0.0029920214,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12","depth":18,"bounds":{"left":0.28989363,"top":0.3264166,"width":0.0048204786,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":18,"bounds":{"left":0.2947141,"top":0.3264166,"width":0.0018284575,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Conversation","depth":12,"bounds":{"left":0.090259306,"top":0.3623304,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Conversation","depth":13,"bounds":{"left":0.090259306,"top":0.3651237,"width":0.04837101,"height":0.023144454},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@LakyLak","depth":12,"bounds":{"left":0.090259306,"top":0.3623304,"width":0.013297873,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show options","depth":15,"bounds":{"left":0.3587101,"top":0.36312848,"width":0.007978723,"height":0.02952913},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"LakyLak commented 20 hours ago •","depth":14,"bounds":{"left":0.114527926,"top":0.36312848,"width":0.23620346,"height":0.02952913},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"LakyLak","depth":16,"bounds":{"left":0.114527926,"top":0.37110934,"width":0.01861702,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LakyLak","depth":17,"bounds":{"left":0.114527926,"top":0.37110934,"width":0.01861702,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commented","depth":15,"bounds":{"left":0.13447474,"top":0.37110934,"width":0.025598405,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"20 hours ago","depth":15,"bounds":{"left":0.16140293,"top":0.36951315,"width":0.02825798,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"20 hours ago","depth":17,"bounds":{"left":0.16140293,"top":0.37110934,"width":0.02825798,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"•","depth":17,"bounds":{"left":0.19099069,"top":0.37110934,"width":0.0021609042,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"edited","depth":17,"bounds":{"left":0.19448139,"top":0.36951315,"width":0.020113032,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"edited","depth":19,"bounds":{"left":0.19448139,"top":0.37110934,"width":0.014793883,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"JIRA: JY-20725","depth":16,"bounds":{"left":0.114527926,"top":0.40622506,"width":0.2521609,"height":0.017557861},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"JIRA:","depth":17,"bounds":{"left":0.114527926,"top":0.4066241,"width":0.015957447,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20725","depth":17,"bounds":{"left":0.13048537,"top":0.4066241,"width":0.026928192,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725","depth":18,"bounds":{"left":0.13048537,"top":0.4066241,"width":0.026928192,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Changes:","depth":16,"bounds":{"left":0.114527926,"top":0.44293696,"width":0.2521609,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Changes:","depth":17,"bounds":{"left":0.114527926,"top":0.44293696,"width":0.021276595,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"The purpose is to handle rate limit on search requests (from getPaginatedData) used during activity rematching.","depth":17,"bounds":{"left":0.114527926,"top":0.47126895,"width":0.2408577,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Adds","depth":18,"bounds":{"left":0.12250665,"top":0.5007981,"width":0.012300532,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"HandleHubspotRateLimit","depth":19,"bounds":{"left":0.13480718,"top":0.5007981,"width":0.056349736,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"middleware (release jobs with delay)","depth":18,"bounds":{"left":0.19115691,"top":0.5007981,"width":0.07978723,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Adds","depth":18,"bounds":{"left":0.12250665,"top":0.5203512,"width":0.012300532,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"executeRequest","depth":19,"bounds":{"left":0.13480718,"top":0.5203512,"width":0.036070477,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"wrapper in Hubspot Client. It handles 429 errors and throws","depth":18,"bounds":{"left":0.17087767,"top":0.5203512,"width":0.1314827,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RateLimitException","depth":19,"bounds":{"left":0.3023604,"top":0.5203512,"width":0.043550532,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add or remove reactions","depth":16,"bounds":{"left":0.114527926,"top":0.54868317,"width":0.008643617,"height":0.0207502},"on_screen":true,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"LakyLak","depth":14,"bounds":{"left":0.12250665,"top":0.6141261,"width":0.01861702,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LakyLak","depth":15,"bounds":{"left":0.12250665,"top":0.6141261,"width":0.01861702,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"added","depth":14,"bounds":{"left":0.14112367,"top":0.6141261,"width":0.016123671,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2","depth":14,"bounds":{"left":0.15724733,"top":0.6141261,"width":0.0028257978,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commits","depth":14,"bounds":{"left":0.16007313,"top":0.6141261,"width":0.020944148,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"20 hours ago","depth":14,"bounds":{"left":0.1810173,"top":0.6141261,"width":0.02825798,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"20 hours ago","depth":16,"bounds":{"left":0.1810173,"top":0.6141261,"width":0.02825798,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@LakyLak","depth":12,"bounds":{"left":0.12250665,"top":0.6540303,"width":0.0066489363,"height":0.015961692},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"JY-20725","depth":14,"bounds":{"left":0.13115026,"top":0.6576217,"width":0.019115692,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725","depth":15,"bounds":{"left":0.13115026,"top":0.6576217,"width":0.019115692,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"add HS rate limit handling on activities rematching","depth":14,"bounds":{"left":0.15275931,"top":0.6576217,"width":0.122340426,"height":0.011572227},"on_screen":true,"help_text":"JY-20725 add HS rate limit handling on activities rematching","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"add HS rate limit handling on activities rematching","depth":15,"bounds":{"left":0.15275931,"top":0.6576217,"width":0.122340426,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"8 / 10 checks OK","depth":14,"bounds":{"left":0.3489029,"top":0.6540303,"width":0.005319149,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"44d5678","depth":14,"bounds":{"left":0.35555187,"top":0.6576217,"width":0.016788565,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"44d5678","depth":15,"bounds":{"left":0.35555187,"top":0.6576217,"width":0.016788565,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@LakyLak","depth":12,"bounds":{"left":0.12250665,"top":0.6955307,"width":0.0066489363,"height":0.015961692},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"JY-20725","depth":14,"bounds":{"left":0.13115026,"top":0.69912213,"width":0.019115692,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725","depth":15,"bounds":{"left":0.13115026,"top":0.69912213,"width":0.019115692,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"add tests","depth":14,"bounds":{"left":0.15275931,"top":0.69912213,"width":0.021609042,"height":0.011572227},"on_screen":true,"help_text":"JY-20725 add tests","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"add tests","depth":15,"bounds":{"left":0.15275931,"top":0.69912213,"width":0.021609042,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"11 / 12 checks OK","depth":14,"bounds":{"left":0.3489029,"top":0.6955307,"width":0.005319149,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"cbed2c9","depth":14,"bounds":{"left":0.35555187,"top":0.69912213,"width":0.016788565,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"cbed2c9","depth":15,"bounds":{"left":0.35555187,"top":0.69912213,"width":0.016788565,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@LakyLak","depth":13,"bounds":{"left":0.090259306,"top":0.7426177,"width":0.013297873,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show options","depth":14,"bounds":{"left":0.3587101,"top":0.7434158,"width":0.007978723,"height":0.02952913},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Author","depth":15,"bounds":{"left":0.34075797,"top":0.75259376,"width":0.012965426,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"LakyLak commented 19 hours ago","depth":13,"bounds":{"left":0.114527926,"top":0.7434158,"width":0.21725398,"height":0.02952913},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"LakyLak","depth":15,"bounds":{"left":0.114527926,"top":0.75139666,"width":0.01861702,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LakyLak","depth":16,"bounds":{"left":0.114527926,"top":0.75139666,"width":0.01861702,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commented","depth":14,"bounds":{"left":0.13447474,"top":0.75139666,"width":0.025598405,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"19 hours ago","depth":14,"bounds":{"left":0.16140293,"top":0.7498005,"width":0.027759308,"height":0.016759777},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"19 hours ago","depth":16,"bounds":{"left":0.16140293,"top":0.75139666,"width":0.027759308,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@claude","depth":17,"bounds":{"left":0.114527926,"top":0.7881085,"width":0.019281914,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"@claude","depth":18,"bounds":{"left":0.114527926,"top":0.7881085,"width":0.019281914,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add or remove reactions","depth":15,"bounds":{"left":0.114527926,"top":0.8160415,"width":0.008643617,"height":0.0207502},"on_screen":true,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"react with eyes","depth":14,"bounds":{"left":0.12450133,"top":0.8160415,"width":0.013796543,"height":0.0207502},"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"👀","depth":16,"bounds":{"left":0.12682846,"top":0.82122904,"width":0.004155585,"height":0.012769354},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1","depth":16,"bounds":{"left":0.13347739,"top":0.82122904,"width":0.0018284575,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@claude","depth":13,"bounds":{"left":0.090259306,"top":0.8758978,"width":0.013297873,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false}]...
|
-8020158297898031860
|
-3313006166451391864
|
click
|
accessibility
|
NULL
|
Unnamed Group
TypeError: League\Flysystem\Filesyst Unnamed Group
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
CloudWatch | us-east-2
CloudWatch | us-east-2
Unnamed Group
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
Pipelines - jiminny/app
Pipelines - jiminny/app
Pull requests · jiminny/app
Pull requests · jiminny/app
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
JY-20625 | JY-20742 | MCP POC by yalokin-jiminny · Pull Request #12036 · jiminny/app
Data Explorer
Data Explorer
[JY-20776] Automated report - sentry - Jira
[JY-20776] Automated report - sentry - Jira
Jiminny
Jiminny
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Skip to content
Skip to content
Open menu
Homepage (g then d)
jiminny
jiminny
app
app
Search or jump to…
Type
/
to search
Chat with Copilot
Open Copilot…
Create new...
All issues(g then i)
All pull requests
All repositories
You have unread notifications(g then n)
Open user navigation menu
Repository navigation
Repository navigation
Code
Code
Pull requests (33)
Pull requests
(
33
)
Agents
Agents
Actions
Actions
Wiki
Wiki
Security and quality (4)
Security and quality
(
4
)
Insights
Insights
Settings
Settings
Important update
Important update
On April 24 we'll start using GitHub Copilot interaction data for AI model training unless you opt out.
Review this update
Review this update
and manage your preferences in your
GitHub account settings
GitHub account settings
.
Dismiss banner
JY-20725 add HS rate limit handling on activities rematching #12066 Edit title
JY-20725 add HS rate limit handling on activities rematching
#
12066
Edit title
Unable to merge
Unable to merge
Code
Code
Open
LakyLak
LakyLak
wants to merge 4 commits into
master
master
from
JY-20725-handle-HS-search-rate-limit
JY-20725-handle-HS-search-rate-limit
Copy head branch name to clipboard
Lines changed: 775 additions & 249 deletions
Conversation (7)
Conversation
(
7
)
Commits (4)
Commits
(
4
)
Checks (6)
Checks
(
6
)
Files changed (12)
Files changed
(
12
)
Conversation
Conversation
@LakyLak
Show options
LakyLak commented 20 hours ago •
LakyLak
LakyLak
commented
20 hours ago
20 hours ago
•
edited
edited
JIRA: JY-20725
JIRA:
JY-20725
JY-20725
Changes:
Changes:
The purpose is to handle rate limit on search requests (from getPaginatedData) used during activity rematching.
Adds
HandleHubspotRateLimit
middleware (release jobs with delay)
Adds
executeRequest
wrapper in Hubspot Client. It handles 429 errors and throws
RateLimitException
Add or remove reactions
LakyLak
LakyLak
added
2
commits
20 hours ago
20 hours ago
@LakyLak
JY-20725
JY-20725
add HS rate limit handling on activities rematching
add HS rate limit handling on activities rematching
8 / 10 checks OK
44d5678
44d5678
@LakyLak
JY-20725
JY-20725
add tests
add tests
11 / 12 checks OK
cbed2c9
cbed2c9
@LakyLak
Show options
Author
LakyLak commented 19 hours ago
LakyLak
LakyLak
commented
19 hours ago
19 hours ago
@claude
@claude
Add or remove reactions
react with eyes
👀
1
@claude...
|
24532
|
NULL
|
NULL
|
NULL
|
|
5165
|
183
|
30
|
2026-05-07T14:55:49.753330+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778165749753_m1.jpg...
|
Firefox
|
Platform Sprint 3 Q2 - Platform Team - Scrum Board Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira — Work...
|
True
|
jiminny.atlassian.net/jira/software/c/projects/JY/ jiminny.atlassian.net/jira/software/c/projects/JY/boards/37...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 3 Q2 - Platform Team - Scrum Board Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Close tab
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {"status":"error","message":"You have reached your secondly limit.","errorType":"RATE_LIMIT
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {"status":"error","message":"You have reached your secondly limit.","errorType":"RATE_LIMIT
Service-Desk - Queues - Platform team - Service space - Jira
Service-Desk - Queues - Platform team - Service space - Jira
Jy 20807 check various issues with stages by nikolaybiaivanov · Pull Request #12041 · jiminny/app
Jy 20807 check various issues with stages by nikolaybiaivanov · Pull Request #12041 · jiminny/app
Illuminate\Queue\MaxAttemptsExceededException: Jiminny\Jobs\Activity\DeleteTeamChurnData has been attempted too many times. — jiminny — app
Illuminate\Queue\MaxAttemptsExceededException: Jiminny\Jobs\Activity\DeleteTeamChurnData has been attempted too many times. — jiminny — app
Pull requests · jiminny/app
Pull requests · jiminny/app
Userpilot | Ask Jiminny Report Generated
Userpilot | Ask Jiminny Report Generated
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
Problem loading page
Problem loading page
Search the CRM - HubSpot docs
Search the CRM - HubSpot docs
Jiminny
Jiminny
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Skip to:
Top Bar
Top Bar
Sidebar
Sidebar
Main Content
Main Content
Space navigation
Space navigation
Collapse sidebar [
Collapse sidebar [
Switch sites or apps
Switch sites or apps
Go to your Jira homepage
Search, press enter to navigate to advanced search with your text query
Create
Create
Rovo Ask Rovo
Ask Rovo
Notifications
Notifications
Help
Help
Settings
Settings
[EMAIL]
[EMAIL]
For you
For you
Recent
Recent
Starred
Starred
Apps
Apps
More actions for Apps
More actions for Apps
Spaces
Spaces
Create space
Create space
More actions for spaces
More actions for spaces
Recent
Jiminny (New)
Jiminny (New)
Jiminny (New)
Create board
Create board
More actions for Jiminny (New)
More actions for Jiminny (New)
Platform Team
Platform Team
Board actions
Board actions
Capture Team
Capture Team
Board actions
Board actions
Enterprise Stability Issues 🤕...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Service-Desk - Queues - Platform team - Service space - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Service-Desk - Queues - Platform team - Service space - Jira","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jy 20807 check various issues with stages by nikolaybiaivanov · Pull Request #12041 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jy 20807 check various issues with stages by nikolaybiaivanov · Pull Request #12041 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Illuminate\\Queue\\MaxAttemptsExceededException: Jiminny\\Jobs\\Activity\\DeleteTeamChurnData has been attempted too many times. — jiminny — app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Illuminate\\Queue\\MaxAttemptsExceededException: Jiminny\\Jobs\\Activity\\DeleteTeamChurnData has been attempted too many times. — jiminny — app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pull requests · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Userpilot | Ask Jiminny Report Generated","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Userpilot | Ask Jiminny Report Generated","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Problem loading page","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Problem loading page","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search the CRM - HubSpot docs","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search the CRM - HubSpot docs","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.16770834,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.190625,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.21388888,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.23715279,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.26041666,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Skip to:","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Top Bar","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Top Bar","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Sidebar","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sidebar","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Main Content","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Main Content","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Space navigation","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Space navigation","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse sidebar [","depth":9,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse sidebar [","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Switch sites or apps","depth":10,"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Switch sites or apps","depth":12,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Go to your Jira homepage","depth":9,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXComboBox","text":"Search, press enter to navigate to advanced search with your text query","depth":11,"on_screen":true,"help_text":"","placeholder":"Search","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Create","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Create","depth":12,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Rovo Ask Rovo","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Rovo","depth":14,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Notifications","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notifications","depth":14,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Help","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Help","depth":14,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Settings","depth":12,"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Settings","depth":14,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"lukas.kovalik@jiminny.com","depth":12,"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"lukas.kovalik@jiminny.com","depth":14,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"For you","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"For you","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Recent","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Recent","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Starred","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Starred","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Apps","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Apps","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"More actions for Apps","depth":13,"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More actions for Apps","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Spaces","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"Spaces","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Create space","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Create space","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"More actions for spaces","depth":13,"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More actions for spaces","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Recent","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Jiminny (New)","depth":17,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny (New)","depth":20,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Jiminny (New)","depth":18,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXMenuButton","text":"Create board","depth":18,"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Create board","depth":20,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"More actions for Jiminny (New)","depth":18,"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More actions for Jiminny (New)","depth":20,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Platform Team","depth":19,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":true,"is_selected":false},{"role":"AXStaticText","text":"Platform Team","depth":22,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Board actions","depth":20,"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Board actions","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Capture Team","depth":19,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Capture Team","depth":22,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Board actions","depth":20,"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Board actions","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Enterprise Stability Issues 🤕","depth":19,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false}]...
|
-8019712676333353678
|
-3290320395283307392
|
visual_change
|
accessibility
|
NULL
|
Platform Sprint 3 Q2 - Platform Team - Scrum Board Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Close tab
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {"status":"error","message":"You have reached your secondly limit.","errorType":"RATE_LIMIT
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {"status":"error","message":"You have reached your secondly limit.","errorType":"RATE_LIMIT
Service-Desk - Queues - Platform team - Service space - Jira
Service-Desk - Queues - Platform team - Service space - Jira
Jy 20807 check various issues with stages by nikolaybiaivanov · Pull Request #12041 · jiminny/app
Jy 20807 check various issues with stages by nikolaybiaivanov · Pull Request #12041 · jiminny/app
Illuminate\Queue\MaxAttemptsExceededException: Jiminny\Jobs\Activity\DeleteTeamChurnData has been attempted too many times. — jiminny — app
Illuminate\Queue\MaxAttemptsExceededException: Jiminny\Jobs\Activity\DeleteTeamChurnData has been attempted too many times. — jiminny — app
Pull requests · jiminny/app
Pull requests · jiminny/app
Userpilot | Ask Jiminny Report Generated
Userpilot | Ask Jiminny Report Generated
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app
Problem loading page
Problem loading page
Search the CRM - HubSpot docs
Search the CRM - HubSpot docs
Jiminny
Jiminny
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Skip to:
Top Bar
Top Bar
Sidebar
Sidebar
Main Content
Main Content
Space navigation
Space navigation
Collapse sidebar [
Collapse sidebar [
Switch sites or apps
Switch sites or apps
Go to your Jira homepage
Search, press enter to navigate to advanced search with your text query
Create
Create
Rovo Ask Rovo
Ask Rovo
Notifications
Notifications
Help
Help
Settings
Settings
[EMAIL]
[EMAIL]
For you
For you
Recent
Recent
Starred
Starred
Apps
Apps
More actions for Apps
More actions for Apps
Spaces
Spaces
Create space
Create space
More actions for spaces
More actions for spaces
Recent
Jiminny (New)
Jiminny (New)
Jiminny (New)
Create board
Create board
More actions for Jiminny (New)
More actions for Jiminny (New)
Platform Team
Platform Team
Board actions
Board actions
Capture Team
Capture Team
Board actions
Board actions
Enterprise Stability Issues 🤕...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
20928
|
910
|
3
|
2026-05-11T16:37:09.638357+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778517429638_m1.jpg...
|
Firefox
|
JY-20725 add HS rate limit handling on activities JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app — Work...
|
True
|
github.com/jiminny/app/pull/12066
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
New Tab
New Tab
Jy 20820 es reindex stream model h New Tab
New Tab
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST [URL_WITH_CREDENTIALS]
Show options
LakyLak commented 3 hours ago
LakyLak
LakyLak
commented
3 hours ago
3 hours ago
JIRA: JY-20725
JIRA:
JY-20725
JY-20725
Changes:
Changes:
Adds
HandleHubspotRateLimit
middleware (release jobs with delay)
Adds
executeRequest
wrapper in Hubspot Client. It handles 429 errors and throws
RateLimitException
Add or remove reactions
LakyLak
LakyLak
added
2
commits
4 hours ago
4 hours ago
@LakyLak
JY-20725
JY-20725
add HS rate limit handling on activities rematching
add HS rate limit handling on activities rematching
8 / 10 checks OK
44d5678
44d5678
@LakyLak
JY-20725
JY-20725
add tests
add tests
11 / 12 checks OK
cbed2c9
cbed2c9
@sonarqubecloud
Show options
sonarqubecloud Bot commented 3 hours ago
sonarqubecloud
sonarqubecloud
Bot
commented
3 hours ago
3 hours ago
Quality Gate Failed Quality Gate failed
Quality Gate Failed
Quality Gate failed
Failed conditions
34.4% Coverage on New Code
34.4% Coverage on New Code
(required ≥ 70%)
See analysis details on SonarQube Cloud
See analysis details on SonarQube Cloud
Add or remove reactions
@LakyLak
Show options
Author
LakyLak commented 3 hours ago
LakyLak
LakyLak
commented
3 hours ago
3 hours ago
@claude
@claude
Add or remove reactions
react with eyes
👀
1
@claude
Show options
claude Bot commented 3 hours ago •
claude
claude
Bot
commented
3 hours ago
3 hours ago
•
edited
edited
Claude finished
@LakyLak
@LakyLak
's task in 1m 42s
——
View job
View job
Code Review
Code Review
Completed task
Gathering context
Completed task
Reading changed files
Completed task
Analyzing code quality
Completed task
Posting review feedback
Overall this is a well-thought-out implementation. The circuit-breaker pattern using Redis NX, the jitter for thundering-herd prevention, and the log-sampling strategy are all solid. A few issues worth addressing before merge:
Issues
Issues
1. Batch API calls bypass rate-limit handling
batchReadObjects()
in
Client.php
(lines 296–319) calls the HubSpot batch APIs directly without going through
executeRequest()
. If the batch endpoints return 429s, those exceptions will not set the Redis circuit-breaker and will not be wrapped in
RateLimitException
, so the middleware won't catch them.
// batchReadObjects — no executeRequest() wrapping
$
response
=
$
batchConfig
[
'
api
'
]->
read
(
$
batchReadRequest
);
Copy
Given the search endpoints can also hit rate limits during pagination-heavy rematching, the batch calls could too. Consider wrapping the batch call similarly, or at least catching 429 from batch APIs and converting them to
RateLimitException
.
Fix this →
Fix this →
2. Circuit-breaker key is scoped to CRM config ID, not HubSpot portal
getRateLimitCacheKey()
(
Client.php:120
) returns
hubspot:ratelimit:portal:{configId}
, but
$this->config->getId()
is the CRM
configuration
record ID, not the HubSpot portal/account ID. If multiple CRM configuration records share the same HubSpot portal (e.g. re-connections), each will have its own independent circuit-breaker. A 429 received via config A will not suppress requests from config B even though they share the same quota.
If configs are always 1:1 with portals this is fine, but it's worth confirming or renaming the key to avoid misleading future readers:
// If config IDs == portal IDs, rename to make intent clear:
return
sprintf
(...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"JY-20725 add HS rate limit handling on activities rematching by LakyLak · Pull Request #12066 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pull requests · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Skip to content","depth":6,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Skip to content","depth":7,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Open menu","depth":10,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Homepage (g then d)","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"jiminny","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"jiminny","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"app","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"app","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Search or jump to…","depth":9,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Type","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to search","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Chat with Copilot","depth":10,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"Open Copilot…","depth":9,"on_screen":false,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXMenuButton","text":"Create new...","depth":9,"on_screen":false,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"All issues(g then i)","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"All pull requests","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"All repositories","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"You have unread notifications(g then n)","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open user navigation menu","depth":9,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Repository navigation","depth":9,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Repository navigation","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Code","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Code","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Pull requests (34)","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"34","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Agents","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Agents","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Actions","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Actions","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Wiki","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Wiki","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Security and quality (4)","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Security and quality","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Insights","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Insights","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Settings","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Settings","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Important update","depth":10,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Important update","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"On April 24 we'll start using GitHub Copilot interaction data for AI model training unless you opt out.","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Review this update","depth":10,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Review this update","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"and manage your preferences in your","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"GitHub account settings","depth":10,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"GitHub account settings","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Dismiss banner","depth":9,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"JY-20725 add HS rate limit handling on activities rematching #12066 Edit title","depth":13,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"JY-20725 add HS rate limit handling on activities rematching","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"#","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12066","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Edit title","depth":14,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Awaiting approval","depth":13,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Awaiting approval","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Code","depth":13,"on_screen":false,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Code","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"LakyLak","depth":15,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LakyLak","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"wants to merge 4 commits into","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"master","depth":15,"on_screen":false,"role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"master","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"from","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20725-handle-HS-search-rate-limit","depth":16,"on_screen":false,"role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725-handle-HS-search-rate-limit","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy head branch name to clipboard","depth":16,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Lines changed: 757 additions & 249 deletions","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Conversation (3)","depth":16,"on_screen":false,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Conversation","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Commits (4)","depth":16,"on_screen":false,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Commits","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Checks (2)","depth":16,"on_screen":false,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Checks","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Files changed (12)","depth":16,"on_screen":false,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Files changed","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open","depth":14,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"JY-20725 add HS rate limit handling on activities rematching #12066 LakyLak wants to merge 4 commits into master from JY-20725-handle-HS-search-rate-limit Copy head branch name to clipboard","depth":14,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20725 add HS rate limit handling on activities rematching","depth":16,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725 add HS rate limit handling on activities rematching","depth":17,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"#","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12066","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"LakyLak","depth":18,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LakyLak","depth":19,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"wants to merge 4 commits into","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"master","depth":18,"on_screen":true,"role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"master","depth":19,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"from","depth":19,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20725-handle-HS-search-rate-limit","depth":19,"on_screen":true,"role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725-handle-HS-search-rate-limit","depth":20,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy head branch name to clipboard","depth":19,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Conversation","depth":12,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Conversation","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@LakyLak","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show options","depth":15,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"LakyLak commented 3 hours ago","depth":14,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"LakyLak","depth":16,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LakyLak","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commented","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"3 hours ago","depth":15,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"3 hours ago","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"JIRA: JY-20725","depth":16,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"JIRA:","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20725","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Changes:","depth":16,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Changes:","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Adds","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"HandleHubspotRateLimit","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"middleware (release jobs with delay)","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Adds","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"executeRequest","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"wrapper in Hubspot Client. It handles 429 errors and throws","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RateLimitException","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add or remove reactions","depth":16,"on_screen":false,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"LakyLak","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LakyLak","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"added","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commits","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"4 hours ago","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"4 hours ago","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@LakyLak","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"JY-20725","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"add HS rate limit handling on activities rematching","depth":14,"on_screen":false,"help_text":"JY-20725 add HS rate limit handling on activities rematching","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"add HS rate limit handling on activities rematching","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"8 / 10 checks OK","depth":14,"on_screen":false,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"44d5678","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"44d5678","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@LakyLak","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"JY-20725","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20725","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"add tests","depth":14,"on_screen":false,"help_text":"JY-20725 add tests","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"add tests","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"11 / 12 checks OK","depth":14,"on_screen":false,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"cbed2c9","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"cbed2c9","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@sonarqubecloud","depth":13,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show options","depth":14,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"sonarqubecloud Bot commented 3 hours ago","depth":13,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"sonarqubecloud","depth":15,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"sonarqubecloud","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Bot","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commented","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"3 hours ago","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"3 hours ago","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Quality Gate Failed Quality Gate failed","depth":16,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"Quality Gate Failed","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Quality Gate failed","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Failed conditions","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"34.4% Coverage on New Code","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"34.4% Coverage on New Code","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(required ≥ 70%)","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"See analysis details on SonarQube Cloud","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"See analysis details on SonarQube Cloud","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add or remove reactions","depth":15,"on_screen":false,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"@LakyLak","depth":13,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show options","depth":14,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Author","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"LakyLak commented 3 hours ago","depth":13,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"LakyLak","depth":15,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"LakyLak","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commented","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"3 hours ago","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"3 hours ago","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@claude","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"@claude","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add or remove reactions","depth":15,"on_screen":false,"help_text":"","role_description":"summary","subrole":"AXSummary","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"react with eyes","depth":14,"on_screen":false,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"👀","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@claude","depth":13,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show options","depth":14,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"claude Bot commented 3 hours ago •","depth":13,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"claude","depth":15,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"claude","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Bot","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"commented","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"3 hours ago","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"3 hours ago","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"•","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"edited","depth":16,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"edited","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Claude finished","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"@LakyLak","depth":18,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"@LakyLak","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'s task in 1m 42s","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"——","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"View job","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"View job","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Code Review","depth":16,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Code Review","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Completed task","depth":18,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Gathering context","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Completed task","depth":18,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reading changed files","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Completed task","depth":18,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Analyzing code quality","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Completed task","depth":18,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Posting review feedback","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Overall this is a well-thought-out implementation. The circuit-breaker pattern using Redis NX, the jitter for thundering-herd prevention, and the log-sampling strategy are all solid. A few issues worth addressing before merge:","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Issues","depth":16,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Issues","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Batch API calls bypass rate-limit handling","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"batchReadObjects()","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"in","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Client.php","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(lines 296–319) calls the HubSpot batch APIs directly without going through","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"executeRequest()","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":". If the batch endpoints return 429s, those exceptions will not set the Redis circuit-breaker and will not be wrapped in","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RateLimitException","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", so the middleware won't catch them.","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"// batchReadObjects — no executeRequest() wrapping","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"batchConfig","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"[","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"api","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"]->","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"read","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"batchReadRequest","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":");","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy","depth":17,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Given the search endpoints can also hit rate limits during pagination-heavy rematching, the batch calls could too. Consider wrapping the batch call similarly, or at least catching 429 from batch APIs and converting them to","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RateLimitException","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Fix this →","depth":17,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Fix this →","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. Circuit-breaker key is scoped to CRM config ID, not HubSpot portal","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"getRateLimitCacheKey()","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Client.php:120","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") returns","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"hubspot:ratelimit:portal:{configId}","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", but","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$this->config->getId()","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the CRM","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"configuration","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"record ID, not the HubSpot portal/account ID. If multiple CRM configuration records share the same HubSpot portal (e.g. re-connections), each will have its own independent circuit-breaker. A 429 received via config A will not suppress requests from config B even though they share the same quota.","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"If configs are always 1:1 with portals this is fine, but it's worth confirming or renaming the key to avoid misleading future readers:","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"// If config IDs == portal IDs, rename to make intent clear:","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"return","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"sprintf","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8019343182106796121
|
-1719513105131851068
|
idle
|
accessibility
|
NULL
|
New Tab
New Tab
Jy 20820 es reindex stream model h New Tab
New Tab
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
[JY-20725] [HubSpot] Optimise CRM rematching on delete hubspot accounts/contacts - Jira
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST [URL_WITH_CREDENTIALS]
Show options
LakyLak commented 3 hours ago
LakyLak
LakyLak
commented
3 hours ago
3 hours ago
JIRA: JY-20725
JIRA:
JY-20725
JY-20725
Changes:
Changes:
Adds
HandleHubspotRateLimit
middleware (release jobs with delay)
Adds
executeRequest
wrapper in Hubspot Client. It handles 429 errors and throws
RateLimitException
Add or remove reactions
LakyLak
LakyLak
added
2
commits
4 hours ago
4 hours ago
@LakyLak
JY-20725
JY-20725
add HS rate limit handling on activities rematching
add HS rate limit handling on activities rematching
8 / 10 checks OK
44d5678
44d5678
@LakyLak
JY-20725
JY-20725
add tests
add tests
11 / 12 checks OK
cbed2c9
cbed2c9
@sonarqubecloud
Show options
sonarqubecloud Bot commented 3 hours ago
sonarqubecloud
sonarqubecloud
Bot
commented
3 hours ago
3 hours ago
Quality Gate Failed Quality Gate failed
Quality Gate Failed
Quality Gate failed
Failed conditions
34.4% Coverage on New Code
34.4% Coverage on New Code
(required ≥ 70%)
See analysis details on SonarQube Cloud
See analysis details on SonarQube Cloud
Add or remove reactions
@LakyLak
Show options
Author
LakyLak commented 3 hours ago
LakyLak
LakyLak
commented
3 hours ago
3 hours ago
@claude
@claude
Add or remove reactions
react with eyes
👀
1
@claude
Show options
claude Bot commented 3 hours ago •
claude
claude
Bot
commented
3 hours ago
3 hours ago
•
edited
edited
Claude finished
@LakyLak
@LakyLak
's task in 1m 42s
——
View job
View job
Code Review
Code Review
Completed task
Gathering context
Completed task
Reading changed files
Completed task
Analyzing code quality
Completed task
Posting review feedback
Overall this is a well-thought-out implementation. The circuit-breaker pattern using Redis NX, the jitter for thundering-herd prevention, and the log-sampling strategy are all solid. A few issues worth addressing before merge:
Issues
Issues
1. Batch API calls bypass rate-limit handling
batchReadObjects()
in
Client.php
(lines 296–319) calls the HubSpot batch APIs directly without going through
executeRequest()
. If the batch endpoints return 429s, those exceptions will not set the Redis circuit-breaker and will not be wrapped in
RateLimitException
, so the middleware won't catch them.
// batchReadObjects — no executeRequest() wrapping
$
response
=
$
batchConfig
[
'
api
'
]->
read
(
$
batchReadRequest
);
Copy
Given the search endpoints can also hit rate limits during pagination-heavy rematching, the batch calls could too. Consider wrapping the batch call similarly, or at least catching 429 from batch APIs and converting them to
RateLimitException
.
Fix this →
Fix this →
2. Circuit-breaker key is scoped to CRM config ID, not HubSpot portal
getRateLimitCacheKey()
(
Client.php:120
) returns
hubspot:ratelimit:portal:{configId}
, but
$this->config->getId()
is the CRM
configuration
record ID, not the HubSpot portal/account ID. If multiple CRM configuration records share the same HubSpot portal (e.g. re-connections), each will have its own independent circuit-breaker. A 429 received via config A will not suppress requests from config B even though they share the same quota.
If configs are always 1:1 with portals this is fine, but it's worth confirming or renaming the key to avoid misleading future readers:
// If config IDs == portal IDs, rename to make intent clear:
return
sprintf
(...
|
20926
|
NULL
|
NULL
|
NULL
|
|
22921
|
979
|
14
|
2026-05-12T07:27:01.095712+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-12/1778 /Users/lukas/.screenpipe/data/data/2026-05-12/1778570821095_m2.jpg...
|
QuickTime Player
|
PLanhat Petko interest event 2026-05-11.mp4
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
rewind
play/pause
fast forward
mute
More Controls
rewind
play/pause
fast forward
mute
More Controls
toggle full screen
show external playback menu
show external playback menu
show media selection menu
toggle picture-in-picture playback
show action menu
share
show chapter menu
zoom
zoom
playback speed
03:46
toggle elapsed time, timecode and framecount
04:55
toggle duration and remaining time
document actions
PLanhat Petko interest event 2026-05-11.mp4...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"rewind","depth":1,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXCheckBox","text":"play/pause","depth":1,"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":true},{"role":"AXButton","text":"fast forward","depth":1,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"mute","depth":1,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"More Controls","depth":1,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXCheckBox","text":"toggle full screen","depth":1,"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"show external playback menu","depth":1,"on_screen":true,"role_description":"button","is_focused":false},{"role":"AXButton","text":"show external playback menu","depth":2,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"show media selection menu","depth":1,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"toggle picture-in-picture playback","depth":1,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"show action menu","depth":1,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"share","depth":1,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"show chapter menu","depth":1,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXCheckBox","text":"zoom","depth":1,"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false},{"role":"AXCheckBox","text":"zoom","depth":1,"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"playback speed","depth":1,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"03:46","depth":1,"on_screen":true,"role_description":"text"},{"role":"AXCheckBox","text":"toggle elapsed time, timecode and framecount","depth":1,"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"04:55","depth":1,"on_screen":true,"role_description":"text"},{"role":"AXCheckBox","text":"toggle duration and remaining time","depth":1,"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false},{"role":"AXMenuButton","text":"document actions","depth":1,"bounds":{"left":0.5621675,"top":1.0,"width":0.0033244682,"height":-0.028730989},"on_screen":true,"role_description":"menu button","is_enabled":false,"is_focused":false},{"role":"AXStaticText","text":"PLanhat Petko interest event 2026-05-11.mp4","depth":1,"bounds":{"left":0.46110374,"top":1.0,"width":0.10106383,"height":-0.028730989},"on_screen":true,"role_description":"text"}]...
|
-8017441685240571558
|
5926505682599414388
|
click
|
hybrid
|
NULL
|
rewind
play/pause
fast forward
mute
More Controls
rewind
play/pause
fast forward
mute
More Controls
toggle full screen
show external playback menu
show external playback menu
show media selection menu
toggle picture-in-picture playback
show action menu
share
show chapter menu
zoom
zoom
playback speed
03:46
toggle elapsed time, timecode and framecount
04:55
toggle duration and remaining time
document actions
PLanhat Petko interest event 2026-05-11.mp4
PnostormIavicatecode10019FV faVsco.js?9 JY-20725-handle-HS-search-rate-limitProjectyC) AutomatedReportGenerated.ong© PlaybackController.php(1) MatchDomainBvEmail© OpportunityActivityMa© OpportunitySyncStrate© OpportunitySyncStrate© ProspectCache.php€ ProspectSearchScope© ProspectSearchStrate© ProspectSearchStratec Providerkegistry.pnp€ RecordSelector.phpkesolvecompanyNamc) limererioaiterator.phaImoonuInternal0 Kioskv AutomatedReportsC) ActivitvivoeServiceC) AskJiminnvReportA(C) AutomatedRenortsiC) AutomatedRenorts.(C) DealStadesServiceC) RecioientsService.rE) ReportSort.ohrE) RenortSortDirection(C) KioskService.oho1M Mailom MeptinaGenerator1 NotificationM0Auth2M PecallAm SecurityD StrategyD Streaming_ leamD TelephonvD UserPilot0 Webhook© AbstractService.php© ActivityProviderFactorv.p© ActivitvService.php(C) AoiResoonseService.oho© ConferenceService.ohn(C)InsiahtSeatService.oho(C)InstantMeetinaService.oh(C)IntercomService.oho@ InapiClient.php©) IoaniService.ohr@ DarticinantShareService r 1201(@) PlanhatService nhr@ DlavhackService nhnYC) PlavhackViden@nlvServic 127(C) DlavbaskCotoaan.c.ndPlanhatService.php x:12 v.19 ^= laravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]# console [PRol)A console [STAGING][2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {"neaders.?"Vace".L"Inu,or May 2020 14.21.15 bMl"J,"Transter-Encodinq":"chunked").& console [EU]>0 lll 0supoont Dally • In 41 341cascadePlanhat Event PlaybacThoughtsSearched planhat in ~/iminnylappThoughtsSearched olavback *visitedivisited."olavback in ~/fiminnvlaoo.100% 5• lue 1z May 10-2/*0U+0 ..find planhat event playback visitedreaconly class Plannatservicepublic function -_constructtprivate Rolestatsrepository srolestatsrepository.) (...7/** othrows Guzzle xception */oubuc function trackuser suser strind Sevent, arrav soavload = : vord1f @ Sthis-›servicelsAvailable(Suser->getTeamO->qetPartnerido0)«return:Susen->inadld relations: "team!)Sdata =fInamel => Susen->aetNameollemaili = Susen->aptFmailAddnecs0ll'externalId' => $user->getUuid.'companyExternalId' => Suser->getTeam->getUuidaction = sevent,'info' => $payload.SplanhatResponse = Http::planhatAnaluticsApiO->post url:'analytics/'. confia( key:'services.planhat.tenantUuid'). Sdata):Sthis->loqFailedResponses(SplanhatResponse.message: METHOD"body => solanhatresponse->sonlo'status' => $planhatResponse->status@'data' => Sdatal** athrows Guzzesycention */nublic function meten(lisen Suser. string Sdimension. strina Svalue)• voidf...?** Athrows GuzzleSycention */public function upsertCompany(Team Steam): voidi...}* Athnowe Guz>leSycontion* @throws BindingResolutionExceptionpublic function upsertUser(User Suser): void{...}СОЛРРВРДВВВВВВВВВВВВВВВО"CF-Ray": ["9f80deb8db60dc3a-SOF"]."Strict-Transport-Security":["max-aqe=31536000: includeSubDomains: preload"]."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\","x-content-tvoe-ootions":"nosniff"."x-hubsoot-correlation-id":"019e02d0-6fd8-7812-bdba-885b7ccb3ee3"7."Set-Cookie":["__cf_bm=StUrtdQgXVnik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-[IP_ADDRESS]-rI.ZggtDKxTge5zr8_2gbBfW07-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"),"Renont-To".f"s"endnoints".'\"url\":"https:\V/\V/a.nel.cloudflare.com\\/report\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIx\"group\":\"cf-nel\",\"max_age\":604800}"],"NEL":["{\"success_fraction\":0.01,report to. "cr-nel,|"max agel ":604800}"]"Server": ["cloudflare"]}} {"correlation 1d":"95256555-ec98-4541-b9za-adta/sboyeab"."trace_10":"C/A8565-905t-4604-9405-0e5b551e5545',Soarched pl.Searched visited in aprThouahtslFound it in PlaybackController.php :Read DlavbackController.nhn #| 85-114Location:Plavbackcontroller.0no:95-168oho.*Cendina InlavbackVicitedl event to Planhat without clowina +hedeferlfn = Sthis->olanhatService-strack(user. Suserpay load:'activityld' = Sactivity->getId(),activitvluid' = sactivity-saetluido.-salwavs@)Contovt. Collod in tha niavhaak nado controllor wronnod in doforl to firo tha Dlanhat avant scunchronduely aftor thoHTTP response is sent to avoid slowina down the user experience.Oal ***Jed daily usage quota is exhausted. Purchase extra usage to continue usina premium models. Quota resets May 12, 11:00"AN CUTYAsk anvthina (84L)÷ @Code SWF-1.620-17JUTE.Afo 4 spaces...
|
22919
|
/Volumes/Work/2026/PLanhat Petko interest event 20 /Volumes/Work/2026/PLanhat Petko interest event 2026-05-11.mp4...
|
NULL
|
NULL
|
|
20392
|
881
|
18
|
2026-05-11T15:21:38.857995+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778512898857_m2.jpg...
|
PhpStorm
|
faVsco.js – ClientTest.php
|
True
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
ClientTest
Rerun 'PHPUnit: ClientTest'
Debug 'ClientTest'
Stop 'ClientTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
19
144
11
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Tests\Unit\Services\Crm\Hubspot;
use GuzzleHttp\Psr7\Response;
use HubSpot\Client\Crm\Associations\Api\BatchApi;
use HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId;
use HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti;
use HubSpot\Client\Crm\Associations\Model\PublicObjectId;
use HubSpot\Client\Crm\Companies\ApiException as CompanyApiException;
use HubSpot\Client\Crm\Contacts\ApiException as ContactApiException;
use HubSpot\Client\Crm\Deals\Api\BasicApi as DealsBasicApi;
use HubSpot\Client\Crm\Deals\ApiException as DealApiException;
use HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations as DealWithAssociations;
use HubSpot\Client\Crm\Pipelines\Api\PipelinesApi;
use HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipeline;
use HubSpot\Client\Crm\Pipelines\Model\Error;
use HubSpot\Client\Crm\Pipelines\Model\Pipeline;
use HubSpot\Client\Crm\Pipelines\Model\PipelineStage;
use HubSpot\Client\Crm\Properties\Api\CoreApi;
use HubSpot\Client\Crm\Properties\Model\Property;
use HubSpot\Discovery as HubSpotDiscovery;
use HubSpot\Discovery\Crm\Deals\Discovery as DealsDiscovery;
use Jiminny\Exceptions\RateLimitException;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\SocialAccount;
use Jiminny\Services\Crm\Hubspot\Client;
use Jiminny\Services\Crm\Hubspot\HubspotTokenManager;
use Jiminny\Services\Crm\Hubspot\Pagination\HubspotPaginationService;
use Jiminny\Services\SocialAccountService;
use League\OAuth2\Client\Token\AccessToken;
use Mockery;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
use SevenShores\Hubspot\Endpoints\Engagements;
use SevenShores\Hubspot\Exceptions\BadRequest;
use SevenShores\Hubspot\Factory;
use SevenShores\Hubspot\Http\Client as HubspotClient;
use SevenShores\Hubspot\Http\Response as HubspotResponse;
/**
* @runTestsInSeparateProcesses
*
* @preserveGlobalState disabled
*/
class ClientTest extends TestCase
{
private const string RESPONSE_TYPE_STAGE_FIELD = 'stage';
private const string RESPONSE_TYPE_PIPELINE_FIELD = 'pipeline';
private const string RESPONSE_TYPE_REGULAR_FIELD = 'regular';
/**
* @var Client&MockObject
*/
private Client $client;
private Configuration $config;
/**
* @var SocialAccountService&MockObject
*/
private SocialAccountService $socialAccountServiceMock;
/**
* @var HubspotPaginationService&MockObject
*/
private HubspotPaginationService $paginationServiceMock;
/**
* @var HubspotTokenManager&MockObject
*/
private HubspotTokenManager $tokenManagerMock;
/**
* @var CoreApi&MockObject
*/
private CoreApi $coreApiMock;
/**
* @var PipelinesApi&MockObject
*/
private PipelinesApi $pipelinesApiMock;
/**
* @var BatchApi&MockObject
*/
private BatchApi $associationsBatchApiMock;
/**
* @var DealsBasicApi&MockObject
*/
private DealsBasicApi $dealsBasicApiMock;
/**
* @var Engagements&MockObject
*/
private $engagementsMock;
/**
* @var HubspotClient&MockObject
*/
private HubspotClient $hubspotClientMock;
protected function setUp(): void
{
// Create mocks for dependencies
$this->socialAccountServiceMock = $this->createMock(SocialAccountService::class);
$this->paginationServiceMock = $this->createMock(HubspotPaginationService::class);
$this->tokenManagerMock = $this->createMock(HubspotTokenManager::class);
// Create a real Client instance with mocked dependencies
// Create a partial mock only for the methods we need to mock
$client = $this->createPartialMock(Client::class, ['getInstance', 'getNewInstance', 'makeRequest']);
$client->setLogger(new NullLogger());
// Inject the real dependencies using reflection
$reflection = new \ReflectionClass(Client::class);
$accountServiceProperty = $reflection->getProperty('accountService');
$accountServiceProperty->setAccessible(true);
$accountServiceProperty->setValue($client, $this->socialAccountServiceMock);
$paginationServiceProperty = $reflection->getProperty('paginationService');
$paginationServiceProperty->setAccessible(true);
$paginationServiceProperty->setValue($client, $this->paginationServiceMock);
$tokenManagerProperty = $reflection->getProperty('tokenManager');
$tokenManagerProperty->setAccessible(true);
$tokenManagerProperty->setValue($client, $this->tokenManagerMock);
$factoryMock = $this->createMock(Factory::class);
$hubspotClientMock = $this->createMock(HubspotClient::class);
$engagementsMock = $this->createMock(\SevenShores\Hubspot\Endpoints\Engagements::class);
$factoryMock->method('getClient')->willReturn($hubspotClientMock);
$factoryMock->method('__call')->with('engagements')->willReturn($engagementsMock);
$client->method('getInstance')->willReturn($factoryMock);
$discoveryMock = $this->createMock(HubSpotDiscovery\Discovery::class);
$crmMock = $this->createMock(HubSpotDiscovery\Crm\Discovery::class);
$associationsMock = $this->createMock(HubSpotDiscovery\Crm\Associations\Discovery::class);
$propertiesMock = $this->createMock(HubSpotDiscovery\Crm\Properties\Discovery::class);
$pipelinesMock = $this->createMock(HubSpotDiscovery\Crm\Pipelines\Discovery::class);
$coreApiMock = $this->createMock(CoreApi::class);
$pipelinesApiMock = $this->createMock(PipelinesApi::class);
$associationsBatchApiMock = $this->createMock(BatchApi::class);
$dealsBasicApiMock = $this->createMock(DealsBasicApi::class);
$propertiesMock->method('__call')->with('coreApi')->willReturn($coreApiMock);
$pipelinesMock->method('__call')->with('pipelinesApi')->willReturn($pipelinesApiMock);
$associationsMock->method('__call')->with('batchApi')->willReturn($associationsBatchApiMock);
$dealsDiscoveryMock = $this->createMock(DealsDiscovery::class);
$dealsDiscoveryMock->method('__call')->with('basicApi')->willReturn($dealsBasicApiMock);
$returnMap = ['properties' => $propertiesMock, 'pipelines' => $pipelinesMock, 'associations' => $associationsMock, 'deals' => $dealsDiscoveryMock];
$crmMock->method('__call')
->willReturnCallback(static fn (string $name) => $returnMap[$name])
;
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client->method('getNewInstance')->willReturn($discoveryMock);
$this->client = $client;
$this->config = $this->createMock(Configuration::class);
$this->client->setConfiguration($this->config);
$this->coreApiMock = $coreApiMock;
$this->pipelinesApiMock = $pipelinesApiMock;
$this->associationsBatchApiMock = $associationsBatchApiMock;
$this->dealsBasicApiMock = $dealsBasicApiMock;
$this->engagementsMock = $engagementsMock;
$this->hubspotClientMock = $hubspotClientMock;
}
public function testGetMinimumApiVersion(): void
{
$this->assertIsString($this->client->getMinimumApiVersion());
}
public function testGetInstance(): void
{
$socialAccountService = $this->createMock(SocialAccountService::class);
$paginationService = $this->createMock(HubspotPaginationService::class);
$tokenManager = $this->createMock(HubspotTokenManager::class);
$client = new Client($socialAccountService, $paginationService, $tokenManager);
$client->setBaseUrl('[URL_WITH_CREDENTIALS] The class CollectionResponsePipeline will be deprecated in the next Hubspot version
*/
$this->pipelinesApiMock
->method('getAll')
->with('deals')
->willReturn(new CollectionResponsePipeline([
'results' => [$this->generatePipeline()],
]))
;
$this->assertEquals(
[
['id' => 'foo', 'label' => 'bar'],
['id' => 'baz', 'label' => 'qux'],
],
$this->client->fetchOpportunityPipelineStages()
);
}
public function testFetchOpportunityPipelineStagesErrorResponse(): void
{
$this->pipelinesApiMock
->method('getAll')
->with('deals')
->willReturn(new Error(['message' => 'test error']))
;
$this->assertEmpty($this->client->fetchOpportunityPipelineStages());
}
#[\PHPUnit\Framework\Attributes\DataProvider('meetingOutcomeFieldProvider')]
public function testFetchMeetingOutcomeFieldOptions(string $fieldId, string $expectedEndpoint): void
{
$field = new Field(['crm_provider_id' => $fieldId]);
$this->hubspotClientMock
->expects($this->once())
->method('request')
->with('GET', $expectedEndpoint)
->willReturn($this->generateHubSpotResponse(
[
'options' => [
['value' => 'option_1', 'label' => 'Option 1', 'displayOrder' => 0],
['value' => 'option_2', 'label' => 'Option 2', 'displayOrder' => 1],
['value' => 'option_3', 'label' => 'Option 3', 'displayOrder' => 2],
],
]
))
;
$this->assertEquals(
[
['id' => 'option_1', 'value' => 'option_1', 'label' => 'Option 1', 'display_order' => 0],
['id' => 'option_2', 'value' => 'option_2', 'label' => 'Option 2', 'display_order' => 1],
['id' => 'option_3', 'value' => 'option_3', 'label' => 'Option 3', 'display_order' => 2],
],
$this->client->fetchMeetingOutcomeFieldOptions($field)
);
}
public static function meetingOutcomeFieldProvider(): array
{
return [
'meeting outcome field' => [
'meetingOutcome',
'[URL_WITH_CREDENTIALS] The class CollectionResponsePipeline will be deprecated in the next Hubspot version
*/
$pipelineStagesResponse = new CollectionResponsePipeline([
'results' => [$this->generatePipeline()],
]);
$this->pipelinesApiMock
->method('getAll')
->willReturn($pipelineStagesResponse);
}
if ($type === self::RESPONSE_TYPE_PIPELINE_FIELD) {
$field->method('isStageField')->willReturn(false);
$field->method('isPipelineField')->willReturn(true);
$pipelineResponse = $this->generateHubSpotResponse([
'results' => [
['id' => '123', 'label' => 'Sales'],
['id' => 'default', 'label' => 'CS'],
],
]);
$this->client
->method('makeRequest')
->with('/crm/v3/pipelines/deals')
->willReturn($pipelineResponse);
}
$this->assertEquals(
$responses[$type],
$this->client->fetchOpportunityFieldOptions($field)
);
}
public static function opportunityFieldOptionsProvider(): array
{
return [
'stage field' => [
'field' => new Field(['crm_provider_id' => 'dealstage']),
'type' => self::RESPONSE_TYPE_STAGE_FIELD,
],
'pipeline field' => [
'field' => new Field(['crm_provider_id' => 'pipeline']),
'type' => self::RESPONSE_TYPE_PIPELINE_FIELD,
],
'regular field' => [
'field' => new Field(['crm_provider_id' => 'some_property']),
'type' => self::RESPONSE_TYPE_REGULAR_FIELD,
],
];
}
private function generateHubSpotResponse(array $data): HubspotResponse
{
return new HubspotResponse(new Response(200, [], json_encode($data)));
}
private function generateProperty(): Property
{
return new Property([
'name' => 'some_property',
'options' => [
[
'label' => 'label_1',
'value' => 'value_1',
],
[
'label' => 'label_2',
'value' => 'value_2',
],
],
]);
}
private function generatePipeline(): Pipeline
{
return new Pipeline(['stages' => [
new PipelineStage(['id' => 'foo', 'label' => 'bar']),
new PipelineStage(['id' => 'baz', 'label' => 'qux']),
]]);
}
public function testFetchOpportunityPipelines(): void
{
$this->client
->method('makeRequest')
->with('/crm/v3/pipelines/deals')
->willReturn($this->generateHubSpotResponse([
'results' => [
['id' => 'id_1', 'label' => 'Option 1', 'displayOrder' => 0],
['id' => 'id_2', 'label' => 'Option 2', 'displayOrder' => 1],
['id' => 'id_3', 'label' => 'Option 3', 'displayOrder' => 2],
],
]));
$this->assertEquals(
[
['id' => 'id_1', 'label' => 'Option 1'],
['id' => 'id_2', 'label' => 'Option 2'],
['id' => 'id_3', 'label' => 'Option 3'],
],
$this->client->fetchOpportunityPipelines()
);
}
public function testGetPaginatedData(): void
{
$expectedResults = [
['id' => 'id_1', 'properties' => []],
['id' => 'id_2', 'properties' => []],
['id' => 'id_3', 'properties' => []],
];
// Mock the pagination service to return a generator and modify reference parameters
$this->paginationServiceMock
->expects($this->once())
->method('getPaginatedDataGenerator')
->with(
$this->client,
['payload_key' => 'payload_value'],
'foobar',
0,
$this->anything(),
$this->anything()
)
->willReturnCallback(function ($client, $payload, $type, $offset, &$total, &$lastRecordId) use ($expectedResults) {
$total = 3;
$lastRecordId = 'id_3';
foreach ($expectedResults as $result) {
yield $result;
}
});
$this->assertEquals(
[
'results' => $expectedResults,
'total' => 3,
'last_record' => 'id_3',
],
$this->client->getPaginatedData(['payload_key' => 'payload_value'], 'foobar')
);
}
public function testGetAssociationsData(): void
{
$ids = ['1', '2', '3'];
$fromObject = 'deals';
$toObject = 'contacts';
$responseResults = [];
foreach ($ids as $id) {
$from = new PublicObjectId();
$from->setId($id);
$to1 = new PublicObjectId();
$to1->setId('contact_' . $id . '_1');
$to2 = new PublicObjectId();
$to2->setId('contact_' . $id . '_2');
$result = new \HubSpot\Client\Crm\Associations\Model\PublicAssociationMulti();
$result->setFrom($from);
$result->setTo([$to1, $to2]);
$responseResults[] = $result;
}
$batchResponse = new BatchResponsePublicAssociationMulti();
$batchResponse->setResults($responseResults);
$this->associationsBatchApiMock->expects($this->once())
->method('read')
->with(
$this->equalTo($fromObject),
$this->equalTo($toObject),
$this->callback(function (BatchInputPublicObjectId $batchInput) use ($ids) {
$inputIds = array_map(
fn ($input) => $input->getId(),
$batchInput->getInputs()
);
return $inputIds === $ids;
})
)
->willReturn($batchResponse);
$result = $this->client->getAssociationsData($ids, $fromObject, $toObject);
$expectedResult = [
'1' => ['contact_1_1', 'contact_1_2'],
'2' => ['contact_2_1', 'contact_2_2'],
'3' => ['contact_3_1', 'contact_3_2'],
];
$this->assertEquals($expectedResult, $result);
}
public function testGetAssociationsDataHandlesException(): void
{
$ids = ['1', '2', '3'];
$fromObject = 'deals';
$toObject = 'contacts';
$exception = new \Exception('API Error');
$this->associationsBatchApiMock->expects($this->once())
->method('read')
->with(
$this->equalTo($fromObject),
$this->equalTo($toObject),
$this->callback(function ($batchInput) use ($ids) {
return $batchInput instanceof \HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId
&& count($batchInput->getInputs()) === count($ids);
})
)
->willThrowException($exception);
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with(
'[Hubspot] Failed to fetch associations',
[
'from_object' => $fromObject,
'to_object' => $toObject,
'reason' => 'API Error',
]
);
$this->client->setLogger($loggerMock);
$result = $this->client->getAssociationsData($ids, $fromObject, $toObject);
$this->assertEmpty($result);
$this->assertIsArray($result);
}
public function testGetAssociationsDataWithLargeDataSet(): void
{
$ids = array_map(fn ($i) => (string) $i, range(1, 2500)); // More than 1000 items
$fromObject = 'deals';
$toObject = 'contacts';
$firstBatchResponse = new BatchResponsePublicAssociationMulti();
$firstBatchResults = array_map(function ($id) {
$from = new PublicObjectId();
$from->setId($id);
$to = new PublicObjectId();
$to->setId('contact_' . $id);
$result = new \HubSpot\Client\Crm\Associations\Model\PublicAssociationMulti();
$result->setFrom($from);
$result->setTo([$to]);
return $result;
}, array_slice($ids, 0, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));
$firstBatchResponse->setResults($firstBatchResults);
$secondBatchResponse = new BatchResponsePublicAssociationMulti();
$secondBatchResults = array_map(function ($id) {
$from = new PublicObjectId();
$from->setId($id);
$to = new PublicObjectId();
$to->setId('contact_' . $id);
$result = new \HubSpot\Client\Crm\Associations\Model\PublicAssociationMulti();
$result->setFrom($from);
$result->setTo([$to]);
return $result;
}, array_slice($ids, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));
$secondBatchResponse->setResults($secondBatchResults);
$this->associationsBatchApiMock->expects($this->exactly(3))
->method('read')
->willReturnOnConsecutiveCalls($firstBatchResponse, $secondBatchResponse);
$result = $this->client->getAssociationsData($ids, $fromObject, $toObject);
$this->assertCount(2500, $result);
$this->assertArrayHasKey('1', $result);
$this->assertArrayHasKey('2500', $result);
$this->assertEquals(['contact_1'], $result['1']);
$this->assertEquals(['contact_2500'], $result['2500']);
}
public function testGetContactByEmailSuccess(): void
{
$email = '[EMAIL]';
$fields = ['firstname', 'lastname', 'email'];
$contactMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations::class);
$contactMock->method('getId')->willReturn('12345');
$contactMock->method('getProperties')->willReturn([
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[EMAIL]',
]);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($email, 'firstname,lastname,email', null, false, 'email')
->willReturn($contactMock);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new NullLogger());
$result = $client->getContactByEmail($email, $fields);
$this->assertEquals([
'id' => '12345',
'properties' => [
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[EMAIL]',
],
], $result);
}
public function testGetContactByEmailWithEmptyFields(): void
{
$email = '[EMAIL]';
$fields = [];
$contactMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations::class);
$contactMock->method('getId')->willReturn('12345');
$contactMock->method('getProperties')->willReturn(['email' => '[EMAIL]']);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($email, '', null, false, 'email')
->willReturn($contactMock);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new NullLogger());
$result = $client->getContactByEmail($email, $fields);
$this->assertEquals([
'id' => '12345',
'properties' => ['email' => '[EMAIL]'],
], $result);
}
public function testGetContactByEmailApiException(): void
{
$email = '[EMAIL]';
$fields = ['firstname', 'lastname'];
$exception = new \HubSpot\Client\Crm\Contacts\ApiException('Contact not found', 404);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($email, 'firstname,lastname', null, false, 'email')
->willThrowException($exception);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('info')
->with(
'[Hubspot] Failed to fetch contact',
[
'email' => $email,
'reason' => 'Contact not found',
]
);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger($loggerMock);
$result = $client->getContactByEmail($email, $fields);
$this->assertEquals([], $result);
}
public function testGetOpportunityById(): void
{
$opportunityId = '12345';
$expectedProperties = [
'dealname' => 'Test Opportunity',
'amount' => '1000.00',
'closedate' => '2024-12-31T23:59:59.999Z',
'dealstage' => 'presentationscheduled',
'pipeline' => 'default',
];
$mockHubspotOpportunity = $this->createMock(DealWithAssociations::class);
$mockHubspotOpportunity->method('getProperties')->willReturn((object) $expectedProperties);
$mockHubspotOpportunity->method('getId')->willReturn($opportunityId);
$now = new \DateTimeImmutable();
$mockHubspotOpportunity->method('getCreatedAt')->willReturn($now);
$mockHubspotOpportunity->method('getUpdatedAt')->willReturn($now);
$mockHubspotOpportunity->method('getArchived')->willReturn(false);
$this->dealsBasicApiMock
->expects($this->once())
->method('getById')
->willReturn($mockHubspotOpportunity);
// Assuming Client::getOpportunityById processes the SimplePublicObject and returns an associative array.
// The structure might be like: ['id' => ..., 'properties' => [...], 'createdAt' => ..., ...]
// Adjust assertions below based on the actual return structure of your method.
$result = $this->client->getOpportunityById($opportunityId, ['test', 'test']);
$this->assertIsArray($result);
$this->assertArrayHasKey('id', $result);
$this->assertEquals($opportunityId, $result['id']);
}
public function testGetContactById(): void
{
$crmId = 'contact-123';
$fields = ['firstname', 'lastname'];
$expectedProperties = ['firstname' => 'John', 'lastname' => 'Doe'];
$mockContact = $this->createMock(\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations::class);
$mockContact->method('getId')->willReturn($crmId);
$mockContact->method('getProperties')->willReturn((object) $expectedProperties);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($crmId, 'firstname,lastname')
->willReturn($mockContact);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new \Psr\Log\NullLogger());
$result = $client->getContactById($crmId, $fields);
$this->assertIsArray($result);
$this->assertArrayHasKey('id', $result);
$this->assertArrayHasKey('properties', $result);
$this->assertEquals($crmId, $result['id']);
$this->assertEquals((object) $expectedProperties, $result['properties']);
}
public function testGetAccountById(): void
{
$crmId = 'account-123';
$fields = ['name', 'industry'];
$expectedProperties = ['name' => 'Acme Corp', 'industry' => 'Technology'];
$mockCompany = $this->createMock(\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations::class);
$mockCompany->method('getId')->willReturn($crmId);
$mockCompany->method('getProperties')->willReturn((object) $expectedProperties);
$companiesApiMock = $this->createMock(\HubSpot\Client\Crm\Companies\Api\BasicApi::class);
$companiesApiMock->expects($this->once())
->method('getById')
->with($crmId, 'name,industry')
->willReturn($mockCompany);
$companiesDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Companies\Discovery::class);
$companiesDiscoveryMock->method('__call')->with('basicApi')->willReturn($companiesApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($companiesDiscoveryMock) {
if ($name === 'companies') {
return $companiesDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new \Psr\Log\NullLogger());
$result = $client->getAccountById($crmId, $fields);
$this->assertIsArray($result);
$this->assertArrayHasKey('id', $result);
$this->assertArrayHasKey('properties', $result);
$this->assertEquals($crmId, $result['id']);
$this->assertEquals((object) $expectedProperties, $result['properties']);
}
public function testEnsureValidTokenWithNoTokenUpdate(): void
{
$socialAccountMock = $this->createMock(SocialAccount::class);
// Set up OAuth account
$reflection = new \ReflectionClass($this->client);
$oauthAccountProperty = $reflection->getProperty('oauthAccount');
$oauthAccountProperty->setAccessible(true);
$oauthAccountProperty->setValue($this->client, $socialAccountMock);
$originalToken = 'original_token';
$accessTokenProperty = $reflection->getProperty('accessToken');
$accessTokenProperty->setAccessible(true);
$accessTokenProperty->setValue($this->client, $originalToken);
// Mock token manager to return null (no refresh needed)
$this->tokenManagerMock
->expects($this->once())
->method('ensureValidToken')
->with($socialAccountMock)
->willReturn(null);
// Call ensureValidToken
$this->client->ensureValidToken();
// Verify access token was not changed
$this->assertEquals($originalToken, $accessTokenProperty->getValue($this->client));
}
public function testGetPaginatedDataGeneratorDelegatesToPaginationService(): void
{
$payload = ['filters' => []];
$type = 'contacts';
$offset = 0;
$total = 0;
$lastRecordId = null;
$expectedResults = [
['id' => 'id_1', 'properties' => []],
['id' => 'id_2', 'properties' => []],
];
// Mock the pagination service to return a generator
$this->paginationServiceMock
->expects($this->once())
->method('getPaginatedDataGenerator')
->with(
$this->client,
$payload,
$type,
$offset,
$this->anything(),
$this->anything()
)
->willReturnCallback(function () use ($expectedResults) {
foreach ($expectedResults as $result) {
yield $result;
}
});
// Execute the pagination
$results = [];
foreach ($this->client->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastRecordId) as $result) {
$results[] = $result;
}
$this->assertCount(2, $results);
$this->assertEquals('id_1', $results[0]['id']);
$this->assertEquals('id_2', $results[1]['id']);
}
public function testEnsureValidTokenDelegatesToTokenManager(): void
{
$socialAccountMock = $this->createMock(SocialAccount::class);
// Set up OAuth account
$reflection = new \ReflectionClass($this->client);
$oauthAccountProperty = $reflection->getProperty('oauthAccount');
$oauthAccountProperty->setAccessible(true);
$oauthAccountProperty->setValue($this->client, $socialAccountMock);
// Mock token manager to return new token
$this->tokenManagerMock
->expects($this->once())
->method('ensureValidToken')
->with($socialAccountMock)
->willReturn('new_access_token');
// Call ensureValidToken
$this->client->ensureValidToken();
// Verify access token was updated
$accessTokenProperty = $reflection->getProperty('accessToken');
$accessTokenProperty->setAccessible(true);
$this->assertEquals('new_access_token', $accessTokenProperty->getValue($this->client));
}
public function testGetOwnersArchivedWithValidResponse(): void
{
$responseData = [
'results' => [
[
'id' => '123',
'email' => '[EMAIL]',
'type' => 'PERSON',
'firstName' => 'John',
'lastName' => 'Doe',
'userId' => 456,
'userIdIncludingInactive' => 789,
'createdAt' => '2023-01-01T12:00:00Z',
'updatedAt' => '2023-01-02T12:00:00Z',
'archived' => true,
],
],
];
// Create a mock response object
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willReturn($responseData);
// Set up the client to return our test data
$this->client->method('makeRequest')
->with(
'/crm/v3/owners',
'GET',
[],
'archived=true'
)
->willReturn($response);
// Call the method
$result = $this->client->getOwnersArchived(true);
// Assert the results
$this->assertCount(1, $result);
$this->assertEquals('123', $result[0]->getId());
$this->assertEquals('[EMAIL]', $result[0]->getEmail());
$this->assertEquals('John Doe', $result[0]->getFullName());
$this->assertTrue($result[0]->isArchived());
}
public function testGetOwnersArchivedWithEmptyResponse(): void
{
// Create a mock response object with empty results
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willReturn(['results' => []]);
// Set up the client to return empty results
$this->client->method('makeRequest')
->with(
'/crm/v3/owners',
'GET',
[],
'archived=false'
)
->willReturn($response);
// Call the method
$result = $this->client->getOwnersArchived(false);
// Assert the results
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testGetOwnersArchivedWithInvalidResponse(): void
{
// Create a mock response that will throw an exception when toArray is called
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willThrowException(new \InvalidArgumentException('Invalid JSON'));
// Set up the client to return the problematic response
$this->client->method('makeRequest')
->willReturn($response);
// Mock the logger to expect an error message
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with($this->stringContains('Failed to fetch owners'));
$reflection = new \ReflectionClass($this->client);
$loggerProperty = $reflection->getProperty('log');
$loggerProperty->setAccessible(true);
$loggerProperty->setValue($this->client, $loggerMock);
// Call the method and expect an empty array on error
$result = $this->client->getOwnersArchived(true);
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testGetOwnersArchivedWithHttpError(): void
{
// Set up the client to throw an exception
$this->client->method('makeRequest')
->willThrowException(new \Exception('HTTP Error'));
// Mock the logger to expect an error message
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with($this->stringContains('Failed to fetch owners'));
$reflection = new \ReflectionClass($this->client);
$loggerProperty = $reflection->getProperty('log');
$loggerProperty->setAccessible(true);
$loggerProperty->setValue($this->client, $loggerMock);
// Call the method and expect an empty array on error
$result = $this->client->getOwnersArchived(false);
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testGetOwnersArchivedWithOwnerCreationException(): void
{
$responseData = [
'results' => [
[
'id' => '123',
'email' => '[EMAIL]',
'type' => 'PERSON',
'firstName' => 'John',
'lastName' => 'Doe',
'userId' => 456,
'userIdIncludingInactive' => 789,
'createdAt' => '2023-01-01T12:00:00Z',
'updatedAt' => '2023-01-02T12:00:00Z',
'archived' => false,
],
[
'id' => '456',
'email' => '[EMAIL]',
'type' => 'PERSON',
'createdAt' => 'invalid-date-format',
],
[
'id' => '789',
'email' => '[EMAIL]',
'type' => 'PERSON',
'firstName' => 'Jane',
'lastName' => 'Smith',
'userId' => 999,
'userIdIncludingInactive' => 888,
'createdAt' => '2023-01-03T12:00:00Z',
'updatedAt' => '2023-01-04T12:00:00Z',
'archived' => false,
],
],
];
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willReturn($responseData);
$this->client->method('makeRequest')
->with(
'/crm/v3/owners',
'GET',
[],
'archived=false'
)
->willReturn($response);
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with(
'[HubSpot] Failed to process owner data',
$this->callback(function ($context) {
return isset($context['result']) &&
isset($context['error']) &&
$context['result']['id'] === '456' &&
$context['result']['email'] === '[EMAIL]' &&
str_contains($context['error'], 'invalid-date-format');
})
);
$reflection = new \ReflectionClass($this->client);
$loggerProperty = $reflection->getProperty('log');
$loggerProperty->setAccessible(true);
$loggerProperty->setValue($this->client, $loggerMock);
$result = $this->client->getOwnersArchived(false);
$this->assertIsArray($result);
$this->assertCount(2, $result);
$this->assertEquals('123', $result[0]->getId());
$this->assertEquals('[EMAIL]', $result[0]->getEmail());
$this->assertEquals('789', $result[1]->getId());
$this->assertEquals('[EMAIL]', $result[1]->getEmail());
}
public function testMakeRequestWithGetMethod(): void
{
$socialAccountService = $this->createMock(SocialAccountService::class);
$paginationService = $this->createMock(HubspotPaginationService::class);
$tokenManager = $this->createMock(HubspotTokenManager::class);
$psrResponse = new Response(200, [], json_encode(['status' => 'success']));
$expectedResponse = new HubspotResponse($psrResponse);
$hubspotClientMock = $this->createMock(HubspotClient::class);
$hubspotClientMock->expects($this->once())
->method('request')
->with(
'GET',
'https://api.hubapi.com/crm/v3/objects/contacts',
[],
null,
true
)
->willReturn($expectedResponse);
$factoryMock = $this->createMock(Factory::class);
$factoryMock->method('getClient')->willReturn($hubspotClientMock);
$client = $this->getMockBuilder(Client::class)
->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])
->onlyMethods(['getInstance'])
->getMock();
$client->method('getInstance')->willReturn($factoryMock);
$client->setAccessToken(new AccessToken(['access_token' => 'test_token']));
$result = $client->makeRequest('/crm/v3/objects/contacts', 'GET');
$this->assertSame($expectedResponse, $result);
}
public function testMakeRequestWithGetMethodAndQueryString(): void
{
$socialAccountService = $this->createMock(SocialAccountService::class);
$paginationService = $this->createMock(HubspotPaginationService...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.09541223,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8597075,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"ClientTest","depth":6,"bounds":{"left":0.875,"top":0.019952115,"width":0.04055851,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Rerun 'PHPUnit: ClientTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'ClientTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Stop 'ClientTest'","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9494681,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"19","depth":4,"bounds":{"left":0.50265956,"top":0.17478053,"width":0.009640957,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"144","depth":4,"bounds":{"left":0.5142952,"top":0.17478053,"width":0.011968086,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"11","depth":4,"bounds":{"left":0.52825797,"top":0.17478053,"width":0.008976064,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.53889626,"top":0.17318435,"width":0.00731383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.5462101,"top":0.17318435,"width":0.006981383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Tests\\Unit\\Services\\Crm\\Hubspot;\n\nuse GuzzleHttp\\Psr7\\Response;\nuse HubSpot\\Client\\Crm\\Associations\\Api\\BatchApi;\nuse HubSpot\\Client\\Crm\\Associations\\Model\\BatchInputPublicObjectId;\nuse HubSpot\\Client\\Crm\\Associations\\Model\\BatchResponsePublicAssociationMulti;\nuse HubSpot\\Client\\Crm\\Associations\\Model\\PublicObjectId;\nuse HubSpot\\Client\\Crm\\Companies\\ApiException as CompanyApiException;\nuse HubSpot\\Client\\Crm\\Contacts\\ApiException as ContactApiException;\nuse HubSpot\\Client\\Crm\\Deals\\Api\\BasicApi as DealsBasicApi;\nuse HubSpot\\Client\\Crm\\Deals\\ApiException as DealApiException;\nuse HubSpot\\Client\\Crm\\Deals\\Model\\SimplePublicObjectWithAssociations as DealWithAssociations;\nuse HubSpot\\Client\\Crm\\Pipelines\\Api\\PipelinesApi;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\CollectionResponsePipeline;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\Error;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\Pipeline;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\PipelineStage;\nuse HubSpot\\Client\\Crm\\Properties\\Api\\CoreApi;\nuse HubSpot\\Client\\Crm\\Properties\\Model\\Property;\nuse HubSpot\\Discovery as HubSpotDiscovery;\nuse HubSpot\\Discovery\\Crm\\Deals\\Discovery as DealsDiscovery;\nuse Jiminny\\Exceptions\\RateLimitException;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Services\\Crm\\Hubspot\\Client;\nuse Jiminny\\Services\\Crm\\Hubspot\\HubspotTokenManager;\nuse Jiminny\\Services\\Crm\\Hubspot\\Pagination\\HubspotPaginationService;\nuse Jiminny\\Services\\SocialAccountService;\nuse League\\OAuth2\\Client\\Token\\AccessToken;\nuse Mockery;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Log\\NullLogger;\nuse SevenShores\\Hubspot\\Endpoints\\Engagements;\nuse SevenShores\\Hubspot\\Exceptions\\BadRequest;\nuse SevenShores\\Hubspot\\Factory;\nuse SevenShores\\Hubspot\\Http\\Client as HubspotClient;\nuse SevenShores\\Hubspot\\Http\\Response as HubspotResponse;\n\n/**\n * @runTestsInSeparateProcesses\n *\n * @preserveGlobalState disabled\n */\nclass ClientTest extends TestCase\n{\n private const string RESPONSE_TYPE_STAGE_FIELD = 'stage';\n private const string RESPONSE_TYPE_PIPELINE_FIELD = 'pipeline';\n private const string RESPONSE_TYPE_REGULAR_FIELD = 'regular';\n /**\n * @var Client&MockObject\n */\n private Client $client;\n private Configuration $config;\n\n /**\n * @var SocialAccountService&MockObject\n */\n private SocialAccountService $socialAccountServiceMock;\n\n /**\n * @var HubspotPaginationService&MockObject\n */\n private HubspotPaginationService $paginationServiceMock;\n\n /**\n * @var HubspotTokenManager&MockObject\n */\n private HubspotTokenManager $tokenManagerMock;\n\n /**\n * @var CoreApi&MockObject\n */\n private CoreApi $coreApiMock;\n\n /**\n * @var PipelinesApi&MockObject\n */\n private PipelinesApi $pipelinesApiMock;\n\n /**\n * @var BatchApi&MockObject\n */\n private BatchApi $associationsBatchApiMock;\n\n /**\n * @var DealsBasicApi&MockObject\n */\n private DealsBasicApi $dealsBasicApiMock;\n\n /**\n * @var Engagements&MockObject\n */\n private $engagementsMock;\n\n /**\n * @var HubspotClient&MockObject\n */\n private HubspotClient $hubspotClientMock;\n\n protected function setUp(): void\n {\n // Create mocks for dependencies\n $this->socialAccountServiceMock = $this->createMock(SocialAccountService::class);\n $this->paginationServiceMock = $this->createMock(HubspotPaginationService::class);\n $this->tokenManagerMock = $this->createMock(HubspotTokenManager::class);\n\n // Create a real Client instance with mocked dependencies\n // Create a partial mock only for the methods we need to mock\n $client = $this->createPartialMock(Client::class, ['getInstance', 'getNewInstance', 'makeRequest']);\n $client->setLogger(new NullLogger());\n\n // Inject the real dependencies using reflection\n $reflection = new \\ReflectionClass(Client::class);\n\n $accountServiceProperty = $reflection->getProperty('accountService');\n $accountServiceProperty->setAccessible(true);\n $accountServiceProperty->setValue($client, $this->socialAccountServiceMock);\n\n $paginationServiceProperty = $reflection->getProperty('paginationService');\n $paginationServiceProperty->setAccessible(true);\n $paginationServiceProperty->setValue($client, $this->paginationServiceMock);\n\n $tokenManagerProperty = $reflection->getProperty('tokenManager');\n $tokenManagerProperty->setAccessible(true);\n $tokenManagerProperty->setValue($client, $this->tokenManagerMock);\n $factoryMock = $this->createMock(Factory::class);\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $engagementsMock = $this->createMock(\\SevenShores\\Hubspot\\Endpoints\\Engagements::class);\n\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n $factoryMock->method('__call')->with('engagements')->willReturn($engagementsMock);\n\n $client->method('getInstance')->willReturn($factoryMock);\n\n $discoveryMock = $this->createMock(HubSpotDiscovery\\Discovery::class);\n $crmMock = $this->createMock(HubSpotDiscovery\\Crm\\Discovery::class);\n $associationsMock = $this->createMock(HubSpotDiscovery\\Crm\\Associations\\Discovery::class);\n $propertiesMock = $this->createMock(HubSpotDiscovery\\Crm\\Properties\\Discovery::class);\n $pipelinesMock = $this->createMock(HubSpotDiscovery\\Crm\\Pipelines\\Discovery::class);\n $coreApiMock = $this->createMock(CoreApi::class);\n $pipelinesApiMock = $this->createMock(PipelinesApi::class);\n $associationsBatchApiMock = $this->createMock(BatchApi::class);\n $dealsBasicApiMock = $this->createMock(DealsBasicApi::class);\n\n $propertiesMock->method('__call')->with('coreApi')->willReturn($coreApiMock);\n $pipelinesMock->method('__call')->with('pipelinesApi')->willReturn($pipelinesApiMock);\n $associationsMock->method('__call')->with('batchApi')->willReturn($associationsBatchApiMock);\n $dealsDiscoveryMock = $this->createMock(DealsDiscovery::class);\n $dealsDiscoveryMock->method('__call')->with('basicApi')->willReturn($dealsBasicApiMock);\n\n $returnMap = ['properties' => $propertiesMock, 'pipelines' => $pipelinesMock, 'associations' => $associationsMock, 'deals' => $dealsDiscoveryMock];\n $crmMock->method('__call')\n ->willReturnCallback(static fn (string $name) => $returnMap[$name])\n ;\n\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n\n $this->client = $client;\n $this->config = $this->createMock(Configuration::class);\n $this->client->setConfiguration($this->config);\n $this->coreApiMock = $coreApiMock;\n $this->pipelinesApiMock = $pipelinesApiMock;\n $this->associationsBatchApiMock = $associationsBatchApiMock;\n $this->dealsBasicApiMock = $dealsBasicApiMock;\n $this->engagementsMock = $engagementsMock;\n $this->hubspotClientMock = $hubspotClientMock;\n }\n\n public function testGetMinimumApiVersion(): void\n {\n $this->assertIsString($this->client->getMinimumApiVersion());\n }\n\n public function testGetInstance(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $client = new Client($socialAccountService, $paginationService, $tokenManager);\n $client->setBaseUrl('https://example.com');\n $client->setAccessToken(new AccessToken(['access_token' => 'foo']));\n $factory = $client->getInstance();\n\n $this->assertEquals('foo', $factory->getClient()->key);\n }\n\n public function testGetNewInstance(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $client = new Client($socialAccountService, $paginationService, $tokenManager);\n $client->setAccessToken(new AccessToken(['access_token' => 'foo']));\n\n $factory = $client->getNewInstance();\n $token = $factory->auth()->oAuth()->accessTokensApi()->getConfig()->getAccessToken();\n $this->assertEquals('foo', $token);\n }\n\n public function testFetchProperty(): void\n {\n $this->coreApiMock->method('getByName')->willReturn($this->generateProperty());\n\n $this->assertEquals(\n 'some_property',\n $this->client->fetchProperty('foo', 'test')['name']\n );\n }\n\n public function testFetchPropertyOptions(): void\n {\n $this->coreApiMock->method('getByName')->willReturn($this->generateProperty());\n\n $this->assertEquals(\n [\n [\n 'label' => 'label_1',\n 'value' => 'value_1',\n ],\n [\n 'label' => 'label_2',\n 'value' => 'value_2',\n ],\n ],\n $this->client->fetchPropertyOptions('foo', 'test')\n );\n }\n\n public function testFetchCallDispositions(): void\n {\n $this->engagementsMock\n ->method('getCallDispositions')\n ->willReturn($this->generateHubSpotResponse([\n [\n 'id' => 1,\n 'label' => 'foo',\n 'deleted' => false,\n ],\n [\n 'id' => 2,\n 'label' => 'bar',\n 'deleted' => false,\n ],\n ]))\n ;\n\n $this->assertEquals(\n [\n [\n 'id' => 1,\n 'label' => 'foo',\n 'deleted' => false,\n ],\n [\n 'id' => 2,\n 'label' => 'bar',\n 'deleted' => false,\n ],\n ],\n $this->client->fetchCallDispositions()\n );\n }\n\n public function testFetchDispositionFieldOptions(): void\n {\n $this->engagementsMock->method('getCallDispositions')\n ->willReturn($this->generateHubSpotResponse(\n [\n [\n 'id' => 1,\n 'label' => 'Label 1',\n 'deleted' => false,\n ],\n [\n 'id' => 2,\n 'label' => 'Label 2',\n 'deleted' => true,\n ],\n ]\n ))\n ;\n\n $this->assertEquals(\n [\n [\n 'value' => 1,\n 'id' => 1,\n 'label' => 'Label 1',\n ],\n ],\n $this->client->fetchDispositionFieldOptions()\n );\n }\n\n public function testFetchOpportunityPipelineStages(): void\n {\n /**\n * @TODO: The class CollectionResponsePipeline will be deprecated in the next Hubspot version\n */\n $this->pipelinesApiMock\n ->method('getAll')\n ->with('deals')\n ->willReturn(new CollectionResponsePipeline([\n 'results' => [$this->generatePipeline()],\n ]))\n ;\n\n $this->assertEquals(\n [\n ['id' => 'foo', 'label' => 'bar'],\n ['id' => 'baz', 'label' => 'qux'],\n ],\n $this->client->fetchOpportunityPipelineStages()\n );\n }\n\n public function testFetchOpportunityPipelineStagesErrorResponse(): void\n {\n $this->pipelinesApiMock\n ->method('getAll')\n ->with('deals')\n ->willReturn(new Error(['message' => 'test error']))\n ;\n\n $this->assertEmpty($this->client->fetchOpportunityPipelineStages());\n }\n\n #[\\PHPUnit\\Framework\\Attributes\\DataProvider('meetingOutcomeFieldProvider')]\n public function testFetchMeetingOutcomeFieldOptions(string $fieldId, string $expectedEndpoint): void\n {\n $field = new Field(['crm_provider_id' => $fieldId]);\n\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->with('GET', $expectedEndpoint)\n ->willReturn($this->generateHubSpotResponse(\n [\n 'options' => [\n ['value' => 'option_1', 'label' => 'Option 1', 'displayOrder' => 0],\n ['value' => 'option_2', 'label' => 'Option 2', 'displayOrder' => 1],\n ['value' => 'option_3', 'label' => 'Option 3', 'displayOrder' => 2],\n ],\n ]\n ))\n ;\n\n $this->assertEquals(\n [\n ['id' => 'option_1', 'value' => 'option_1', 'label' => 'Option 1', 'display_order' => 0],\n ['id' => 'option_2', 'value' => 'option_2', 'label' => 'Option 2', 'display_order' => 1],\n ['id' => 'option_3', 'value' => 'option_3', 'label' => 'Option 3', 'display_order' => 2],\n ],\n $this->client->fetchMeetingOutcomeFieldOptions($field)\n );\n }\n\n public static function meetingOutcomeFieldProvider(): array\n {\n return [\n 'meeting outcome field' => [\n 'meetingOutcome',\n 'https://api.hubapi.com/crm/v3/properties/meeting/hs_meeting_outcome',\n ],\n 'activity type field' => [\n 'foobar',\n 'https://api.hubapi.com/crm/v3/properties/call/hs_activity_type',\n ],\n ];\n }\n\n #[\\PHPUnit\\Framework\\Attributes\\DataProvider('opportunityFieldOptionsProvider')]\n public function testFetchOpportunityFieldOptions(Field $field, string $type): void\n {\n $responses = [\n self::RESPONSE_TYPE_STAGE_FIELD => [\n ['id' => 'foo', 'label' => 'bar'],\n ['id' => 'baz', 'label' => 'qux'],\n ],\n self::RESPONSE_TYPE_PIPELINE_FIELD => [\n ['id' => '123', 'label' => 'Sales'],\n ['id' => 'default', 'label' => 'CS'],\n ],\n self::RESPONSE_TYPE_REGULAR_FIELD => [\n [\n 'label' => 'label_1',\n 'value' => 'value_1',\n ],\n [\n 'label' => 'label_2',\n 'value' => 'value_2',\n ],\n ],\n ];\n\n $field = $this->createMock(Field::class);\n\n if ($type === self::RESPONSE_TYPE_REGULAR_FIELD) {\n $field->method('isStageField')->willReturn(false);\n $field->method('isPipelineField')->willReturn(false);\n $propertyResponse = $this->generateProperty();\n $this->coreApiMock->method('getByName')->willReturn($propertyResponse);\n }\n\n if ($type === self::RESPONSE_TYPE_STAGE_FIELD) {\n $field->method('isStageField')->willReturn(true);\n /**\n * @TODO: The class CollectionResponsePipeline will be deprecated in the next Hubspot version\n */\n\n $pipelineStagesResponse = new CollectionResponsePipeline([\n 'results' => [$this->generatePipeline()],\n ]);\n $this->pipelinesApiMock\n ->method('getAll')\n ->willReturn($pipelineStagesResponse);\n }\n\n if ($type === self::RESPONSE_TYPE_PIPELINE_FIELD) {\n $field->method('isStageField')->willReturn(false);\n $field->method('isPipelineField')->willReturn(true);\n $pipelineResponse = $this->generateHubSpotResponse([\n 'results' => [\n ['id' => '123', 'label' => 'Sales'],\n ['id' => 'default', 'label' => 'CS'],\n ],\n ]);\n $this->client\n ->method('makeRequest')\n ->with('/crm/v3/pipelines/deals')\n ->willReturn($pipelineResponse);\n }\n\n $this->assertEquals(\n $responses[$type],\n $this->client->fetchOpportunityFieldOptions($field)\n );\n }\n\n public static function opportunityFieldOptionsProvider(): array\n {\n return [\n 'stage field' => [\n 'field' => new Field(['crm_provider_id' => 'dealstage']),\n 'type' => self::RESPONSE_TYPE_STAGE_FIELD,\n ],\n 'pipeline field' => [\n 'field' => new Field(['crm_provider_id' => 'pipeline']),\n 'type' => self::RESPONSE_TYPE_PIPELINE_FIELD,\n ],\n 'regular field' => [\n 'field' => new Field(['crm_provider_id' => 'some_property']),\n 'type' => self::RESPONSE_TYPE_REGULAR_FIELD,\n ],\n ];\n }\n\n private function generateHubSpotResponse(array $data): HubspotResponse\n {\n return new HubspotResponse(new Response(200, [], json_encode($data)));\n }\n\n private function generateProperty(): Property\n {\n return new Property([\n 'name' => 'some_property',\n 'options' => [\n [\n 'label' => 'label_1',\n 'value' => 'value_1',\n ],\n [\n 'label' => 'label_2',\n 'value' => 'value_2',\n ],\n ],\n ]);\n }\n\n private function generatePipeline(): Pipeline\n {\n return new Pipeline(['stages' => [\n new PipelineStage(['id' => 'foo', 'label' => 'bar']),\n new PipelineStage(['id' => 'baz', 'label' => 'qux']),\n ]]);\n }\n\n public function testFetchOpportunityPipelines(): void\n {\n $this->client\n ->method('makeRequest')\n ->with('/crm/v3/pipelines/deals')\n ->willReturn($this->generateHubSpotResponse([\n 'results' => [\n ['id' => 'id_1', 'label' => 'Option 1', 'displayOrder' => 0],\n ['id' => 'id_2', 'label' => 'Option 2', 'displayOrder' => 1],\n ['id' => 'id_3', 'label' => 'Option 3', 'displayOrder' => 2],\n ],\n ]));\n\n $this->assertEquals(\n [\n ['id' => 'id_1', 'label' => 'Option 1'],\n ['id' => 'id_2', 'label' => 'Option 2'],\n ['id' => 'id_3', 'label' => 'Option 3'],\n ],\n $this->client->fetchOpportunityPipelines()\n );\n }\n\n public function testGetPaginatedData(): void\n {\n $expectedResults = [\n ['id' => 'id_1', 'properties' => []],\n ['id' => 'id_2', 'properties' => []],\n ['id' => 'id_3', 'properties' => []],\n ];\n\n // Mock the pagination service to return a generator and modify reference parameters\n $this->paginationServiceMock\n ->expects($this->once())\n ->method('getPaginatedDataGenerator')\n ->with(\n $this->client,\n ['payload_key' => 'payload_value'],\n 'foobar',\n 0,\n $this->anything(),\n $this->anything()\n )\n ->willReturnCallback(function ($client, $payload, $type, $offset, &$total, &$lastRecordId) use ($expectedResults) {\n $total = 3;\n $lastRecordId = 'id_3';\n foreach ($expectedResults as $result) {\n yield $result;\n }\n });\n\n $this->assertEquals(\n [\n 'results' => $expectedResults,\n 'total' => 3,\n 'last_record' => 'id_3',\n ],\n $this->client->getPaginatedData(['payload_key' => 'payload_value'], 'foobar')\n );\n }\n\n public function testGetAssociationsData(): void\n {\n $ids = ['1', '2', '3'];\n $fromObject = 'deals';\n $toObject = 'contacts';\n\n $responseResults = [];\n foreach ($ids as $id) {\n $from = new PublicObjectId();\n $from->setId($id);\n\n $to1 = new PublicObjectId();\n $to1->setId('contact_' . $id . '_1');\n $to2 = new PublicObjectId();\n $to2->setId('contact_' . $id . '_2');\n\n $result = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicAssociationMulti();\n $result->setFrom($from);\n $result->setTo([$to1, $to2]);\n\n $responseResults[] = $result;\n }\n\n $batchResponse = new BatchResponsePublicAssociationMulti();\n $batchResponse->setResults($responseResults);\n\n $this->associationsBatchApiMock->expects($this->once())\n ->method('read')\n ->with(\n $this->equalTo($fromObject),\n $this->equalTo($toObject),\n $this->callback(function (BatchInputPublicObjectId $batchInput) use ($ids) {\n $inputIds = array_map(\n fn ($input) => $input->getId(),\n $batchInput->getInputs()\n );\n\n return $inputIds === $ids;\n })\n )\n ->willReturn($batchResponse);\n\n $result = $this->client->getAssociationsData($ids, $fromObject, $toObject);\n\n $expectedResult = [\n '1' => ['contact_1_1', 'contact_1_2'],\n '2' => ['contact_2_1', 'contact_2_2'],\n '3' => ['contact_3_1', 'contact_3_2'],\n ];\n\n $this->assertEquals($expectedResult, $result);\n }\n\n public function testGetAssociationsDataHandlesException(): void\n {\n $ids = ['1', '2', '3'];\n $fromObject = 'deals';\n $toObject = 'contacts';\n\n $exception = new \\Exception('API Error');\n\n $this->associationsBatchApiMock->expects($this->once())\n ->method('read')\n ->with(\n $this->equalTo($fromObject),\n $this->equalTo($toObject),\n $this->callback(function ($batchInput) use ($ids) {\n return $batchInput instanceof \\HubSpot\\Client\\Crm\\Associations\\Model\\BatchInputPublicObjectId\n && count($batchInput->getInputs()) === count($ids);\n })\n )\n ->willThrowException($exception);\n\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with(\n '[Hubspot] Failed to fetch associations',\n [\n 'from_object' => $fromObject,\n 'to_object' => $toObject,\n 'reason' => 'API Error',\n ]\n );\n\n $this->client->setLogger($loggerMock);\n\n $result = $this->client->getAssociationsData($ids, $fromObject, $toObject);\n\n $this->assertEmpty($result);\n $this->assertIsArray($result);\n }\n\n public function testGetAssociationsDataWithLargeDataSet(): void\n {\n $ids = array_map(fn ($i) => (string) $i, range(1, 2500)); // More than 1000 items\n $fromObject = 'deals';\n $toObject = 'contacts';\n\n $firstBatchResponse = new BatchResponsePublicAssociationMulti();\n $firstBatchResults = array_map(function ($id) {\n $from = new PublicObjectId();\n $from->setId($id);\n $to = new PublicObjectId();\n $to->setId('contact_' . $id);\n $result = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicAssociationMulti();\n $result->setFrom($from);\n $result->setTo([$to]);\n\n return $result;\n }, array_slice($ids, 0, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));\n $firstBatchResponse->setResults($firstBatchResults);\n\n $secondBatchResponse = new BatchResponsePublicAssociationMulti();\n $secondBatchResults = array_map(function ($id) {\n $from = new PublicObjectId();\n $from->setId($id);\n $to = new PublicObjectId();\n $to->setId('contact_' . $id);\n $result = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicAssociationMulti();\n $result->setFrom($from);\n $result->setTo([$to]);\n\n return $result;\n }, array_slice($ids, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));\n $secondBatchResponse->setResults($secondBatchResults);\n\n $this->associationsBatchApiMock->expects($this->exactly(3))\n ->method('read')\n ->willReturnOnConsecutiveCalls($firstBatchResponse, $secondBatchResponse);\n\n $result = $this->client->getAssociationsData($ids, $fromObject, $toObject);\n\n $this->assertCount(2500, $result);\n $this->assertArrayHasKey('1', $result);\n $this->assertArrayHasKey('2500', $result);\n $this->assertEquals(['contact_1'], $result['1']);\n $this->assertEquals(['contact_2500'], $result['2500']);\n }\n\n public function testGetContactByEmailSuccess(): void\n {\n $email = 'test@example.com';\n $fields = ['firstname', 'lastname', 'email'];\n\n $contactMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations::class);\n $contactMock->method('getId')->willReturn('12345');\n $contactMock->method('getProperties')->willReturn([\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n 'email' => 'test@example.com',\n ]);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($email, 'firstname,lastname,email', null, false, 'email')\n ->willReturn($contactMock);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new NullLogger());\n\n $result = $client->getContactByEmail($email, $fields);\n\n $this->assertEquals([\n 'id' => '12345',\n 'properties' => [\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n 'email' => 'test@example.com',\n ],\n ], $result);\n }\n\n public function testGetContactByEmailWithEmptyFields(): void\n {\n $email = 'test@example.com';\n $fields = [];\n\n $contactMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations::class);\n $contactMock->method('getId')->willReturn('12345');\n $contactMock->method('getProperties')->willReturn(['email' => 'test@example.com']);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($email, '', null, false, 'email')\n ->willReturn($contactMock);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new NullLogger());\n\n $result = $client->getContactByEmail($email, $fields);\n\n $this->assertEquals([\n 'id' => '12345',\n 'properties' => ['email' => 'test@example.com'],\n ], $result);\n }\n\n public function testGetContactByEmailApiException(): void\n {\n $email = 'nonexistent@example.com';\n $fields = ['firstname', 'lastname'];\n\n $exception = new \\HubSpot\\Client\\Crm\\Contacts\\ApiException('Contact not found', 404);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($email, 'firstname,lastname', null, false, 'email')\n ->willThrowException($exception);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('info')\n ->with(\n '[Hubspot] Failed to fetch contact',\n [\n 'email' => $email,\n 'reason' => 'Contact not found',\n ]\n );\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger($loggerMock);\n\n $result = $client->getContactByEmail($email, $fields);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetOpportunityById(): void\n {\n $opportunityId = '12345';\n $expectedProperties = [\n 'dealname' => 'Test Opportunity',\n 'amount' => '1000.00',\n 'closedate' => '2024-12-31T23:59:59.999Z',\n 'dealstage' => 'presentationscheduled',\n 'pipeline' => 'default',\n ];\n\n $mockHubspotOpportunity = $this->createMock(DealWithAssociations::class);\n $mockHubspotOpportunity->method('getProperties')->willReturn((object) $expectedProperties);\n $mockHubspotOpportunity->method('getId')->willReturn($opportunityId);\n $now = new \\DateTimeImmutable();\n $mockHubspotOpportunity->method('getCreatedAt')->willReturn($now);\n $mockHubspotOpportunity->method('getUpdatedAt')->willReturn($now);\n $mockHubspotOpportunity->method('getArchived')->willReturn(false);\n\n $this->dealsBasicApiMock\n ->expects($this->once())\n ->method('getById')\n ->willReturn($mockHubspotOpportunity);\n\n // Assuming Client::getOpportunityById processes the SimplePublicObject and returns an associative array.\n // The structure might be like: ['id' => ..., 'properties' => [...], 'createdAt' => ..., ...]\n // Adjust assertions below based on the actual return structure of your method.\n $result = $this->client->getOpportunityById($opportunityId, ['test', 'test']);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('id', $result);\n $this->assertEquals($opportunityId, $result['id']);\n }\n\n public function testGetContactById(): void\n {\n $crmId = 'contact-123';\n $fields = ['firstname', 'lastname'];\n $expectedProperties = ['firstname' => 'John', 'lastname' => 'Doe'];\n\n $mockContact = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations::class);\n $mockContact->method('getId')->willReturn($crmId);\n $mockContact->method('getProperties')->willReturn((object) $expectedProperties);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($crmId, 'firstname,lastname')\n ->willReturn($mockContact);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new \\Psr\\Log\\NullLogger());\n\n $result = $client->getContactById($crmId, $fields);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('id', $result);\n $this->assertArrayHasKey('properties', $result);\n $this->assertEquals($crmId, $result['id']);\n $this->assertEquals((object) $expectedProperties, $result['properties']);\n }\n\n public function testGetAccountById(): void\n {\n $crmId = 'account-123';\n $fields = ['name', 'industry'];\n $expectedProperties = ['name' => 'Acme Corp', 'industry' => 'Technology'];\n\n $mockCompany = $this->createMock(\\HubSpot\\Client\\Crm\\Companies\\Model\\SimplePublicObjectWithAssociations::class);\n $mockCompany->method('getId')->willReturn($crmId);\n $mockCompany->method('getProperties')->willReturn((object) $expectedProperties);\n\n $companiesApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Companies\\Api\\BasicApi::class);\n $companiesApiMock->expects($this->once())\n ->method('getById')\n ->with($crmId, 'name,industry')\n ->willReturn($mockCompany);\n\n $companiesDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Companies\\Discovery::class);\n $companiesDiscoveryMock->method('__call')->with('basicApi')->willReturn($companiesApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($companiesDiscoveryMock) {\n if ($name === 'companies') {\n return $companiesDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new \\Psr\\Log\\NullLogger());\n\n $result = $client->getAccountById($crmId, $fields);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('id', $result);\n $this->assertArrayHasKey('properties', $result);\n $this->assertEquals($crmId, $result['id']);\n $this->assertEquals((object) $expectedProperties, $result['properties']);\n }\n\n public function testEnsureValidTokenWithNoTokenUpdate(): void\n {\n $socialAccountMock = $this->createMock(SocialAccount::class);\n\n // Set up OAuth account\n $reflection = new \\ReflectionClass($this->client);\n $oauthAccountProperty = $reflection->getProperty('oauthAccount');\n $oauthAccountProperty->setAccessible(true);\n $oauthAccountProperty->setValue($this->client, $socialAccountMock);\n\n $originalToken = 'original_token';\n $accessTokenProperty = $reflection->getProperty('accessToken');\n $accessTokenProperty->setAccessible(true);\n $accessTokenProperty->setValue($this->client, $originalToken);\n\n // Mock token manager to return null (no refresh needed)\n $this->tokenManagerMock\n ->expects($this->once())\n ->method('ensureValidToken')\n ->with($socialAccountMock)\n ->willReturn(null);\n\n // Call ensureValidToken\n $this->client->ensureValidToken();\n\n // Verify access token was not changed\n $this->assertEquals($originalToken, $accessTokenProperty->getValue($this->client));\n }\n\n\n\n\n\n\n public function testGetPaginatedDataGeneratorDelegatesToPaginationService(): void\n {\n $payload = ['filters' => []];\n $type = 'contacts';\n $offset = 0;\n $total = 0;\n $lastRecordId = null;\n\n $expectedResults = [\n ['id' => 'id_1', 'properties' => []],\n ['id' => 'id_2', 'properties' => []],\n ];\n\n // Mock the pagination service to return a generator\n $this->paginationServiceMock\n ->expects($this->once())\n ->method('getPaginatedDataGenerator')\n ->with(\n $this->client,\n $payload,\n $type,\n $offset,\n $this->anything(),\n $this->anything()\n )\n ->willReturnCallback(function () use ($expectedResults) {\n foreach ($expectedResults as $result) {\n yield $result;\n }\n });\n\n // Execute the pagination\n $results = [];\n foreach ($this->client->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastRecordId) as $result) {\n $results[] = $result;\n }\n\n $this->assertCount(2, $results);\n $this->assertEquals('id_1', $results[0]['id']);\n $this->assertEquals('id_2', $results[1]['id']);\n }\n\n public function testEnsureValidTokenDelegatesToTokenManager(): void\n {\n $socialAccountMock = $this->createMock(SocialAccount::class);\n\n // Set up OAuth account\n $reflection = new \\ReflectionClass($this->client);\n $oauthAccountProperty = $reflection->getProperty('oauthAccount');\n $oauthAccountProperty->setAccessible(true);\n $oauthAccountProperty->setValue($this->client, $socialAccountMock);\n\n // Mock token manager to return new token\n $this->tokenManagerMock\n ->expects($this->once())\n ->method('ensureValidToken')\n ->with($socialAccountMock)\n ->willReturn('new_access_token');\n\n // Call ensureValidToken\n $this->client->ensureValidToken();\n\n // Verify access token was updated\n $accessTokenProperty = $reflection->getProperty('accessToken');\n $accessTokenProperty->setAccessible(true);\n $this->assertEquals('new_access_token', $accessTokenProperty->getValue($this->client));\n }\n\n public function testGetOwnersArchivedWithValidResponse(): void\n {\n $responseData = [\n 'results' => [\n [\n 'id' => '123',\n 'email' => 'owner1@example.com',\n 'type' => 'PERSON',\n 'firstName' => 'John',\n 'lastName' => 'Doe',\n 'userId' => 456,\n 'userIdIncludingInactive' => 789,\n 'createdAt' => '2023-01-01T12:00:00Z',\n 'updatedAt' => '2023-01-02T12:00:00Z',\n 'archived' => true,\n ],\n ],\n ];\n\n // Create a mock response object\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willReturn($responseData);\n\n // Set up the client to return our test data\n $this->client->method('makeRequest')\n ->with(\n '/crm/v3/owners',\n 'GET',\n [],\n 'archived=true'\n )\n ->willReturn($response);\n\n // Call the method\n $result = $this->client->getOwnersArchived(true);\n\n // Assert the results\n $this->assertCount(1, $result);\n $this->assertEquals('123', $result[0]->getId());\n $this->assertEquals('owner1@example.com', $result[0]->getEmail());\n $this->assertEquals('John Doe', $result[0]->getFullName());\n $this->assertTrue($result[0]->isArchived());\n }\n\n public function testGetOwnersArchivedWithEmptyResponse(): void\n {\n // Create a mock response object with empty results\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willReturn(['results' => []]);\n\n // Set up the client to return empty results\n $this->client->method('makeRequest')\n ->with(\n '/crm/v3/owners',\n 'GET',\n [],\n 'archived=false'\n )\n ->willReturn($response);\n\n // Call the method\n $result = $this->client->getOwnersArchived(false);\n\n // Assert the results\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testGetOwnersArchivedWithInvalidResponse(): void\n {\n // Create a mock response that will throw an exception when toArray is called\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willThrowException(new \\InvalidArgumentException('Invalid JSON'));\n\n // Set up the client to return the problematic response\n $this->client->method('makeRequest')\n ->willReturn($response);\n\n // Mock the logger to expect an error message\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with($this->stringContains('Failed to fetch owners'));\n\n $reflection = new \\ReflectionClass($this->client);\n $loggerProperty = $reflection->getProperty('log');\n $loggerProperty->setAccessible(true);\n $loggerProperty->setValue($this->client, $loggerMock);\n\n // Call the method and expect an empty array on error\n $result = $this->client->getOwnersArchived(true);\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testGetOwnersArchivedWithHttpError(): void\n {\n // Set up the client to throw an exception\n $this->client->method('makeRequest')\n ->willThrowException(new \\Exception('HTTP Error'));\n\n // Mock the logger to expect an error message\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with($this->stringContains('Failed to fetch owners'));\n\n $reflection = new \\ReflectionClass($this->client);\n $loggerProperty = $reflection->getProperty('log');\n $loggerProperty->setAccessible(true);\n $loggerProperty->setValue($this->client, $loggerMock);\n\n // Call the method and expect an empty array on error\n $result = $this->client->getOwnersArchived(false);\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testGetOwnersArchivedWithOwnerCreationException(): void\n {\n $responseData = [\n 'results' => [\n [\n 'id' => '123',\n 'email' => 'valid@example.com',\n 'type' => 'PERSON',\n 'firstName' => 'John',\n 'lastName' => 'Doe',\n 'userId' => 456,\n 'userIdIncludingInactive' => 789,\n 'createdAt' => '2023-01-01T12:00:00Z',\n 'updatedAt' => '2023-01-02T12:00:00Z',\n 'archived' => false,\n ],\n [\n 'id' => '456',\n 'email' => 'invalid@example.com',\n 'type' => 'PERSON',\n 'createdAt' => 'invalid-date-format',\n ],\n [\n 'id' => '789',\n 'email' => 'another@example.com',\n 'type' => 'PERSON',\n 'firstName' => 'Jane',\n 'lastName' => 'Smith',\n 'userId' => 999,\n 'userIdIncludingInactive' => 888,\n 'createdAt' => '2023-01-03T12:00:00Z',\n 'updatedAt' => '2023-01-04T12:00:00Z',\n 'archived' => false,\n ],\n ],\n ];\n\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willReturn($responseData);\n\n $this->client->method('makeRequest')\n ->with(\n '/crm/v3/owners',\n 'GET',\n [],\n 'archived=false'\n )\n ->willReturn($response);\n\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with(\n '[HubSpot] Failed to process owner data',\n $this->callback(function ($context) {\n return isset($context['result']) &&\n isset($context['error']) &&\n $context['result']['id'] === '456' &&\n $context['result']['email'] === 'invalid@example.com' &&\n str_contains($context['error'], 'invalid-date-format');\n })\n );\n\n $reflection = new \\ReflectionClass($this->client);\n $loggerProperty = $reflection->getProperty('log');\n $loggerProperty->setAccessible(true);\n $loggerProperty->setValue($this->client, $loggerMock);\n\n $result = $this->client->getOwnersArchived(false);\n\n $this->assertIsArray($result);\n $this->assertCount(2, $result);\n $this->assertEquals('123', $result[0]->getId());\n $this->assertEquals('valid@example.com', $result[0]->getEmail());\n $this->assertEquals('789', $result[1]->getId());\n $this->assertEquals('another@example.com', $result[1]->getEmail());\n }\n\n public function testMakeRequestWithGetMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'success']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'GET',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n [],\n null,\n true\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'GET');\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithGetMethodAndQueryString(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'success']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'GET',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n [],\n 'limit=10&offset=0',\n true\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'GET', [], 'limit=10&offset=0');\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithPostMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $payload = [\n 'properties' => [\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n ],\n ];\n\n $psrResponse = new Response(200, [], json_encode(['id' => '12345']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'POST',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n ['json' => $payload]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'POST', $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithPutMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $payload = [\n 'properties' => [\n 'firstname' => 'Jane',\n ],\n ];\n\n $psrResponse = new Response(200, [], json_encode(['id' => '12345', 'updated' => true]));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'PUT',\n 'https://api.hubapi.com/crm/v3/objects/contacts/12345',\n ['json' => $payload]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts/12345', 'PUT', $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithPatchMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $payload = [\n 'properties' => [\n 'email' => 'newemail@example.com',\n ],\n ];\n\n $psrResponse = new Response(200, [], json_encode(['id' => '12345', 'patched' => true]));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'PATCH',\n 'https://api.hubapi.com/crm/v3/objects/contacts/12345',\n ['json' => $payload]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts/12345', 'PATCH', $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithDeleteMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['deleted' => true]));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'DELETE',\n 'https://api.hubapi.com/crm/v3/objects/contacts/12345',\n ['json' => []]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts/12345', 'DELETE');\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithEmptyPayload(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'ok']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'POST',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n ['json' => []]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'POST', []);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestPrependsBaseUrl(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'success']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n $this->anything(),\n 'https://api.hubapi.com/test/endpoint',\n $this->anything()\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $client->makeRequest('/test/endpoint', 'GET');\n }\n\n public function testGetOpportunitiesByIds(): void\n {\n $crmIds = ['deal1', 'deal2', 'deal3'];\n $fields = ['dealname', 'amount'];\n\n // Test basic functionality - method exists and returns array\n $this->assertTrue(method_exists($this->client, 'getOpportunitiesByIds'));\n }\n\n public function testGetCompaniesByIds(): void\n {\n $crmIds = ['company1', 'company2'];\n $fields = ['name', 'industry'];\n\n // Test basic functionality - method exists and returns array\n $this->assertTrue(method_exists($this->client, 'getCompaniesByIds'));\n }\n\n public function testGetContactsByIds(): void\n {\n $crmIds = ['contact1', 'contact2'];\n $fields = ['firstname', 'lastname'];\n\n // Test basic functionality - method exists and returns array\n $this->assertTrue(method_exists($this->client, 'getContactsByIds'));\n }\n\n public function testBatchReadObjectsEmptyIds(): void\n {\n $reflection = new \\ReflectionClass($this->client);\n $method = $reflection->getMethod('batchReadObjects');\n $method->setAccessible(true);\n\n $result = $method->invokeArgs($this->client, ['deals', [], ['dealname']]);\n\n $this->assertEquals([], $result);\n }\n\n public function testBatchReadObjectsExceedsBatchSize(): void\n {\n $crmIds = array_fill(0, 101, 'deal_id'); // 101 IDs, exceeds limit of 100\n\n $reflection = new \\ReflectionClass($this->client);\n $method = $reflection->getMethod('batchReadObjects');\n $method->setAccessible(true);\n\n $this->expectException(\\InvalidArgumentException::class);\n $this->expectExceptionMessage('Batch size cannot exceed 100 deals');\n\n $method->invokeArgs($this->client, ['deals', $crmIds, ['dealname']]);\n }\n\n public function testBatchReadObjectsUnsupportedObjectType(): void\n {\n $reflection = new \\ReflectionClass($this->client);\n $method = $reflection->getMethod('batchReadObjects');\n $method->setAccessible(true);\n\n $this->expectException(\\Jiminny\\Exceptions\\CrmException::class);\n $this->expectExceptionMessage('Failed to batch fetch unsupported');\n\n $method->invokeArgs($this->client, ['unsupported', ['id1'], ['field1']]);\n }\n\n public function testIsUnauthorizedExceptionWithBadRequest401(): void\n {\n $exception = new \\SevenShores\\Hubspot\\Exceptions\\BadRequest('Unauthorized', 401);\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithBadRequestNon401(): void\n {\n $exception = new \\SevenShores\\Hubspot\\Exceptions\\BadRequest('Bad Request', 400);\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertFalse($result);\n }\n\n public function testIsUnauthorizedExceptionWithGuzzleRequestException(): void\n {\n $response = new Response(401, [], 'Unauthorized');\n $exception = new \\GuzzleHttp\\Exception\\RequestException('Unauthorized', new \\GuzzleHttp\\Psr7\\Request('GET', 'test'), $response);\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithGuzzleClientException(): void\n {\n $exception = new \\GuzzleHttp\\Exception\\ClientException('Unauthorized', new \\GuzzleHttp\\Psr7\\Request('GET', 'test'), new Response(401));\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithStringMatching(): void\n {\n $exception = new \\Exception('HTTP 401 Unauthorized error occurred');\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithNonUnauthorized(): void\n {\n $exception = new \\Exception('Some other error');\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertFalse($result);\n }\n\n public function testEnsureValidTokenWithNullOauthAccount(): void\n {\n $reflection = new \\ReflectionClass($this->client);\n $oauthAccountProperty = $reflection->getProperty('oauthAccount');\n $oauthAccountProperty->setAccessible(true);\n $oauthAccountProperty->setValue($this->client, null);\n\n // Should not throw exception and not call token manager\n $this->tokenManagerMock->expects($this->never())->method('ensureValidToken');\n\n $this->client->ensureValidToken();\n\n $this->assertTrue(true); // Test passes if no exception is thrown\n }\n\n public function testGetConfig(): void\n {\n $result = $this->client->getConfig();\n\n $this->assertSame($this->config, $result);\n }\n\n public function testGetOwners(): void\n {\n // Test that the method exists and can be called\n $this->assertTrue(method_exists($this->client, 'getOwners'));\n\n // Since getOwners has complex HubSpot API dependencies,\n // we'll just verify the method exists for now\n $this->assertIsCallable([$this->client, 'getOwners']);\n }\n\n public function testCreateMeeting(): void\n {\n $payload = [\n 'properties' => [\n 'hs_meeting_title' => 'Test Meeting',\n 'hs_meeting_start_time' => '2024-01-01T10:00:00Z',\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['id' => 'meeting123']);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with('/crm/v3/objects/meetings', 'POST', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->createMeeting($payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testUpdateMeeting(): void\n {\n $meetingId = 'meeting123';\n $payload = [\n 'properties' => [\n 'hs_meeting_title' => 'Updated Meeting',\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['id' => $meetingId, 'updated' => true]);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with(\"/crm/v3/objects/meetings/{$meetingId}\", 'PATCH', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->updateMeeting($meetingId, $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testAddAssociations(): void\n {\n $objectType = 'deals';\n $associationType = 'contacts';\n $payload = [\n 'inputs' => [\n ['from' => ['id' => 'deal1'], 'to' => ['id' => 'contact1']],\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['status' => 'success']);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with(\"/crm/v4/associations/{$objectType}/{$associationType}/batch/create\", 'POST', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->addAssociations($objectType, $associationType, $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testRemoveAssociations(): void\n {\n $objectType = 'deals';\n $associationType = 'contacts';\n $payload = [\n 'inputs' => [\n ['from' => ['id' => 'deal1'], 'to' => ['id' => 'contact1']],\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['status' => 'success']);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with(\"/crm/v4/associations/{$objectType}/{$associationType}/batch/archive\", 'POST', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->removeAssociations($objectType, $associationType, $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n // -------------------------------------------------------------------------\n // search() / executeRequest() tests\n // -------------------------------------------------------------------------\n\n public function testSearchReturnsDecodedArrayOnSuccess(): void\n {\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn(null);\n\n $this->config->method('getId')->willReturn(42);\n\n $payload = ['filters' => []];\n $responseData = ['results' => [['id' => '1']], 'total' => 1, 'paging' => []];\n $hubspotResponse = new HubspotResponse(new Response(200, [], json_encode($responseData)));\n\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->with('POST', Client::BASE_URL . '/crm/v3/objects/contacts/search', ['json' => $payload])\n ->willReturn($hubspotResponse);\n\n $result = $this->client->search('contacts', $payload);\n\n $this->assertSame($responseData, $result);\n\n Mockery::close();\n }\n\n public function testSearchThrowsRateLimitExceptionWhenCircuitBreakerActive(): void\n {\n $futureTimestamp = (string) (time() + 30);\n\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn($futureTimestamp);\n\n $this->config->method('getId')->willReturn(42);\n\n $this->hubspotClientMock->expects($this->never())->method('request');\n\n $this->expectException(RateLimitException::class);\n $this->expectExceptionMessage('Hubspot rate limit (cached circuit-breaker)');\n\n try {\n $this->client->search('contacts', []);\n } finally {\n Mockery::close();\n }\n }\n\n public function testSearchThrowsRateLimitExceptionAndSetsNxOnFresh429(): void\n {\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn(null);\n // NX + TTL option array — exact TTL depends on parseRetryAfter, verified separately\n $redisMock->shouldReceive('set')\n ->once()\n ->with(\n 'hubspot:ratelimit:config:42',\n Mockery::type('string'),\n Mockery::on(fn ($opts) => is_array($opts) && in_array('nx', $opts, true))\n );\n\n $this->config->method('getId')->willReturn(42);\n\n $badRequest = new BadRequest('Rate limit exceeded', 429);\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->willThrowException($badRequest);\n\n $this->expectException(RateLimitException::class);\n $this->expectExceptionMessage('Hubspot returned 429');\n\n try {\n $this->client->search('contacts', []);\n } finally {\n Mockery::close();\n }\n }\n\n public function testSearchPropagatesNonRateLimitException(): void\n {\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn(null);\n\n $this->config->method('getId')->willReturn(42);\n\n $exception = new \\SevenShores\\Hubspot\\Exceptions\\HubspotException('Server error', 500);\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->willThrowException($exception);\n\n $this->expectException(\\SevenShores\\Hubspot\\Exceptions\\HubspotException::class);\n $this->expectExceptionMessage('Server error');\n\n try {\n $this->client->search('contacts', []);\n } finally {\n Mockery::close();\n }\n }\n\n public function testSearchCircuitBreakerRetryAfterComputedFromStoredTimestamp(): void\n {\n $remaining = 45;\n $futureTimestamp = (string) (time() + $remaining);\n\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn($futureTimestamp);\n\n $this->config->method('getId')->willReturn(1);\n\n try {\n $this->client->search('deals', []);\n $this->fail('Expected RateLimitException');\n } catch (RateLimitException $e) {\n $this->assertGreaterThanOrEqual(1, $e->getRetryAfter());\n $this->assertLessThanOrEqual($remaining, $e->getRetryAfter());\n } finally {\n Mockery::close();\n }\n }\n\n // -------------------------------------------------------------------------\n // isHubspotRateLimit() tests (private method — tested via reflection)\n // -------------------------------------------------------------------------\n\n private function callIsHubspotRateLimit(\\Throwable $e): bool\n {\n $method = new \\ReflectionMethod($this->client, 'isHubspotRateLimit');\n $method->setAccessible(true);\n\n return $method->invoke($this->client, $e);\n }\n\n public function testIsHubspotRateLimitReturnsTrueForBadRequest429(): void\n {\n $e = new BadRequest('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForDealApiException429(): void\n {\n $e = new DealApiException('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForContactApiException429(): void\n {\n $e = new ContactApiException('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForCompanyApiException429(): void\n {\n $e = new CompanyApiException('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForGuzzleRequestException429(): void\n {\n $request = new \\GuzzleHttp\\Psr7\\Request('POST', 'https://api.hubapi.com/test');\n $response = new \\GuzzleHttp\\Psr7\\Response(429);\n $e = new \\GuzzleHttp\\Exception\\RequestException('Too Many Requests', $request, $response);\n\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsFalseForBadRequestNon429(): void\n {\n $e = new BadRequest('Bad Request', 400);\n $this->assertFalse($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsFalseForGenericException(): void\n {\n $e = new \\RuntimeException('Something went wrong');\n $this->assertFalse($this->callIsHubspotRateLimit($e));\n }\n\n // -------------------------------------------------------------------------\n // parseRetryAfter() tests (private method — tested via reflection)\n // -------------------------------------------------------------------------\n\n private function callParseRetryAfter(\\Throwable $e): int\n {\n $method = new \\ReflectionMethod($this->client, 'parseRetryAfter');\n $method->setAccessible(true);\n\n return $method->invoke($this->client, $e);\n }\n\n public function testParseRetryAfterReadsRetryAfterHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['Retry-After' => ['30']]);\n $this->assertSame(30, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReadsLowercaseRetryAfterHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['retry-after' => ['15']]);\n $this->assertSame(15, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterHandlesScalarHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['Retry-After' => '60']);\n $this->assertSame(60, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsDailyLimitDelay(): void\n {\n $e = new BadRequest('Daily rate limit exceeded');\n $this->assertSame(600, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsTenSecondlyDelay(): void\n {\n $e = new BadRequest('Ten secondly rate limit exceeded');\n $this->assertSame(10, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsSecondlyDelay(): void\n {\n $e = new BadRequest('Secondly rate limit exceeded');\n $this->assertSame(1, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsDefaultWhenNoHint(): void\n {\n $e = new BadRequest('Rate limit exceeded');\n $this->assertSame(10, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterIgnoresNonNumericHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['Retry-After' => ['not-a-number']]);\n // Falls through to message parsing; \"Too Many Requests\" has no known keyword → default 10\n $this->assertSame(10, $this->callParseRetryAfter($e));\n }\n}","depth":4,"bounds":{"left":0.124667555,"top":0.16121309,"width":0.42852393,"height":0.8387869},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Tests\\Unit\\Services\\Crm\\Hubspot;\n\nuse GuzzleHttp\\Psr7\\Response;\nuse HubSpot\\Client\\Crm\\Associations\\Api\\BatchApi;\nuse HubSpot\\Client\\Crm\\Associations\\Model\\BatchInputPublicObjectId;\nuse HubSpot\\Client\\Crm\\Associations\\Model\\BatchResponsePublicAssociationMulti;\nuse HubSpot\\Client\\Crm\\Associations\\Model\\PublicObjectId;\nuse HubSpot\\Client\\Crm\\Companies\\ApiException as CompanyApiException;\nuse HubSpot\\Client\\Crm\\Contacts\\ApiException as ContactApiException;\nuse HubSpot\\Client\\Crm\\Deals\\Api\\BasicApi as DealsBasicApi;\nuse HubSpot\\Client\\Crm\\Deals\\ApiException as DealApiException;\nuse HubSpot\\Client\\Crm\\Deals\\Model\\SimplePublicObjectWithAssociations as DealWithAssociations;\nuse HubSpot\\Client\\Crm\\Pipelines\\Api\\PipelinesApi;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\CollectionResponsePipeline;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\Error;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\Pipeline;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\PipelineStage;\nuse HubSpot\\Client\\Crm\\Properties\\Api\\CoreApi;\nuse HubSpot\\Client\\Crm\\Properties\\Model\\Property;\nuse HubSpot\\Discovery as HubSpotDiscovery;\nuse HubSpot\\Discovery\\Crm\\Deals\\Discovery as DealsDiscovery;\nuse Jiminny\\Exceptions\\RateLimitException;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Services\\Crm\\Hubspot\\Client;\nuse Jiminny\\Services\\Crm\\Hubspot\\HubspotTokenManager;\nuse Jiminny\\Services\\Crm\\Hubspot\\Pagination\\HubspotPaginationService;\nuse Jiminny\\Services\\SocialAccountService;\nuse League\\OAuth2\\Client\\Token\\AccessToken;\nuse Mockery;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Log\\NullLogger;\nuse SevenShores\\Hubspot\\Endpoints\\Engagements;\nuse SevenShores\\Hubspot\\Exceptions\\BadRequest;\nuse SevenShores\\Hubspot\\Factory;\nuse SevenShores\\Hubspot\\Http\\Client as HubspotClient;\nuse SevenShores\\Hubspot\\Http\\Response as HubspotResponse;\n\n/**\n * @runTestsInSeparateProcesses\n *\n * @preserveGlobalState disabled\n */\nclass ClientTest extends TestCase\n{\n private const string RESPONSE_TYPE_STAGE_FIELD = 'stage';\n private const string RESPONSE_TYPE_PIPELINE_FIELD = 'pipeline';\n private const string RESPONSE_TYPE_REGULAR_FIELD = 'regular';\n /**\n * @var Client&MockObject\n */\n private Client $client;\n private Configuration $config;\n\n /**\n * @var SocialAccountService&MockObject\n */\n private SocialAccountService $socialAccountServiceMock;\n\n /**\n * @var HubspotPaginationService&MockObject\n */\n private HubspotPaginationService $paginationServiceMock;\n\n /**\n * @var HubspotTokenManager&MockObject\n */\n private HubspotTokenManager $tokenManagerMock;\n\n /**\n * @var CoreApi&MockObject\n */\n private CoreApi $coreApiMock;\n\n /**\n * @var PipelinesApi&MockObject\n */\n private PipelinesApi $pipelinesApiMock;\n\n /**\n * @var BatchApi&MockObject\n */\n private BatchApi $associationsBatchApiMock;\n\n /**\n * @var DealsBasicApi&MockObject\n */\n private DealsBasicApi $dealsBasicApiMock;\n\n /**\n * @var Engagements&MockObject\n */\n private $engagementsMock;\n\n /**\n * @var HubspotClient&MockObject\n */\n private HubspotClient $hubspotClientMock;\n\n protected function setUp(): void\n {\n // Create mocks for dependencies\n $this->socialAccountServiceMock = $this->createMock(SocialAccountService::class);\n $this->paginationServiceMock = $this->createMock(HubspotPaginationService::class);\n $this->tokenManagerMock = $this->createMock(HubspotTokenManager::class);\n\n // Create a real Client instance with mocked dependencies\n // Create a partial mock only for the methods we need to mock\n $client = $this->createPartialMock(Client::class, ['getInstance', 'getNewInstance', 'makeRequest']);\n $client->setLogger(new NullLogger());\n\n // Inject the real dependencies using reflection\n $reflection = new \\ReflectionClass(Client::class);\n\n $accountServiceProperty = $reflection->getProperty('accountService');\n $accountServiceProperty->setAccessible(true);\n $accountServiceProperty->setValue($client, $this->socialAccountServiceMock);\n\n $paginationServiceProperty = $reflection->getProperty('paginationService');\n $paginationServiceProperty->setAccessible(true);\n $paginationServiceProperty->setValue($client, $this->paginationServiceMock);\n\n $tokenManagerProperty = $reflection->getProperty('tokenManager');\n $tokenManagerProperty->setAccessible(true);\n $tokenManagerProperty->setValue($client, $this->tokenManagerMock);\n $factoryMock = $this->createMock(Factory::class);\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $engagementsMock = $this->createMock(\\SevenShores\\Hubspot\\Endpoints\\Engagements::class);\n\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n $factoryMock->method('__call')->with('engagements')->willReturn($engagementsMock);\n\n $client->method('getInstance')->willReturn($factoryMock);\n\n $discoveryMock = $this->createMock(HubSpotDiscovery\\Discovery::class);\n $crmMock = $this->createMock(HubSpotDiscovery\\Crm\\Discovery::class);\n $associationsMock = $this->createMock(HubSpotDiscovery\\Crm\\Associations\\Discovery::class);\n $propertiesMock = $this->createMock(HubSpotDiscovery\\Crm\\Properties\\Discovery::class);\n $pipelinesMock = $this->createMock(HubSpotDiscovery\\Crm\\Pipelines\\Discovery::class);\n $coreApiMock = $this->createMock(CoreApi::class);\n $pipelinesApiMock = $this->createMock(PipelinesApi::class);\n $associationsBatchApiMock = $this->createMock(BatchApi::class);\n $dealsBasicApiMock = $this->createMock(DealsBasicApi::class);\n\n $propertiesMock->method('__call')->with('coreApi')->willReturn($coreApiMock);\n $pipelinesMock->method('__call')->with('pipelinesApi')->willReturn($pipelinesApiMock);\n $associationsMock->method('__call')->with('batchApi')->willReturn($associationsBatchApiMock);\n $dealsDiscoveryMock = $this->createMock(DealsDiscovery::class);\n $dealsDiscoveryMock->method('__call')->with('basicApi')->willReturn($dealsBasicApiMock);\n\n $returnMap = ['properties' => $propertiesMock, 'pipelines' => $pipelinesMock, 'associations' => $associationsMock, 'deals' => $dealsDiscoveryMock];\n $crmMock->method('__call')\n ->willReturnCallback(static fn (string $name) => $returnMap[$name])\n ;\n\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n\n $this->client = $client;\n $this->config = $this->createMock(Configuration::class);\n $this->client->setConfiguration($this->config);\n $this->coreApiMock = $coreApiMock;\n $this->pipelinesApiMock = $pipelinesApiMock;\n $this->associationsBatchApiMock = $associationsBatchApiMock;\n $this->dealsBasicApiMock = $dealsBasicApiMock;\n $this->engagementsMock = $engagementsMock;\n $this->hubspotClientMock = $hubspotClientMock;\n }\n\n public function testGetMinimumApiVersion(): void\n {\n $this->assertIsString($this->client->getMinimumApiVersion());\n }\n\n public function testGetInstance(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $client = new Client($socialAccountService, $paginationService, $tokenManager);\n $client->setBaseUrl('https://example.com');\n $client->setAccessToken(new AccessToken(['access_token' => 'foo']));\n $factory = $client->getInstance();\n\n $this->assertEquals('foo', $factory->getClient()->key);\n }\n\n public function testGetNewInstance(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $client = new Client($socialAccountService, $paginationService, $tokenManager);\n $client->setAccessToken(new AccessToken(['access_token' => 'foo']));\n\n $factory = $client->getNewInstance();\n $token = $factory->auth()->oAuth()->accessTokensApi()->getConfig()->getAccessToken();\n $this->assertEquals('foo', $token);\n }\n\n public function testFetchProperty(): void\n {\n $this->coreApiMock->method('getByName')->willReturn($this->generateProperty());\n\n $this->assertEquals(\n 'some_property',\n $this->client->fetchProperty('foo', 'test')['name']\n );\n }\n\n public function testFetchPropertyOptions(): void\n {\n $this->coreApiMock->method('getByName')->willReturn($this->generateProperty());\n\n $this->assertEquals(\n [\n [\n 'label' => 'label_1',\n 'value' => 'value_1',\n ],\n [\n 'label' => 'label_2',\n 'value' => 'value_2',\n ],\n ],\n $this->client->fetchPropertyOptions('foo', 'test')\n );\n }\n\n public function testFetchCallDispositions(): void\n {\n $this->engagementsMock\n ->method('getCallDispositions')\n ->willReturn($this->generateHubSpotResponse([\n [\n 'id' => 1,\n 'label' => 'foo',\n 'deleted' => false,\n ],\n [\n 'id' => 2,\n 'label' => 'bar',\n 'deleted' => false,\n ],\n ]))\n ;\n\n $this->assertEquals(\n [\n [\n 'id' => 1,\n 'label' => 'foo',\n 'deleted' => false,\n ],\n [\n 'id' => 2,\n 'label' => 'bar',\n 'deleted' => false,\n ],\n ],\n $this->client->fetchCallDispositions()\n );\n }\n\n public function testFetchDispositionFieldOptions(): void\n {\n $this->engagementsMock->method('getCallDispositions')\n ->willReturn($this->generateHubSpotResponse(\n [\n [\n 'id' => 1,\n 'label' => 'Label 1',\n 'deleted' => false,\n ],\n [\n 'id' => 2,\n 'label' => 'Label 2',\n 'deleted' => true,\n ],\n ]\n ))\n ;\n\n $this->assertEquals(\n [\n [\n 'value' => 1,\n 'id' => 1,\n 'label' => 'Label 1',\n ],\n ],\n $this->client->fetchDispositionFieldOptions()\n );\n }\n\n public function testFetchOpportunityPipelineStages(): void\n {\n /**\n * @TODO: The class CollectionResponsePipeline will be deprecated in the next Hubspot version\n */\n $this->pipelinesApiMock\n ->method('getAll')\n ->with('deals')\n ->willReturn(new CollectionResponsePipeline([\n 'results' => [$this->generatePipeline()],\n ]))\n ;\n\n $this->assertEquals(\n [\n ['id' => 'foo', 'label' => 'bar'],\n ['id' => 'baz', 'label' => 'qux'],\n ],\n $this->client->fetchOpportunityPipelineStages()\n );\n }\n\n public function testFetchOpportunityPipelineStagesErrorResponse(): void\n {\n $this->pipelinesApiMock\n ->method('getAll')\n ->with('deals')\n ->willReturn(new Error(['message' => 'test error']))\n ;\n\n $this->assertEmpty($this->client->fetchOpportunityPipelineStages());\n }\n\n #[\\PHPUnit\\Framework\\Attributes\\DataProvider('meetingOutcomeFieldProvider')]\n public function testFetchMeetingOutcomeFieldOptions(string $fieldId, string $expectedEndpoint): void\n {\n $field = new Field(['crm_provider_id' => $fieldId]);\n\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->with('GET', $expectedEndpoint)\n ->willReturn($this->generateHubSpotResponse(\n [\n 'options' => [\n ['value' => 'option_1', 'label' => 'Option 1', 'displayOrder' => 0],\n ['value' => 'option_2', 'label' => 'Option 2', 'displayOrder' => 1],\n ['value' => 'option_3', 'label' => 'Option 3', 'displayOrder' => 2],\n ],\n ]\n ))\n ;\n\n $this->assertEquals(\n [\n ['id' => 'option_1', 'value' => 'option_1', 'label' => 'Option 1', 'display_order' => 0],\n ['id' => 'option_2', 'value' => 'option_2', 'label' => 'Option 2', 'display_order' => 1],\n ['id' => 'option_3', 'value' => 'option_3', 'label' => 'Option 3', 'display_order' => 2],\n ],\n $this->client->fetchMeetingOutcomeFieldOptions($field)\n );\n }\n\n public static function meetingOutcomeFieldProvider(): array\n {\n return [\n 'meeting outcome field' => [\n 'meetingOutcome',\n 'https://api.hubapi.com/crm/v3/properties/meeting/hs_meeting_outcome',\n ],\n 'activity type field' => [\n 'foobar',\n 'https://api.hubapi.com/crm/v3/properties/call/hs_activity_type',\n ],\n ];\n }\n\n #[\\PHPUnit\\Framework\\Attributes\\DataProvider('opportunityFieldOptionsProvider')]\n public function testFetchOpportunityFieldOptions(Field $field, string $type): void\n {\n $responses = [\n self::RESPONSE_TYPE_STAGE_FIELD => [\n ['id' => 'foo', 'label' => 'bar'],\n ['id' => 'baz', 'label' => 'qux'],\n ],\n self::RESPONSE_TYPE_PIPELINE_FIELD => [\n ['id' => '123', 'label' => 'Sales'],\n ['id' => 'default', 'label' => 'CS'],\n ],\n self::RESPONSE_TYPE_REGULAR_FIELD => [\n [\n 'label' => 'label_1',\n 'value' => 'value_1',\n ],\n [\n 'label' => 'label_2',\n 'value' => 'value_2',\n ],\n ],\n ];\n\n $field = $this->createMock(Field::class);\n\n if ($type === self::RESPONSE_TYPE_REGULAR_FIELD) {\n $field->method('isStageField')->willReturn(false);\n $field->method('isPipelineField')->willReturn(false);\n $propertyResponse = $this->generateProperty();\n $this->coreApiMock->method('getByName')->willReturn($propertyResponse);\n }\n\n if ($type === self::RESPONSE_TYPE_STAGE_FIELD) {\n $field->method('isStageField')->willReturn(true);\n /**\n * @TODO: The class CollectionResponsePipeline will be deprecated in the next Hubspot version\n */\n\n $pipelineStagesResponse = new CollectionResponsePipeline([\n 'results' => [$this->generatePipeline()],\n ]);\n $this->pipelinesApiMock\n ->method('getAll')\n ->willReturn($pipelineStagesResponse);\n }\n\n if ($type === self::RESPONSE_TYPE_PIPELINE_FIELD) {\n $field->method('isStageField')->willReturn(false);\n $field->method('isPipelineField')->willReturn(true);\n $pipelineResponse = $this->generateHubSpotResponse([\n 'results' => [\n ['id' => '123', 'label' => 'Sales'],\n ['id' => 'default', 'label' => 'CS'],\n ],\n ]);\n $this->client\n ->method('makeRequest')\n ->with('/crm/v3/pipelines/deals')\n ->willReturn($pipelineResponse);\n }\n\n $this->assertEquals(\n $responses[$type],\n $this->client->fetchOpportunityFieldOptions($field)\n );\n }\n\n public static function opportunityFieldOptionsProvider(): array\n {\n return [\n 'stage field' => [\n 'field' => new Field(['crm_provider_id' => 'dealstage']),\n 'type' => self::RESPONSE_TYPE_STAGE_FIELD,\n ],\n 'pipeline field' => [\n 'field' => new Field(['crm_provider_id' => 'pipeline']),\n 'type' => self::RESPONSE_TYPE_PIPELINE_FIELD,\n ],\n 'regular field' => [\n 'field' => new Field(['crm_provider_id' => 'some_property']),\n 'type' => self::RESPONSE_TYPE_REGULAR_FIELD,\n ],\n ];\n }\n\n private function generateHubSpotResponse(array $data): HubspotResponse\n {\n return new HubspotResponse(new Response(200, [], json_encode($data)));\n }\n\n private function generateProperty(): Property\n {\n return new Property([\n 'name' => 'some_property',\n 'options' => [\n [\n 'label' => 'label_1',\n 'value' => 'value_1',\n ],\n [\n 'label' => 'label_2',\n 'value' => 'value_2',\n ],\n ],\n ]);\n }\n\n private function generatePipeline(): Pipeline\n {\n return new Pipeline(['stages' => [\n new PipelineStage(['id' => 'foo', 'label' => 'bar']),\n new PipelineStage(['id' => 'baz', 'label' => 'qux']),\n ]]);\n }\n\n public function testFetchOpportunityPipelines(): void\n {\n $this->client\n ->method('makeRequest')\n ->with('/crm/v3/pipelines/deals')\n ->willReturn($this->generateHubSpotResponse([\n 'results' => [\n ['id' => 'id_1', 'label' => 'Option 1', 'displayOrder' => 0],\n ['id' => 'id_2', 'label' => 'Option 2', 'displayOrder' => 1],\n ['id' => 'id_3', 'label' => 'Option 3', 'displayOrder' => 2],\n ],\n ]));\n\n $this->assertEquals(\n [\n ['id' => 'id_1', 'label' => 'Option 1'],\n ['id' => 'id_2', 'label' => 'Option 2'],\n ['id' => 'id_3', 'label' => 'Option 3'],\n ],\n $this->client->fetchOpportunityPipelines()\n );\n }\n\n public function testGetPaginatedData(): void\n {\n $expectedResults = [\n ['id' => 'id_1', 'properties' => []],\n ['id' => 'id_2', 'properties' => []],\n ['id' => 'id_3', 'properties' => []],\n ];\n\n // Mock the pagination service to return a generator and modify reference parameters\n $this->paginationServiceMock\n ->expects($this->once())\n ->method('getPaginatedDataGenerator')\n ->with(\n $this->client,\n ['payload_key' => 'payload_value'],\n 'foobar',\n 0,\n $this->anything(),\n $this->anything()\n )\n ->willReturnCallback(function ($client, $payload, $type, $offset, &$total, &$lastRecordId) use ($expectedResults) {\n $total = 3;\n $lastRecordId = 'id_3';\n foreach ($expectedResults as $result) {\n yield $result;\n }\n });\n\n $this->assertEquals(\n [\n 'results' => $expectedResults,\n 'total' => 3,\n 'last_record' => 'id_3',\n ],\n $this->client->getPaginatedData(['payload_key' => 'payload_value'], 'foobar')\n );\n }\n\n public function testGetAssociationsData(): void\n {\n $ids = ['1', '2', '3'];\n $fromObject = 'deals';\n $toObject = 'contacts';\n\n $responseResults = [];\n foreach ($ids as $id) {\n $from = new PublicObjectId();\n $from->setId($id);\n\n $to1 = new PublicObjectId();\n $to1->setId('contact_' . $id . '_1');\n $to2 = new PublicObjectId();\n $to2->setId('contact_' . $id . '_2');\n\n $result = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicAssociationMulti();\n $result->setFrom($from);\n $result->setTo([$to1, $to2]);\n\n $responseResults[] = $result;\n }\n\n $batchResponse = new BatchResponsePublicAssociationMulti();\n $batchResponse->setResults($responseResults);\n\n $this->associationsBatchApiMock->expects($this->once())\n ->method('read')\n ->with(\n $this->equalTo($fromObject),\n $this->equalTo($toObject),\n $this->callback(function (BatchInputPublicObjectId $batchInput) use ($ids) {\n $inputIds = array_map(\n fn ($input) => $input->getId(),\n $batchInput->getInputs()\n );\n\n return $inputIds === $ids;\n })\n )\n ->willReturn($batchResponse);\n\n $result = $this->client->getAssociationsData($ids, $fromObject, $toObject);\n\n $expectedResult = [\n '1' => ['contact_1_1', 'contact_1_2'],\n '2' => ['contact_2_1', 'contact_2_2'],\n '3' => ['contact_3_1', 'contact_3_2'],\n ];\n\n $this->assertEquals($expectedResult, $result);\n }\n\n public function testGetAssociationsDataHandlesException(): void\n {\n $ids = ['1', '2', '3'];\n $fromObject = 'deals';\n $toObject = 'contacts';\n\n $exception = new \\Exception('API Error');\n\n $this->associationsBatchApiMock->expects($this->once())\n ->method('read')\n ->with(\n $this->equalTo($fromObject),\n $this->equalTo($toObject),\n $this->callback(function ($batchInput) use ($ids) {\n return $batchInput instanceof \\HubSpot\\Client\\Crm\\Associations\\Model\\BatchInputPublicObjectId\n && count($batchInput->getInputs()) === count($ids);\n })\n )\n ->willThrowException($exception);\n\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with(\n '[Hubspot] Failed to fetch associations',\n [\n 'from_object' => $fromObject,\n 'to_object' => $toObject,\n 'reason' => 'API Error',\n ]\n );\n\n $this->client->setLogger($loggerMock);\n\n $result = $this->client->getAssociationsData($ids, $fromObject, $toObject);\n\n $this->assertEmpty($result);\n $this->assertIsArray($result);\n }\n\n public function testGetAssociationsDataWithLargeDataSet(): void\n {\n $ids = array_map(fn ($i) => (string) $i, range(1, 2500)); // More than 1000 items\n $fromObject = 'deals';\n $toObject = 'contacts';\n\n $firstBatchResponse = new BatchResponsePublicAssociationMulti();\n $firstBatchResults = array_map(function ($id) {\n $from = new PublicObjectId();\n $from->setId($id);\n $to = new PublicObjectId();\n $to->setId('contact_' . $id);\n $result = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicAssociationMulti();\n $result->setFrom($from);\n $result->setTo([$to]);\n\n return $result;\n }, array_slice($ids, 0, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));\n $firstBatchResponse->setResults($firstBatchResults);\n\n $secondBatchResponse = new BatchResponsePublicAssociationMulti();\n $secondBatchResults = array_map(function ($id) {\n $from = new PublicObjectId();\n $from->setId($id);\n $to = new PublicObjectId();\n $to->setId('contact_' . $id);\n $result = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicAssociationMulti();\n $result->setFrom($from);\n $result->setTo([$to]);\n\n return $result;\n }, array_slice($ids, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));\n $secondBatchResponse->setResults($secondBatchResults);\n\n $this->associationsBatchApiMock->expects($this->exactly(3))\n ->method('read')\n ->willReturnOnConsecutiveCalls($firstBatchResponse, $secondBatchResponse);\n\n $result = $this->client->getAssociationsData($ids, $fromObject, $toObject);\n\n $this->assertCount(2500, $result);\n $this->assertArrayHasKey('1', $result);\n $this->assertArrayHasKey('2500', $result);\n $this->assertEquals(['contact_1'], $result['1']);\n $this->assertEquals(['contact_2500'], $result['2500']);\n }\n\n public function testGetContactByEmailSuccess(): void\n {\n $email = 'test@example.com';\n $fields = ['firstname', 'lastname', 'email'];\n\n $contactMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations::class);\n $contactMock->method('getId')->willReturn('12345');\n $contactMock->method('getProperties')->willReturn([\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n 'email' => 'test@example.com',\n ]);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($email, 'firstname,lastname,email', null, false, 'email')\n ->willReturn($contactMock);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new NullLogger());\n\n $result = $client->getContactByEmail($email, $fields);\n\n $this->assertEquals([\n 'id' => '12345',\n 'properties' => [\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n 'email' => 'test@example.com',\n ],\n ], $result);\n }\n\n public function testGetContactByEmailWithEmptyFields(): void\n {\n $email = 'test@example.com';\n $fields = [];\n\n $contactMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations::class);\n $contactMock->method('getId')->willReturn('12345');\n $contactMock->method('getProperties')->willReturn(['email' => 'test@example.com']);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($email, '', null, false, 'email')\n ->willReturn($contactMock);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new NullLogger());\n\n $result = $client->getContactByEmail($email, $fields);\n\n $this->assertEquals([\n 'id' => '12345',\n 'properties' => ['email' => 'test@example.com'],\n ], $result);\n }\n\n public function testGetContactByEmailApiException(): void\n {\n $email = 'nonexistent@example.com';\n $fields = ['firstname', 'lastname'];\n\n $exception = new \\HubSpot\\Client\\Crm\\Contacts\\ApiException('Contact not found', 404);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($email, 'firstname,lastname', null, false, 'email')\n ->willThrowException($exception);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('info')\n ->with(\n '[Hubspot] Failed to fetch contact',\n [\n 'email' => $email,\n 'reason' => 'Contact not found',\n ]\n );\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger($loggerMock);\n\n $result = $client->getContactByEmail($email, $fields);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetOpportunityById(): void\n {\n $opportunityId = '12345';\n $expectedProperties = [\n 'dealname' => 'Test Opportunity',\n 'amount' => '1000.00',\n 'closedate' => '2024-12-31T23:59:59.999Z',\n 'dealstage' => 'presentationscheduled',\n 'pipeline' => 'default',\n ];\n\n $mockHubspotOpportunity = $this->createMock(DealWithAssociations::class);\n $mockHubspotOpportunity->method('getProperties')->willReturn((object) $expectedProperties);\n $mockHubspotOpportunity->method('getId')->willReturn($opportunityId);\n $now = new \\DateTimeImmutable();\n $mockHubspotOpportunity->method('getCreatedAt')->willReturn($now);\n $mockHubspotOpportunity->method('getUpdatedAt')->willReturn($now);\n $mockHubspotOpportunity->method('getArchived')->willReturn(false);\n\n $this->dealsBasicApiMock\n ->expects($this->once())\n ->method('getById')\n ->willReturn($mockHubspotOpportunity);\n\n // Assuming Client::getOpportunityById processes the SimplePublicObject and returns an associative array.\n // The structure might be like: ['id' => ..., 'properties' => [...], 'createdAt' => ..., ...]\n // Adjust assertions below based on the actual return structure of your method.\n $result = $this->client->getOpportunityById($opportunityId, ['test', 'test']);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('id', $result);\n $this->assertEquals($opportunityId, $result['id']);\n }\n\n public function testGetContactById(): void\n {\n $crmId = 'contact-123';\n $fields = ['firstname', 'lastname'];\n $expectedProperties = ['firstname' => 'John', 'lastname' => 'Doe'];\n\n $mockContact = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations::class);\n $mockContact->method('getId')->willReturn($crmId);\n $mockContact->method('getProperties')->willReturn((object) $expectedProperties);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($crmId, 'firstname,lastname')\n ->willReturn($mockContact);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new \\Psr\\Log\\NullLogger());\n\n $result = $client->getContactById($crmId, $fields);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('id', $result);\n $this->assertArrayHasKey('properties', $result);\n $this->assertEquals($crmId, $result['id']);\n $this->assertEquals((object) $expectedProperties, $result['properties']);\n }\n\n public function testGetAccountById(): void\n {\n $crmId = 'account-123';\n $fields = ['name', 'industry'];\n $expectedProperties = ['name' => 'Acme Corp', 'industry' => 'Technology'];\n\n $mockCompany = $this->createMock(\\HubSpot\\Client\\Crm\\Companies\\Model\\SimplePublicObjectWithAssociations::class);\n $mockCompany->method('getId')->willReturn($crmId);\n $mockCompany->method('getProperties')->willReturn((object) $expectedProperties);\n\n $companiesApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Companies\\Api\\BasicApi::class);\n $companiesApiMock->expects($this->once())\n ->method('getById')\n ->with($crmId, 'name,industry')\n ->willReturn($mockCompany);\n\n $companiesDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Companies\\Discovery::class);\n $companiesDiscoveryMock->method('__call')->with('basicApi')->willReturn($companiesApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($companiesDiscoveryMock) {\n if ($name === 'companies') {\n return $companiesDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new \\Psr\\Log\\NullLogger());\n\n $result = $client->getAccountById($crmId, $fields);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('id', $result);\n $this->assertArrayHasKey('properties', $result);\n $this->assertEquals($crmId, $result['id']);\n $this->assertEquals((object) $expectedProperties, $result['properties']);\n }\n\n public function testEnsureValidTokenWithNoTokenUpdate(): void\n {\n $socialAccountMock = $this->createMock(SocialAccount::class);\n\n // Set up OAuth account\n $reflection = new \\ReflectionClass($this->client);\n $oauthAccountProperty = $reflection->getProperty('oauthAccount');\n $oauthAccountProperty->setAccessible(true);\n $oauthAccountProperty->setValue($this->client, $socialAccountMock);\n\n $originalToken = 'original_token';\n $accessTokenProperty = $reflection->getProperty('accessToken');\n $accessTokenProperty->setAccessible(true);\n $accessTokenProperty->setValue($this->client, $originalToken);\n\n // Mock token manager to return null (no refresh needed)\n $this->tokenManagerMock\n ->expects($this->once())\n ->method('ensureValidToken')\n ->with($socialAccountMock)\n ->willReturn(null);\n\n // Call ensureValidToken\n $this->client->ensureValidToken();\n\n // Verify access token was not changed\n $this->assertEquals($originalToken, $accessTokenProperty->getValue($this->client));\n }\n\n\n\n\n\n\n public function testGetPaginatedDataGeneratorDelegatesToPaginationService(): void\n {\n $payload = ['filters' => []];\n $type = 'contacts';\n $offset = 0;\n $total = 0;\n $lastRecordId = null;\n\n $expectedResults = [\n ['id' => 'id_1', 'properties' => []],\n ['id' => 'id_2', 'properties' => []],\n ];\n\n // Mock the pagination service to return a generator\n $this->paginationServiceMock\n ->expects($this->once())\n ->method('getPaginatedDataGenerator')\n ->with(\n $this->client,\n $payload,\n $type,\n $offset,\n $this->anything(),\n $this->anything()\n )\n ->willReturnCallback(function () use ($expectedResults) {\n foreach ($expectedResults as $result) {\n yield $result;\n }\n });\n\n // Execute the pagination\n $results = [];\n foreach ($this->client->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastRecordId) as $result) {\n $results[] = $result;\n }\n\n $this->assertCount(2, $results);\n $this->assertEquals('id_1', $results[0]['id']);\n $this->assertEquals('id_2', $results[1]['id']);\n }\n\n public function testEnsureValidTokenDelegatesToTokenManager(): void\n {\n $socialAccountMock = $this->createMock(SocialAccount::class);\n\n // Set up OAuth account\n $reflection = new \\ReflectionClass($this->client);\n $oauthAccountProperty = $reflection->getProperty('oauthAccount');\n $oauthAccountProperty->setAccessible(true);\n $oauthAccountProperty->setValue($this->client, $socialAccountMock);\n\n // Mock token manager to return new token\n $this->tokenManagerMock\n ->expects($this->once())\n ->method('ensureValidToken')\n ->with($socialAccountMock)\n ->willReturn('new_access_token');\n\n // Call ensureValidToken\n $this->client->ensureValidToken();\n\n // Verify access token was updated\n $accessTokenProperty = $reflection->getProperty('accessToken');\n $accessTokenProperty->setAccessible(true);\n $this->assertEquals('new_access_token', $accessTokenProperty->getValue($this->client));\n }\n\n public function testGetOwnersArchivedWithValidResponse(): void\n {\n $responseData = [\n 'results' => [\n [\n 'id' => '123',\n 'email' => 'owner1@example.com',\n 'type' => 'PERSON',\n 'firstName' => 'John',\n 'lastName' => 'Doe',\n 'userId' => 456,\n 'userIdIncludingInactive' => 789,\n 'createdAt' => '2023-01-01T12:00:00Z',\n 'updatedAt' => '2023-01-02T12:00:00Z',\n 'archived' => true,\n ],\n ],\n ];\n\n // Create a mock response object\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willReturn($responseData);\n\n // Set up the client to return our test data\n $this->client->method('makeRequest')\n ->with(\n '/crm/v3/owners',\n 'GET',\n [],\n 'archived=true'\n )\n ->willReturn($response);\n\n // Call the method\n $result = $this->client->getOwnersArchived(true);\n\n // Assert the results\n $this->assertCount(1, $result);\n $this->assertEquals('123', $result[0]->getId());\n $this->assertEquals('owner1@example.com', $result[0]->getEmail());\n $this->assertEquals('John Doe', $result[0]->getFullName());\n $this->assertTrue($result[0]->isArchived());\n }\n\n public function testGetOwnersArchivedWithEmptyResponse(): void\n {\n // Create a mock response object with empty results\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willReturn(['results' => []]);\n\n // Set up the client to return empty results\n $this->client->method('makeRequest')\n ->with(\n '/crm/v3/owners',\n 'GET',\n [],\n 'archived=false'\n )\n ->willReturn($response);\n\n // Call the method\n $result = $this->client->getOwnersArchived(false);\n\n // Assert the results\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testGetOwnersArchivedWithInvalidResponse(): void\n {\n // Create a mock response that will throw an exception when toArray is called\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willThrowException(new \\InvalidArgumentException('Invalid JSON'));\n\n // Set up the client to return the problematic response\n $this->client->method('makeRequest')\n ->willReturn($response);\n\n // Mock the logger to expect an error message\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with($this->stringContains('Failed to fetch owners'));\n\n $reflection = new \\ReflectionClass($this->client);\n $loggerProperty = $reflection->getProperty('log');\n $loggerProperty->setAccessible(true);\n $loggerProperty->setValue($this->client, $loggerMock);\n\n // Call the method and expect an empty array on error\n $result = $this->client->getOwnersArchived(true);\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testGetOwnersArchivedWithHttpError(): void\n {\n // Set up the client to throw an exception\n $this->client->method('makeRequest')\n ->willThrowException(new \\Exception('HTTP Error'));\n\n // Mock the logger to expect an error message\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with($this->stringContains('Failed to fetch owners'));\n\n $reflection = new \\ReflectionClass($this->client);\n $loggerProperty = $reflection->getProperty('log');\n $loggerProperty->setAccessible(true);\n $loggerProperty->setValue($this->client, $loggerMock);\n\n // Call the method and expect an empty array on error\n $result = $this->client->getOwnersArchived(false);\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testGetOwnersArchivedWithOwnerCreationException(): void\n {\n $responseData = [\n 'results' => [\n [\n 'id' => '123',\n 'email' => 'valid@example.com',\n 'type' => 'PERSON',\n 'firstName' => 'John',\n 'lastName' => 'Doe',\n 'userId' => 456,\n 'userIdIncludingInactive' => 789,\n 'createdAt' => '2023-01-01T12:00:00Z',\n 'updatedAt' => '2023-01-02T12:00:00Z',\n 'archived' => false,\n ],\n [\n 'id' => '456',\n 'email' => 'invalid@example.com',\n 'type' => 'PERSON',\n 'createdAt' => 'invalid-date-format',\n ],\n [\n 'id' => '789',\n 'email' => 'another@example.com',\n 'type' => 'PERSON',\n 'firstName' => 'Jane',\n 'lastName' => 'Smith',\n 'userId' => 999,\n 'userIdIncludingInactive' => 888,\n 'createdAt' => '2023-01-03T12:00:00Z',\n 'updatedAt' => '2023-01-04T12:00:00Z',\n 'archived' => false,\n ],\n ],\n ];\n\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willReturn($responseData);\n\n $this->client->method('makeRequest')\n ->with(\n '/crm/v3/owners',\n 'GET',\n [],\n 'archived=false'\n )\n ->willReturn($response);\n\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with(\n '[HubSpot] Failed to process owner data',\n $this->callback(function ($context) {\n return isset($context['result']) &&\n isset($context['error']) &&\n $context['result']['id'] === '456' &&\n $context['result']['email'] === 'invalid@example.com' &&\n str_contains($context['error'], 'invalid-date-format');\n })\n );\n\n $reflection = new \\ReflectionClass($this->client);\n $loggerProperty = $reflection->getProperty('log');\n $loggerProperty->setAccessible(true);\n $loggerProperty->setValue($this->client, $loggerMock);\n\n $result = $this->client->getOwnersArchived(false);\n\n $this->assertIsArray($result);\n $this->assertCount(2, $result);\n $this->assertEquals('123', $result[0]->getId());\n $this->assertEquals('valid@example.com', $result[0]->getEmail());\n $this->assertEquals('789', $result[1]->getId());\n $this->assertEquals('another@example.com', $result[1]->getEmail());\n }\n\n public function testMakeRequestWithGetMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'success']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'GET',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n [],\n null,\n true\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'GET');\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithGetMethodAndQueryString(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'success']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'GET',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n [],\n 'limit=10&offset=0',\n true\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'GET', [], 'limit=10&offset=0');\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithPostMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $payload = [\n 'properties' => [\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n ],\n ];\n\n $psrResponse = new Response(200, [], json_encode(['id' => '12345']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'POST',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n ['json' => $payload]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'POST', $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithPutMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $payload = [\n 'properties' => [\n 'firstname' => 'Jane',\n ],\n ];\n\n $psrResponse = new Response(200, [], json_encode(['id' => '12345', 'updated' => true]));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'PUT',\n 'https://api.hubapi.com/crm/v3/objects/contacts/12345',\n ['json' => $payload]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts/12345', 'PUT', $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithPatchMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $payload = [\n 'properties' => [\n 'email' => 'newemail@example.com',\n ],\n ];\n\n $psrResponse = new Response(200, [], json_encode(['id' => '12345', 'patched' => true]));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'PATCH',\n 'https://api.hubapi.com/crm/v3/objects/contacts/12345',\n ['json' => $payload]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts/12345', 'PATCH', $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithDeleteMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['deleted' => true]));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'DELETE',\n 'https://api.hubapi.com/crm/v3/objects/contacts/12345',\n ['json' => []]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts/12345', 'DELETE');\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithEmptyPayload(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'ok']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'POST',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n ['json' => []]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'POST', []);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestPrependsBaseUrl(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'success']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n $this->anything(),\n 'https://api.hubapi.com/test/endpoint',\n $this->anything()\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $client->makeRequest('/test/endpoint', 'GET');\n }\n\n public function testGetOpportunitiesByIds(): void\n {\n $crmIds = ['deal1', 'deal2', 'deal3'];\n $fields = ['dealname', 'amount'];\n\n // Test basic functionality - method exists and returns array\n $this->assertTrue(method_exists($this->client, 'getOpportunitiesByIds'));\n }\n\n public function testGetCompaniesByIds(): void\n {\n $crmIds = ['company1', 'company2'];\n $fields = ['name', 'industry'];\n\n // Test basic functionality - method exists and returns array\n $this->assertTrue(method_exists($this->client, 'getCompaniesByIds'));\n }\n\n public function testGetContactsByIds(): void\n {\n $crmIds = ['contact1', 'contact2'];\n $fields = ['firstname', 'lastname'];\n\n // Test basic functionality - method exists and returns array\n $this->assertTrue(method_exists($this->client, 'getContactsByIds'));\n }\n\n public function testBatchReadObjectsEmptyIds(): void\n {\n $reflection = new \\ReflectionClass($this->client);\n $method = $reflection->getMethod('batchReadObjects');\n $method->setAccessible(true);\n\n $result = $method->invokeArgs($this->client, ['deals', [], ['dealname']]);\n\n $this->assertEquals([], $result);\n }\n\n public function testBatchReadObjectsExceedsBatchSize(): void\n {\n $crmIds = array_fill(0, 101, 'deal_id'); // 101 IDs, exceeds limit of 100\n\n $reflection = new \\ReflectionClass($this->client);\n $method = $reflection->getMethod('batchReadObjects');\n $method->setAccessible(true);\n\n $this->expectException(\\InvalidArgumentException::class);\n $this->expectExceptionMessage('Batch size cannot exceed 100 deals');\n\n $method->invokeArgs($this->client, ['deals', $crmIds, ['dealname']]);\n }\n\n public function testBatchReadObjectsUnsupportedObjectType(): void\n {\n $reflection = new \\ReflectionClass($this->client);\n $method = $reflection->getMethod('batchReadObjects');\n $method->setAccessible(true);\n\n $this->expectException(\\Jiminny\\Exceptions\\CrmException::class);\n $this->expectExceptionMessage('Failed to batch fetch unsupported');\n\n $method->invokeArgs($this->client, ['unsupported', ['id1'], ['field1']]);\n }\n\n public function testIsUnauthorizedExceptionWithBadRequest401(): void\n {\n $exception = new \\SevenShores\\Hubspot\\Exceptions\\BadRequest('Unauthorized', 401);\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithBadRequestNon401(): void\n {\n $exception = new \\SevenShores\\Hubspot\\Exceptions\\BadRequest('Bad Request', 400);\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertFalse($result);\n }\n\n public function testIsUnauthorizedExceptionWithGuzzleRequestException(): void\n {\n $response = new Response(401, [], 'Unauthorized');\n $exception = new \\GuzzleHttp\\Exception\\RequestException('Unauthorized', new \\GuzzleHttp\\Psr7\\Request('GET', 'test'), $response);\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithGuzzleClientException(): void\n {\n $exception = new \\GuzzleHttp\\Exception\\ClientException('Unauthorized', new \\GuzzleHttp\\Psr7\\Request('GET', 'test'), new Response(401));\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithStringMatching(): void\n {\n $exception = new \\Exception('HTTP 401 Unauthorized error occurred');\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithNonUnauthorized(): void\n {\n $exception = new \\Exception('Some other error');\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertFalse($result);\n }\n\n public function testEnsureValidTokenWithNullOauthAccount(): void\n {\n $reflection = new \\ReflectionClass($this->client);\n $oauthAccountProperty = $reflection->getProperty('oauthAccount');\n $oauthAccountProperty->setAccessible(true);\n $oauthAccountProperty->setValue($this->client, null);\n\n // Should not throw exception and not call token manager\n $this->tokenManagerMock->expects($this->never())->method('ensureValidToken');\n\n $this->client->ensureValidToken();\n\n $this->assertTrue(true); // Test passes if no exception is thrown\n }\n\n public function testGetConfig(): void\n {\n $result = $this->client->getConfig();\n\n $this->assertSame($this->config, $result);\n }\n\n public function testGetOwners(): void\n {\n // Test that the method exists and can be called\n $this->assertTrue(method_exists($this->client, 'getOwners'));\n\n // Since getOwners has complex HubSpot API dependencies,\n // we'll just verify the method exists for now\n $this->assertIsCallable([$this->client, 'getOwners']);\n }\n\n public function testCreateMeeting(): void\n {\n $payload = [\n 'properties' => [\n 'hs_meeting_title' => 'Test Meeting',\n 'hs_meeting_start_time' => '2024-01-01T10:00:00Z',\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['id' => 'meeting123']);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with('/crm/v3/objects/meetings', 'POST', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->createMeeting($payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testUpdateMeeting(): void\n {\n $meetingId = 'meeting123';\n $payload = [\n 'properties' => [\n 'hs_meeting_title' => 'Updated Meeting',\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['id' => $meetingId, 'updated' => true]);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with(\"/crm/v3/objects/meetings/{$meetingId}\", 'PATCH', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->updateMeeting($meetingId, $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testAddAssociations(): void\n {\n $objectType = 'deals';\n $associationType = 'contacts';\n $payload = [\n 'inputs' => [\n ['from' => ['id' => 'deal1'], 'to' => ['id' => 'contact1']],\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['status' => 'success']);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with(\"/crm/v4/associations/{$objectType}/{$associationType}/batch/create\", 'POST', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->addAssociations($objectType, $associationType, $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testRemoveAssociations(): void\n {\n $objectType = 'deals';\n $associationType = 'contacts';\n $payload = [\n 'inputs' => [\n ['from' => ['id' => 'deal1'], 'to' => ['id' => 'contact1']],\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['status' => 'success']);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with(\"/crm/v4/associations/{$objectType}/{$associationType}/batch/archive\", 'POST', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->removeAssociations($objectType, $associationType, $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n // -------------------------------------------------------------------------\n // search() / executeRequest() tests\n // -------------------------------------------------------------------------\n\n public function testSearchReturnsDecodedArrayOnSuccess(): void\n {\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn(null);\n\n $this->config->method('getId')->willReturn(42);\n\n $payload = ['filters' => []];\n $responseData = ['results' => [['id' => '1']], 'total' => 1, 'paging' => []];\n $hubspotResponse = new HubspotResponse(new Response(200, [], json_encode($responseData)));\n\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->with('POST', Client::BASE_URL . '/crm/v3/objects/contacts/search', ['json' => $payload])\n ->willReturn($hubspotResponse);\n\n $result = $this->client->search('contacts', $payload);\n\n $this->assertSame($responseData, $result);\n\n Mockery::close();\n }\n\n public function testSearchThrowsRateLimitExceptionWhenCircuitBreakerActive(): void\n {\n $futureTimestamp = (string) (time() + 30);\n\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn($futureTimestamp);\n\n $this->config->method('getId')->willReturn(42);\n\n $this->hubspotClientMock->expects($this->never())->method('request');\n\n $this->expectException(RateLimitException::class);\n $this->expectExceptionMessage('Hubspot rate limit (cached circuit-breaker)');\n\n try {\n $this->client->search('contacts', []);\n } finally {\n Mockery::close();\n }\n }\n\n public function testSearchThrowsRateLimitExceptionAndSetsNxOnFresh429(): void\n {\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn(null);\n // NX + TTL option array — exact TTL depends on parseRetryAfter, verified separately\n $redisMock->shouldReceive('set')\n ->once()\n ->with(\n 'hubspot:ratelimit:config:42',\n Mockery::type('string'),\n Mockery::on(fn ($opts) => is_array($opts) && in_array('nx', $opts, true))\n );\n\n $this->config->method('getId')->willReturn(42);\n\n $badRequest = new BadRequest('Rate limit exceeded', 429);\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->willThrowException($badRequest);\n\n $this->expectException(RateLimitException::class);\n $this->expectExceptionMessage('Hubspot returned 429');\n\n try {\n $this->client->search('contacts', []);\n } finally {\n Mockery::close();\n }\n }\n\n public function testSearchPropagatesNonRateLimitException(): void\n {\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn(null);\n\n $this->config->method('getId')->willReturn(42);\n\n $exception = new \\SevenShores\\Hubspot\\Exceptions\\HubspotException('Server error', 500);\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->willThrowException($exception);\n\n $this->expectException(\\SevenShores\\Hubspot\\Exceptions\\HubspotException::class);\n $this->expectExceptionMessage('Server error');\n\n try {\n $this->client->search('contacts', []);\n } finally {\n Mockery::close();\n }\n }\n\n public function testSearchCircuitBreakerRetryAfterComputedFromStoredTimestamp(): void\n {\n $remaining = 45;\n $futureTimestamp = (string) (time() + $remaining);\n\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn($futureTimestamp);\n\n $this->config->method('getId')->willReturn(1);\n\n try {\n $this->client->search('deals', []);\n $this->fail('Expected RateLimitException');\n } catch (RateLimitException $e) {\n $this->assertGreaterThanOrEqual(1, $e->getRetryAfter());\n $this->assertLessThanOrEqual($remaining, $e->getRetryAfter());\n } finally {\n Mockery::close();\n }\n }\n\n // -------------------------------------------------------------------------\n // isHubspotRateLimit() tests (private method — tested via reflection)\n // -------------------------------------------------------------------------\n\n private function callIsHubspotRateLimit(\\Throwable $e): bool\n {\n $method = new \\ReflectionMethod($this->client, 'isHubspotRateLimit');\n $method->setAccessible(true);\n\n return $method->invoke($this->client, $e);\n }\n\n public function testIsHubspotRateLimitReturnsTrueForBadRequest429(): void\n {\n $e = new BadRequest('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForDealApiException429(): void\n {\n $e = new DealApiException('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForContactApiException429(): void\n {\n $e = new ContactApiException('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForCompanyApiException429(): void\n {\n $e = new CompanyApiException('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForGuzzleRequestException429(): void\n {\n $request = new \\GuzzleHttp\\Psr7\\Request('POST', 'https://api.hubapi.com/test');\n $response = new \\GuzzleHttp\\Psr7\\Response(429);\n $e = new \\GuzzleHttp\\Exception\\RequestException('Too Many Requests', $request, $response);\n\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsFalseForBadRequestNon429(): void\n {\n $e = new BadRequest('Bad Request', 400);\n $this->assertFalse($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsFalseForGenericException(): void\n {\n $e = new \\RuntimeException('Something went wrong');\n $this->assertFalse($this->callIsHubspotRateLimit($e));\n }\n\n // -------------------------------------------------------------------------\n // parseRetryAfter() tests (private method — tested via reflection)\n // -------------------------------------------------------------------------\n\n private function callParseRetryAfter(\\Throwable $e): int\n {\n $method = new \\ReflectionMethod($this->client, 'parseRetryAfter');\n $method->setAccessible(true);\n\n return $method->invoke($this->client, $e);\n }\n\n public function testParseRetryAfterReadsRetryAfterHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['Retry-After' => ['30']]);\n $this->assertSame(30, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReadsLowercaseRetryAfterHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['retry-after' => ['15']]);\n $this->assertSame(15, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterHandlesScalarHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['Retry-After' => '60']);\n $this->assertSame(60, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsDailyLimitDelay(): void\n {\n $e = new BadRequest('Daily rate limit exceeded');\n $this->assertSame(600, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsTenSecondlyDelay(): void\n {\n $e = new BadRequest('Ten secondly rate limit exceeded');\n $this->assertSame(10, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsSecondlyDelay(): void\n {\n $e = new BadRequest('Secondly rate limit exceeded');\n $this->assertSame(1, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsDefaultWhenNoHint(): void\n {\n $e = new BadRequest('Rate limit exceeded');\n $this->assertSame(10, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterIgnoresNonNumericHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['Retry-After' => ['not-a-number']]);\n // Falls through to message parsing; \"Too Many Requests\" has no known keyword → default 10\n $this->assertSame(10, $this->callParseRetryAfter($e));\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"19","depth":4,"bounds":{"left":0.96276593,"top":0.07581804,"width":0.009640957,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.9740692,"top":0.074221864,"width":0.00731383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.98138297,"top":0.074221864,"width":0.006981383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {\n\"headers\":{\n\"Date\":[\"Thu,07 May 2026 14:21:15 GMT\"],\n \"Content-Type\":[\"application/json;charset=utf-8\"],\n \"Transfer-Encoding\":[\"chunked\"],\n \"Connection\":[\"keep-alive\"],\n \"CF-Ray\":[\"9f80deb8db60dc3a-SOF\"],\n \"CF-Cache-Status\":[\"DYNAMIC\"],\n \"Strict-Transport-Security\":[\"max-age=31536000; includeSubDomains; preload\"],\n \"Vary\":[\"origin,\n accept-encoding\"],\n \"access-control-allow-credentials\":[\"false\"],\n \"server-timing\":[\"hcid;desc=\\\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\\\",\n cfr;desc=\\\"9f80deb8e7c6dc3a-IAD\\\"\"],\n \"x-content-type-options\":[\"nosniff\"],\n \"x-hubspot-correlation-id\":[\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\"],\n \"Set-Cookie\":[\"__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-1.0.1.1-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,\n 07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None\"],\n \"Report-To\":[\"{\n\\\"endpoints\\\":[{\n\\\"url\\\":\\\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report\\\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\\\"}],\n\\\"group\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"NEL\":[\"{\n\\\"success_fraction\\\":0.01,\n\\\"report_to\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"Server\":[\"cloudflare\"]}} {\n\"correlation_id\":\"95236535-ec98-4541-b92a-adfa73b69eab\",\n\"trace_id\":\"c7ab8365-903f-46d4-9403-0e5b551e3545\"}","depth":4,"bounds":{"left":0.5724734,"top":0.0726257,"width":0.4275266,"height":0.9066241},"on_screen":true,"value":"[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {\n\"headers\":{\n\"Date\":[\"Thu,07 May 2026 14:21:15 GMT\"],\n \"Content-Type\":[\"application/json;charset=utf-8\"],\n \"Transfer-Encoding\":[\"chunked\"],\n \"Connection\":[\"keep-alive\"],\n \"CF-Ray\":[\"9f80deb8db60dc3a-SOF\"],\n \"CF-Cache-Status\":[\"DYNAMIC\"],\n \"Strict-Transport-Security\":[\"max-age=31536000; includeSubDomains; preload\"],\n \"Vary\":[\"origin,\n accept-encoding\"],\n \"access-control-allow-credentials\":[\"false\"],\n \"server-timing\":[\"hcid;desc=\\\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\\\",\n cfr;desc=\\\"9f80deb8e7c6dc3a-IAD\\\"\"],\n \"x-content-type-options\":[\"nosniff\"],\n \"x-hubspot-correlation-id\":[\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\"],\n \"Set-Cookie\":[\"__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-1.0.1.1-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,\n 07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None\"],\n \"Report-To\":[\"{\n\\\"endpoints\\\":[{\n\\\"url\\\":\\\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report\\\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\\\"}],\n\\\"group\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"NEL\":[\"{\n\\\"success_fraction\\\":0.01,\n\\\"report_to\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"Server\":[\"cloudflare\"]}} {\n\"correlation_id\":\"95236535-ec98-4541-b92a-adfa73b69eab\",\n\"trace_id\":\"c7ab8365-903f-46d4-9403-0e5b551e3545\"}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8016712486324069616
|
4446428687123393012
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
ClientTest
Rerun 'PHPUnit: ClientTest'
Debug 'ClientTest'
Stop 'ClientTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
19
144
11
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Tests\Unit\Services\Crm\Hubspot;
use GuzzleHttp\Psr7\Response;
use HubSpot\Client\Crm\Associations\Api\BatchApi;
use HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId;
use HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti;
use HubSpot\Client\Crm\Associations\Model\PublicObjectId;
use HubSpot\Client\Crm\Companies\ApiException as CompanyApiException;
use HubSpot\Client\Crm\Contacts\ApiException as ContactApiException;
use HubSpot\Client\Crm\Deals\Api\BasicApi as DealsBasicApi;
use HubSpot\Client\Crm\Deals\ApiException as DealApiException;
use HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations as DealWithAssociations;
use HubSpot\Client\Crm\Pipelines\Api\PipelinesApi;
use HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipeline;
use HubSpot\Client\Crm\Pipelines\Model\Error;
use HubSpot\Client\Crm\Pipelines\Model\Pipeline;
use HubSpot\Client\Crm\Pipelines\Model\PipelineStage;
use HubSpot\Client\Crm\Properties\Api\CoreApi;
use HubSpot\Client\Crm\Properties\Model\Property;
use HubSpot\Discovery as HubSpotDiscovery;
use HubSpot\Discovery\Crm\Deals\Discovery as DealsDiscovery;
use Jiminny\Exceptions\RateLimitException;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\SocialAccount;
use Jiminny\Services\Crm\Hubspot\Client;
use Jiminny\Services\Crm\Hubspot\HubspotTokenManager;
use Jiminny\Services\Crm\Hubspot\Pagination\HubspotPaginationService;
use Jiminny\Services\SocialAccountService;
use League\OAuth2\Client\Token\AccessToken;
use Mockery;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
use SevenShores\Hubspot\Endpoints\Engagements;
use SevenShores\Hubspot\Exceptions\BadRequest;
use SevenShores\Hubspot\Factory;
use SevenShores\Hubspot\Http\Client as HubspotClient;
use SevenShores\Hubspot\Http\Response as HubspotResponse;
/**
* @runTestsInSeparateProcesses
*
* @preserveGlobalState disabled
*/
class ClientTest extends TestCase
{
private const string RESPONSE_TYPE_STAGE_FIELD = 'stage';
private const string RESPONSE_TYPE_PIPELINE_FIELD = 'pipeline';
private const string RESPONSE_TYPE_REGULAR_FIELD = 'regular';
/**
* @var Client&MockObject
*/
private Client $client;
private Configuration $config;
/**
* @var SocialAccountService&MockObject
*/
private SocialAccountService $socialAccountServiceMock;
/**
* @var HubspotPaginationService&MockObject
*/
private HubspotPaginationService $paginationServiceMock;
/**
* @var HubspotTokenManager&MockObject
*/
private HubspotTokenManager $tokenManagerMock;
/**
* @var CoreApi&MockObject
*/
private CoreApi $coreApiMock;
/**
* @var PipelinesApi&MockObject
*/
private PipelinesApi $pipelinesApiMock;
/**
* @var BatchApi&MockObject
*/
private BatchApi $associationsBatchApiMock;
/**
* @var DealsBasicApi&MockObject
*/
private DealsBasicApi $dealsBasicApiMock;
/**
* @var Engagements&MockObject
*/
private $engagementsMock;
/**
* @var HubspotClient&MockObject
*/
private HubspotClient $hubspotClientMock;
protected function setUp(): void
{
// Create mocks for dependencies
$this->socialAccountServiceMock = $this->createMock(SocialAccountService::class);
$this->paginationServiceMock = $this->createMock(HubspotPaginationService::class);
$this->tokenManagerMock = $this->createMock(HubspotTokenManager::class);
// Create a real Client instance with mocked dependencies
// Create a partial mock only for the methods we need to mock
$client = $this->createPartialMock(Client::class, ['getInstance', 'getNewInstance', 'makeRequest']);
$client->setLogger(new NullLogger());
// Inject the real dependencies using reflection
$reflection = new \ReflectionClass(Client::class);
$accountServiceProperty = $reflection->getProperty('accountService');
$accountServiceProperty->setAccessible(true);
$accountServiceProperty->setValue($client, $this->socialAccountServiceMock);
$paginationServiceProperty = $reflection->getProperty('paginationService');
$paginationServiceProperty->setAccessible(true);
$paginationServiceProperty->setValue($client, $this->paginationServiceMock);
$tokenManagerProperty = $reflection->getProperty('tokenManager');
$tokenManagerProperty->setAccessible(true);
$tokenManagerProperty->setValue($client, $this->tokenManagerMock);
$factoryMock = $this->createMock(Factory::class);
$hubspotClientMock = $this->createMock(HubspotClient::class);
$engagementsMock = $this->createMock(\SevenShores\Hubspot\Endpoints\Engagements::class);
$factoryMock->method('getClient')->willReturn($hubspotClientMock);
$factoryMock->method('__call')->with('engagements')->willReturn($engagementsMock);
$client->method('getInstance')->willReturn($factoryMock);
$discoveryMock = $this->createMock(HubSpotDiscovery\Discovery::class);
$crmMock = $this->createMock(HubSpotDiscovery\Crm\Discovery::class);
$associationsMock = $this->createMock(HubSpotDiscovery\Crm\Associations\Discovery::class);
$propertiesMock = $this->createMock(HubSpotDiscovery\Crm\Properties\Discovery::class);
$pipelinesMock = $this->createMock(HubSpotDiscovery\Crm\Pipelines\Discovery::class);
$coreApiMock = $this->createMock(CoreApi::class);
$pipelinesApiMock = $this->createMock(PipelinesApi::class);
$associationsBatchApiMock = $this->createMock(BatchApi::class);
$dealsBasicApiMock = $this->createMock(DealsBasicApi::class);
$propertiesMock->method('__call')->with('coreApi')->willReturn($coreApiMock);
$pipelinesMock->method('__call')->with('pipelinesApi')->willReturn($pipelinesApiMock);
$associationsMock->method('__call')->with('batchApi')->willReturn($associationsBatchApiMock);
$dealsDiscoveryMock = $this->createMock(DealsDiscovery::class);
$dealsDiscoveryMock->method('__call')->with('basicApi')->willReturn($dealsBasicApiMock);
$returnMap = ['properties' => $propertiesMock, 'pipelines' => $pipelinesMock, 'associations' => $associationsMock, 'deals' => $dealsDiscoveryMock];
$crmMock->method('__call')
->willReturnCallback(static fn (string $name) => $returnMap[$name])
;
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client->method('getNewInstance')->willReturn($discoveryMock);
$this->client = $client;
$this->config = $this->createMock(Configuration::class);
$this->client->setConfiguration($this->config);
$this->coreApiMock = $coreApiMock;
$this->pipelinesApiMock = $pipelinesApiMock;
$this->associationsBatchApiMock = $associationsBatchApiMock;
$this->dealsBasicApiMock = $dealsBasicApiMock;
$this->engagementsMock = $engagementsMock;
$this->hubspotClientMock = $hubspotClientMock;
}
public function testGetMinimumApiVersion(): void
{
$this->assertIsString($this->client->getMinimumApiVersion());
}
public function testGetInstance(): void
{
$socialAccountService = $this->createMock(SocialAccountService::class);
$paginationService = $this->createMock(HubspotPaginationService::class);
$tokenManager = $this->createMock(HubspotTokenManager::class);
$client = new Client($socialAccountService, $paginationService, $tokenManager);
$client->setBaseUrl('[URL_WITH_CREDENTIALS] The class CollectionResponsePipeline will be deprecated in the next Hubspot version
*/
$this->pipelinesApiMock
->method('getAll')
->with('deals')
->willReturn(new CollectionResponsePipeline([
'results' => [$this->generatePipeline()],
]))
;
$this->assertEquals(
[
['id' => 'foo', 'label' => 'bar'],
['id' => 'baz', 'label' => 'qux'],
],
$this->client->fetchOpportunityPipelineStages()
);
}
public function testFetchOpportunityPipelineStagesErrorResponse(): void
{
$this->pipelinesApiMock
->method('getAll')
->with('deals')
->willReturn(new Error(['message' => 'test error']))
;
$this->assertEmpty($this->client->fetchOpportunityPipelineStages());
}
#[\PHPUnit\Framework\Attributes\DataProvider('meetingOutcomeFieldProvider')]
public function testFetchMeetingOutcomeFieldOptions(string $fieldId, string $expectedEndpoint): void
{
$field = new Field(['crm_provider_id' => $fieldId]);
$this->hubspotClientMock
->expects($this->once())
->method('request')
->with('GET', $expectedEndpoint)
->willReturn($this->generateHubSpotResponse(
[
'options' => [
['value' => 'option_1', 'label' => 'Option 1', 'displayOrder' => 0],
['value' => 'option_2', 'label' => 'Option 2', 'displayOrder' => 1],
['value' => 'option_3', 'label' => 'Option 3', 'displayOrder' => 2],
],
]
))
;
$this->assertEquals(
[
['id' => 'option_1', 'value' => 'option_1', 'label' => 'Option 1', 'display_order' => 0],
['id' => 'option_2', 'value' => 'option_2', 'label' => 'Option 2', 'display_order' => 1],
['id' => 'option_3', 'value' => 'option_3', 'label' => 'Option 3', 'display_order' => 2],
],
$this->client->fetchMeetingOutcomeFieldOptions($field)
);
}
public static function meetingOutcomeFieldProvider(): array
{
return [
'meeting outcome field' => [
'meetingOutcome',
'[URL_WITH_CREDENTIALS] The class CollectionResponsePipeline will be deprecated in the next Hubspot version
*/
$pipelineStagesResponse = new CollectionResponsePipeline([
'results' => [$this->generatePipeline()],
]);
$this->pipelinesApiMock
->method('getAll')
->willReturn($pipelineStagesResponse);
}
if ($type === self::RESPONSE_TYPE_PIPELINE_FIELD) {
$field->method('isStageField')->willReturn(false);
$field->method('isPipelineField')->willReturn(true);
$pipelineResponse = $this->generateHubSpotResponse([
'results' => [
['id' => '123', 'label' => 'Sales'],
['id' => 'default', 'label' => 'CS'],
],
]);
$this->client
->method('makeRequest')
->with('/crm/v3/pipelines/deals')
->willReturn($pipelineResponse);
}
$this->assertEquals(
$responses[$type],
$this->client->fetchOpportunityFieldOptions($field)
);
}
public static function opportunityFieldOptionsProvider(): array
{
return [
'stage field' => [
'field' => new Field(['crm_provider_id' => 'dealstage']),
'type' => self::RESPONSE_TYPE_STAGE_FIELD,
],
'pipeline field' => [
'field' => new Field(['crm_provider_id' => 'pipeline']),
'type' => self::RESPONSE_TYPE_PIPELINE_FIELD,
],
'regular field' => [
'field' => new Field(['crm_provider_id' => 'some_property']),
'type' => self::RESPONSE_TYPE_REGULAR_FIELD,
],
];
}
private function generateHubSpotResponse(array $data): HubspotResponse
{
return new HubspotResponse(new Response(200, [], json_encode($data)));
}
private function generateProperty(): Property
{
return new Property([
'name' => 'some_property',
'options' => [
[
'label' => 'label_1',
'value' => 'value_1',
],
[
'label' => 'label_2',
'value' => 'value_2',
],
],
]);
}
private function generatePipeline(): Pipeline
{
return new Pipeline(['stages' => [
new PipelineStage(['id' => 'foo', 'label' => 'bar']),
new PipelineStage(['id' => 'baz', 'label' => 'qux']),
]]);
}
public function testFetchOpportunityPipelines(): void
{
$this->client
->method('makeRequest')
->with('/crm/v3/pipelines/deals')
->willReturn($this->generateHubSpotResponse([
'results' => [
['id' => 'id_1', 'label' => 'Option 1', 'displayOrder' => 0],
['id' => 'id_2', 'label' => 'Option 2', 'displayOrder' => 1],
['id' => 'id_3', 'label' => 'Option 3', 'displayOrder' => 2],
],
]));
$this->assertEquals(
[
['id' => 'id_1', 'label' => 'Option 1'],
['id' => 'id_2', 'label' => 'Option 2'],
['id' => 'id_3', 'label' => 'Option 3'],
],
$this->client->fetchOpportunityPipelines()
);
}
public function testGetPaginatedData(): void
{
$expectedResults = [
['id' => 'id_1', 'properties' => []],
['id' => 'id_2', 'properties' => []],
['id' => 'id_3', 'properties' => []],
];
// Mock the pagination service to return a generator and modify reference parameters
$this->paginationServiceMock
->expects($this->once())
->method('getPaginatedDataGenerator')
->with(
$this->client,
['payload_key' => 'payload_value'],
'foobar',
0,
$this->anything(),
$this->anything()
)
->willReturnCallback(function ($client, $payload, $type, $offset, &$total, &$lastRecordId) use ($expectedResults) {
$total = 3;
$lastRecordId = 'id_3';
foreach ($expectedResults as $result) {
yield $result;
}
});
$this->assertEquals(
[
'results' => $expectedResults,
'total' => 3,
'last_record' => 'id_3',
],
$this->client->getPaginatedData(['payload_key' => 'payload_value'], 'foobar')
);
}
public function testGetAssociationsData(): void
{
$ids = ['1', '2', '3'];
$fromObject = 'deals';
$toObject = 'contacts';
$responseResults = [];
foreach ($ids as $id) {
$from = new PublicObjectId();
$from->setId($id);
$to1 = new PublicObjectId();
$to1->setId('contact_' . $id . '_1');
$to2 = new PublicObjectId();
$to2->setId('contact_' . $id . '_2');
$result = new \HubSpot\Client\Crm\Associations\Model\PublicAssociationMulti();
$result->setFrom($from);
$result->setTo([$to1, $to2]);
$responseResults[] = $result;
}
$batchResponse = new BatchResponsePublicAssociationMulti();
$batchResponse->setResults($responseResults);
$this->associationsBatchApiMock->expects($this->once())
->method('read')
->with(
$this->equalTo($fromObject),
$this->equalTo($toObject),
$this->callback(function (BatchInputPublicObjectId $batchInput) use ($ids) {
$inputIds = array_map(
fn ($input) => $input->getId(),
$batchInput->getInputs()
);
return $inputIds === $ids;
})
)
->willReturn($batchResponse);
$result = $this->client->getAssociationsData($ids, $fromObject, $toObject);
$expectedResult = [
'1' => ['contact_1_1', 'contact_1_2'],
'2' => ['contact_2_1', 'contact_2_2'],
'3' => ['contact_3_1', 'contact_3_2'],
];
$this->assertEquals($expectedResult, $result);
}
public function testGetAssociationsDataHandlesException(): void
{
$ids = ['1', '2', '3'];
$fromObject = 'deals';
$toObject = 'contacts';
$exception = new \Exception('API Error');
$this->associationsBatchApiMock->expects($this->once())
->method('read')
->with(
$this->equalTo($fromObject),
$this->equalTo($toObject),
$this->callback(function ($batchInput) use ($ids) {
return $batchInput instanceof \HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId
&& count($batchInput->getInputs()) === count($ids);
})
)
->willThrowException($exception);
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with(
'[Hubspot] Failed to fetch associations',
[
'from_object' => $fromObject,
'to_object' => $toObject,
'reason' => 'API Error',
]
);
$this->client->setLogger($loggerMock);
$result = $this->client->getAssociationsData($ids, $fromObject, $toObject);
$this->assertEmpty($result);
$this->assertIsArray($result);
}
public function testGetAssociationsDataWithLargeDataSet(): void
{
$ids = array_map(fn ($i) => (string) $i, range(1, 2500)); // More than 1000 items
$fromObject = 'deals';
$toObject = 'contacts';
$firstBatchResponse = new BatchResponsePublicAssociationMulti();
$firstBatchResults = array_map(function ($id) {
$from = new PublicObjectId();
$from->setId($id);
$to = new PublicObjectId();
$to->setId('contact_' . $id);
$result = new \HubSpot\Client\Crm\Associations\Model\PublicAssociationMulti();
$result->setFrom($from);
$result->setTo([$to]);
return $result;
}, array_slice($ids, 0, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));
$firstBatchResponse->setResults($firstBatchResults);
$secondBatchResponse = new BatchResponsePublicAssociationMulti();
$secondBatchResults = array_map(function ($id) {
$from = new PublicObjectId();
$from->setId($id);
$to = new PublicObjectId();
$to->setId('contact_' . $id);
$result = new \HubSpot\Client\Crm\Associations\Model\PublicAssociationMulti();
$result->setFrom($from);
$result->setTo([$to]);
return $result;
}, array_slice($ids, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));
$secondBatchResponse->setResults($secondBatchResults);
$this->associationsBatchApiMock->expects($this->exactly(3))
->method('read')
->willReturnOnConsecutiveCalls($firstBatchResponse, $secondBatchResponse);
$result = $this->client->getAssociationsData($ids, $fromObject, $toObject);
$this->assertCount(2500, $result);
$this->assertArrayHasKey('1', $result);
$this->assertArrayHasKey('2500', $result);
$this->assertEquals(['contact_1'], $result['1']);
$this->assertEquals(['contact_2500'], $result['2500']);
}
public function testGetContactByEmailSuccess(): void
{
$email = '[EMAIL]';
$fields = ['firstname', 'lastname', 'email'];
$contactMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations::class);
$contactMock->method('getId')->willReturn('12345');
$contactMock->method('getProperties')->willReturn([
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[EMAIL]',
]);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($email, 'firstname,lastname,email', null, false, 'email')
->willReturn($contactMock);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new NullLogger());
$result = $client->getContactByEmail($email, $fields);
$this->assertEquals([
'id' => '12345',
'properties' => [
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[EMAIL]',
],
], $result);
}
public function testGetContactByEmailWithEmptyFields(): void
{
$email = '[EMAIL]';
$fields = [];
$contactMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations::class);
$contactMock->method('getId')->willReturn('12345');
$contactMock->method('getProperties')->willReturn(['email' => '[EMAIL]']);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($email, '', null, false, 'email')
->willReturn($contactMock);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new NullLogger());
$result = $client->getContactByEmail($email, $fields);
$this->assertEquals([
'id' => '12345',
'properties' => ['email' => '[EMAIL]'],
], $result);
}
public function testGetContactByEmailApiException(): void
{
$email = '[EMAIL]';
$fields = ['firstname', 'lastname'];
$exception = new \HubSpot\Client\Crm\Contacts\ApiException('Contact not found', 404);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($email, 'firstname,lastname', null, false, 'email')
->willThrowException($exception);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('info')
->with(
'[Hubspot] Failed to fetch contact',
[
'email' => $email,
'reason' => 'Contact not found',
]
);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger($loggerMock);
$result = $client->getContactByEmail($email, $fields);
$this->assertEquals([], $result);
}
public function testGetOpportunityById(): void
{
$opportunityId = '12345';
$expectedProperties = [
'dealname' => 'Test Opportunity',
'amount' => '1000.00',
'closedate' => '2024-12-31T23:59:59.999Z',
'dealstage' => 'presentationscheduled',
'pipeline' => 'default',
];
$mockHubspotOpportunity = $this->createMock(DealWithAssociations::class);
$mockHubspotOpportunity->method('getProperties')->willReturn((object) $expectedProperties);
$mockHubspotOpportunity->method('getId')->willReturn($opportunityId);
$now = new \DateTimeImmutable();
$mockHubspotOpportunity->method('getCreatedAt')->willReturn($now);
$mockHubspotOpportunity->method('getUpdatedAt')->willReturn($now);
$mockHubspotOpportunity->method('getArchived')->willReturn(false);
$this->dealsBasicApiMock
->expects($this->once())
->method('getById')
->willReturn($mockHubspotOpportunity);
// Assuming Client::getOpportunityById processes the SimplePublicObject and returns an associative array.
// The structure might be like: ['id' => ..., 'properties' => [...], 'createdAt' => ..., ...]
// Adjust assertions below based on the actual return structure of your method.
$result = $this->client->getOpportunityById($opportunityId, ['test', 'test']);
$this->assertIsArray($result);
$this->assertArrayHasKey('id', $result);
$this->assertEquals($opportunityId, $result['id']);
}
public function testGetContactById(): void
{
$crmId = 'contact-123';
$fields = ['firstname', 'lastname'];
$expectedProperties = ['firstname' => 'John', 'lastname' => 'Doe'];
$mockContact = $this->createMock(\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations::class);
$mockContact->method('getId')->willReturn($crmId);
$mockContact->method('getProperties')->willReturn((object) $expectedProperties);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($crmId, 'firstname,lastname')
->willReturn($mockContact);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new \Psr\Log\NullLogger());
$result = $client->getContactById($crmId, $fields);
$this->assertIsArray($result);
$this->assertArrayHasKey('id', $result);
$this->assertArrayHasKey('properties', $result);
$this->assertEquals($crmId, $result['id']);
$this->assertEquals((object) $expectedProperties, $result['properties']);
}
public function testGetAccountById(): void
{
$crmId = 'account-123';
$fields = ['name', 'industry'];
$expectedProperties = ['name' => 'Acme Corp', 'industry' => 'Technology'];
$mockCompany = $this->createMock(\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations::class);
$mockCompany->method('getId')->willReturn($crmId);
$mockCompany->method('getProperties')->willReturn((object) $expectedProperties);
$companiesApiMock = $this->createMock(\HubSpot\Client\Crm\Companies\Api\BasicApi::class);
$companiesApiMock->expects($this->once())
->method('getById')
->with($crmId, 'name,industry')
->willReturn($mockCompany);
$companiesDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Companies\Discovery::class);
$companiesDiscoveryMock->method('__call')->with('basicApi')->willReturn($companiesApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($companiesDiscoveryMock) {
if ($name === 'companies') {
return $companiesDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new \Psr\Log\NullLogger());
$result = $client->getAccountById($crmId, $fields);
$this->assertIsArray($result);
$this->assertArrayHasKey('id', $result);
$this->assertArrayHasKey('properties', $result);
$this->assertEquals($crmId, $result['id']);
$this->assertEquals((object) $expectedProperties, $result['properties']);
}
public function testEnsureValidTokenWithNoTokenUpdate(): void
{
$socialAccountMock = $this->createMock(SocialAccount::class);
// Set up OAuth account
$reflection = new \ReflectionClass($this->client);
$oauthAccountProperty = $reflection->getProperty('oauthAccount');
$oauthAccountProperty->setAccessible(true);
$oauthAccountProperty->setValue($this->client, $socialAccountMock);
$originalToken = 'original_token';
$accessTokenProperty = $reflection->getProperty('accessToken');
$accessTokenProperty->setAccessible(true);
$accessTokenProperty->setValue($this->client, $originalToken);
// Mock token manager to return null (no refresh needed)
$this->tokenManagerMock
->expects($this->once())
->method('ensureValidToken')
->with($socialAccountMock)
->willReturn(null);
// Call ensureValidToken
$this->client->ensureValidToken();
// Verify access token was not changed
$this->assertEquals($originalToken, $accessTokenProperty->getValue($this->client));
}
public function testGetPaginatedDataGeneratorDelegatesToPaginationService(): void
{
$payload = ['filters' => []];
$type = 'contacts';
$offset = 0;
$total = 0;
$lastRecordId = null;
$expectedResults = [
['id' => 'id_1', 'properties' => []],
['id' => 'id_2', 'properties' => []],
];
// Mock the pagination service to return a generator
$this->paginationServiceMock
->expects($this->once())
->method('getPaginatedDataGenerator')
->with(
$this->client,
$payload,
$type,
$offset,
$this->anything(),
$this->anything()
)
->willReturnCallback(function () use ($expectedResults) {
foreach ($expectedResults as $result) {
yield $result;
}
});
// Execute the pagination
$results = [];
foreach ($this->client->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastRecordId) as $result) {
$results[] = $result;
}
$this->assertCount(2, $results);
$this->assertEquals('id_1', $results[0]['id']);
$this->assertEquals('id_2', $results[1]['id']);
}
public function testEnsureValidTokenDelegatesToTokenManager(): void
{
$socialAccountMock = $this->createMock(SocialAccount::class);
// Set up OAuth account
$reflection = new \ReflectionClass($this->client);
$oauthAccountProperty = $reflection->getProperty('oauthAccount');
$oauthAccountProperty->setAccessible(true);
$oauthAccountProperty->setValue($this->client, $socialAccountMock);
// Mock token manager to return new token
$this->tokenManagerMock
->expects($this->once())
->method('ensureValidToken')
->with($socialAccountMock)
->willReturn('new_access_token');
// Call ensureValidToken
$this->client->ensureValidToken();
// Verify access token was updated
$accessTokenProperty = $reflection->getProperty('accessToken');
$accessTokenProperty->setAccessible(true);
$this->assertEquals('new_access_token', $accessTokenProperty->getValue($this->client));
}
public function testGetOwnersArchivedWithValidResponse(): void
{
$responseData = [
'results' => [
[
'id' => '123',
'email' => '[EMAIL]',
'type' => 'PERSON',
'firstName' => 'John',
'lastName' => 'Doe',
'userId' => 456,
'userIdIncludingInactive' => 789,
'createdAt' => '2023-01-01T12:00:00Z',
'updatedAt' => '2023-01-02T12:00:00Z',
'archived' => true,
],
],
];
// Create a mock response object
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willReturn($responseData);
// Set up the client to return our test data
$this->client->method('makeRequest')
->with(
'/crm/v3/owners',
'GET',
[],
'archived=true'
)
->willReturn($response);
// Call the method
$result = $this->client->getOwnersArchived(true);
// Assert the results
$this->assertCount(1, $result);
$this->assertEquals('123', $result[0]->getId());
$this->assertEquals('[EMAIL]', $result[0]->getEmail());
$this->assertEquals('John Doe', $result[0]->getFullName());
$this->assertTrue($result[0]->isArchived());
}
public function testGetOwnersArchivedWithEmptyResponse(): void
{
// Create a mock response object with empty results
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willReturn(['results' => []]);
// Set up the client to return empty results
$this->client->method('makeRequest')
->with(
'/crm/v3/owners',
'GET',
[],
'archived=false'
)
->willReturn($response);
// Call the method
$result = $this->client->getOwnersArchived(false);
// Assert the results
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testGetOwnersArchivedWithInvalidResponse(): void
{
// Create a mock response that will throw an exception when toArray is called
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willThrowException(new \InvalidArgumentException('Invalid JSON'));
// Set up the client to return the problematic response
$this->client->method('makeRequest')
->willReturn($response);
// Mock the logger to expect an error message
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with($this->stringContains('Failed to fetch owners'));
$reflection = new \ReflectionClass($this->client);
$loggerProperty = $reflection->getProperty('log');
$loggerProperty->setAccessible(true);
$loggerProperty->setValue($this->client, $loggerMock);
// Call the method and expect an empty array on error
$result = $this->client->getOwnersArchived(true);
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testGetOwnersArchivedWithHttpError(): void
{
// Set up the client to throw an exception
$this->client->method('makeRequest')
->willThrowException(new \Exception('HTTP Error'));
// Mock the logger to expect an error message
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with($this->stringContains('Failed to fetch owners'));
$reflection = new \ReflectionClass($this->client);
$loggerProperty = $reflection->getProperty('log');
$loggerProperty->setAccessible(true);
$loggerProperty->setValue($this->client, $loggerMock);
// Call the method and expect an empty array on error
$result = $this->client->getOwnersArchived(false);
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testGetOwnersArchivedWithOwnerCreationException(): void
{
$responseData = [
'results' => [
[
'id' => '123',
'email' => '[EMAIL]',
'type' => 'PERSON',
'firstName' => 'John',
'lastName' => 'Doe',
'userId' => 456,
'userIdIncludingInactive' => 789,
'createdAt' => '2023-01-01T12:00:00Z',
'updatedAt' => '2023-01-02T12:00:00Z',
'archived' => false,
],
[
'id' => '456',
'email' => '[EMAIL]',
'type' => 'PERSON',
'createdAt' => 'invalid-date-format',
],
[
'id' => '789',
'email' => '[EMAIL]',
'type' => 'PERSON',
'firstName' => 'Jane',
'lastName' => 'Smith',
'userId' => 999,
'userIdIncludingInactive' => 888,
'createdAt' => '2023-01-03T12:00:00Z',
'updatedAt' => '2023-01-04T12:00:00Z',
'archived' => false,
],
],
];
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willReturn($responseData);
$this->client->method('makeRequest')
->with(
'/crm/v3/owners',
'GET',
[],
'archived=false'
)
->willReturn($response);
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with(
'[HubSpot] Failed to process owner data',
$this->callback(function ($context) {
return isset($context['result']) &&
isset($context['error']) &&
$context['result']['id'] === '456' &&
$context['result']['email'] === '[EMAIL]' &&
str_contains($context['error'], 'invalid-date-format');
})
);
$reflection = new \ReflectionClass($this->client);
$loggerProperty = $reflection->getProperty('log');
$loggerProperty->setAccessible(true);
$loggerProperty->setValue($this->client, $loggerMock);
$result = $this->client->getOwnersArchived(false);
$this->assertIsArray($result);
$this->assertCount(2, $result);
$this->assertEquals('123', $result[0]->getId());
$this->assertEquals('[EMAIL]', $result[0]->getEmail());
$this->assertEquals('789', $result[1]->getId());
$this->assertEquals('[EMAIL]', $result[1]->getEmail());
}
public function testMakeRequestWithGetMethod(): void
{
$socialAccountService = $this->createMock(SocialAccountService::class);
$paginationService = $this->createMock(HubspotPaginationService::class);
$tokenManager = $this->createMock(HubspotTokenManager::class);
$psrResponse = new Response(200, [], json_encode(['status' => 'success']));
$expectedResponse = new HubspotResponse($psrResponse);
$hubspotClientMock = $this->createMock(HubspotClient::class);
$hubspotClientMock->expects($this->once())
->method('request')
->with(
'GET',
'https://api.hubapi.com/crm/v3/objects/contacts',
[],
null,
true
)
->willReturn($expectedResponse);
$factoryMock = $this->createMock(Factory::class);
$factoryMock->method('getClient')->willReturn($hubspotClientMock);
$client = $this->getMockBuilder(Client::class)
->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])
->onlyMethods(['getInstance'])
->getMock();
$client->method('getInstance')->willReturn($factoryMock);
$client->setAccessToken(new AccessToken(['access_token' => 'test_token']));
$result = $client->makeRequest('/crm/v3/objects/contacts', 'GET');
$this->assertSame($expectedResponse, $result);
}
public function testMakeRequestWithGetMethodAndQueryString(): void
{
$socialAccountService = $this->createMock(SocialAccountService::class);
$paginationService = $this->createMock(HubspotPaginationService...
|
20389
|
NULL
|
NULL
|
NULL
|
|
20393
|
880
|
13
|
2026-05-11T15:22:06.176931+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778512926176_m1.jpg...
|
PhpStorm
|
faVsco.js – ClientTest.php
|
True
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
ClientTest
Rerun 'PHPUnit: ClientTest'
Debug 'ClientTest'
Stop 'ClientTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
19
144
11
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Tests\Unit\Services\Crm\Hubspot;
use GuzzleHttp\Psr7\Response;
use HubSpot\Client\Crm\Associations\Api\BatchApi;
use HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId;
use HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti;
use HubSpot\Client\Crm\Associations\Model\PublicObjectId;
use HubSpot\Client\Crm\Companies\ApiException as CompanyApiException;
use HubSpot\Client\Crm\Contacts\ApiException as ContactApiException;
use HubSpot\Client\Crm\Deals\Api\BasicApi as DealsBasicApi;
use HubSpot\Client\Crm\Deals\ApiException as DealApiException;
use HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations as DealWithAssociations;
use HubSpot\Client\Crm\Pipelines\Api\PipelinesApi;
use HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipeline;
use HubSpot\Client\Crm\Pipelines\Model\Error;
use HubSpot\Client\Crm\Pipelines\Model\Pipeline;
use HubSpot\Client\Crm\Pipelines\Model\PipelineStage;
use HubSpot\Client\Crm\Properties\Api\CoreApi;
use HubSpot\Client\Crm\Properties\Model\Property;
use HubSpot\Discovery as HubSpotDiscovery;
use HubSpot\Discovery\Crm\Deals\Discovery as DealsDiscovery;
use Jiminny\Exceptions\RateLimitException;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\SocialAccount;
use Jiminny\Services\Crm\Hubspot\Client;
use Jiminny\Services\Crm\Hubspot\HubspotTokenManager;
use Jiminny\Services\Crm\Hubspot\Pagination\HubspotPaginationService;
use Jiminny\Services\SocialAccountService;
use League\OAuth2\Client\Token\AccessToken;
use Mockery;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
use SevenShores\Hubspot\Endpoints\Engagements;
use SevenShores\Hubspot\Exceptions\BadRequest;
use SevenShores\Hubspot\Factory;
use SevenShores\Hubspot\Http\Client as HubspotClient;
use SevenShores\Hubspot\Http\Response as HubspotResponse;
/**
* @runTestsInSeparateProcesses
*
* @preserveGlobalState disabled
*/
class ClientTest extends TestCase
{
private const string RESPONSE_TYPE_STAGE_FIELD = 'stage';
private const string RESPONSE_TYPE_PIPELINE_FIELD = 'pipeline';
private const string RESPONSE_TYPE_REGULAR_FIELD = 'regular';
/**
* @var Client&MockObject
*/
private Client $client;
private Configuration $config;
/**
* @var SocialAccountService&MockObject
*/
private SocialAccountService $socialAccountServiceMock;
/**
* @var HubspotPaginationService&MockObject
*/
private HubspotPaginationService $paginationServiceMock;
/**
* @var HubspotTokenManager&MockObject
*/
private HubspotTokenManager $tokenManagerMock;
/**
* @var CoreApi&MockObject
*/
private CoreApi $coreApiMock;
/**
* @var PipelinesApi&MockObject
*/
private PipelinesApi $pipelinesApiMock;
/**
* @var BatchApi&MockObject
*/
private BatchApi $associationsBatchApiMock;
/**
* @var DealsBasicApi&MockObject
*/
private DealsBasicApi $dealsBasicApiMock;
/**
* @var Engagements&MockObject
*/
private $engagementsMock;
/**
* @var HubspotClient&MockObject
*/
private HubspotClient $hubspotClientMock;
protected function setUp(): void
{
// Create mocks for dependencies
$this->socialAccountServiceMock = $this->createMock(SocialAccountService::class);
$this->paginationServiceMock = $this->createMock(HubspotPaginationService::class);
$this->tokenManagerMock = $this->createMock(HubspotTokenManager::class);
// Create a real Client instance with mocked dependencies
// Create a partial mock only for the methods we need to mock
$client = $this->createPartialMock(Client::class, ['getInstance', 'getNewInstance', 'makeRequest']);
$client->setLogger(new NullLogger());
// Inject the real dependencies using reflection
$reflection = new \ReflectionClass(Client::class);
$accountServiceProperty = $reflection->getProperty('accountService');
$accountServiceProperty->setAccessible(true);
$accountServiceProperty->setValue($client, $this->socialAccountServiceMock);
$paginationServiceProperty = $reflection->getProperty('paginationService');
$paginationServiceProperty->setAccessible(true);
$paginationServiceProperty->setValue($client, $this->paginationServiceMock);
$tokenManagerProperty = $reflection->getProperty('tokenManager');
$tokenManagerProperty->setAccessible(true);
$tokenManagerProperty->setValue($client, $this->tokenManagerMock);
$factoryMock = $this->createMock(Factory::class);
$hubspotClientMock = $this->createMock(HubspotClient::class);
$engagementsMock = $this->createMock(\SevenShores\Hubspot\Endpoints\Engagements::class);
$factoryMock->method('getClient')->willReturn($hubspotClientMock);
$factoryMock->method('__call')->with('engagements')->willReturn($engagementsMock);
$client->method('getInstance')->willReturn($factoryMock);
$discoveryMock = $this->createMock(HubSpotDiscovery\Discovery::class);
$crmMock = $this->createMock(HubSpotDiscovery\Crm\Discovery::class);
$associationsMock = $this->createMock(HubSpotDiscovery\Crm\Associations\Discovery::class);
$propertiesMock = $this->createMock(HubSpotDiscovery\Crm\Properties\Discovery::class);
$pipelinesMock = $this->createMock(HubSpotDiscovery\Crm\Pipelines\Discovery::class);
$coreApiMock = $this->createMock(CoreApi::class);
$pipelinesApiMock = $this->createMock(PipelinesApi::class);
$associationsBatchApiMock = $this->createMock(BatchApi::class);
$dealsBasicApiMock = $this->createMock(DealsBasicApi::class);
$propertiesMock->method('__call')->with('coreApi')->willReturn($coreApiMock);
$pipelinesMock->method('__call')->with('pipelinesApi')->willReturn($pipelinesApiMock);
$associationsMock->method('__call')->with('batchApi')->willReturn($associationsBatchApiMock);
$dealsDiscoveryMock = $this->createMock(DealsDiscovery::class);
$dealsDiscoveryMock->method('__call')->with('basicApi')->willReturn($dealsBasicApiMock);
$returnMap = ['properties' => $propertiesMock, 'pipelines' => $pipelinesMock, 'associations' => $associationsMock, 'deals' => $dealsDiscoveryMock];
$crmMock->method('__call')
->willReturnCallback(static fn (string $name) => $returnMap[$name])
;
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client->method('getNewInstance')->willReturn($discoveryMock);
$this->client = $client;
$this->config = $this->createMock(Configuration::class);
$this->client->setConfiguration($this->config);
$this->coreApiMock = $coreApiMock;
$this->pipelinesApiMock = $pipelinesApiMock;
$this->associationsBatchApiMock = $associationsBatchApiMock;
$this->dealsBasicApiMock = $dealsBasicApiMock;
$this->engagementsMock = $engagementsMock;
$this->hubspotClientMock = $hubspotClientMock;
}
public function testGetMinimumApiVersion(): void
{
$this->assertIsString($this->client->getMinimumApiVersion());
}
public function testGetInstance(): void
{
$socialAccountService = $this->createMock(SocialAccountService::class);
$paginationService = $this->createMock(HubspotPaginationService::class);
$tokenManager = $this->createMock(HubspotTokenManager::class);
$client = new Client($socialAccountService, $paginationService, $tokenManager);
$client->setBaseUrl('[URL_WITH_CREDENTIALS] The class CollectionResponsePipeline will be deprecated in the next Hubspot version
*/
$this->pipelinesApiMock
->method('getAll')
->with('deals')
->willReturn(new CollectionResponsePipeline([
'results' => [$this->generatePipeline()],
]))
;
$this->assertEquals(
[
['id' => 'foo', 'label' => 'bar'],
['id' => 'baz', 'label' => 'qux'],
],
$this->client->fetchOpportunityPipelineStages()
);
}
public function testFetchOpportunityPipelineStagesErrorResponse(): void
{
$this->pipelinesApiMock
->method('getAll')
->with('deals')
->willReturn(new Error(['message' => 'test error']))
;
$this->assertEmpty($this->client->fetchOpportunityPipelineStages());
}
#[\PHPUnit\Framework\Attributes\DataProvider('meetingOutcomeFieldProvider')]
public function testFetchMeetingOutcomeFieldOptions(string $fieldId, string $expectedEndpoint): void
{
$field = new Field(['crm_provider_id' => $fieldId]);
$this->hubspotClientMock
->expects($this->once())
->method('request')
->with('GET', $expectedEndpoint)
->willReturn($this->generateHubSpotResponse(
[
'options' => [
['value' => 'option_1', 'label' => 'Option 1', 'displayOrder' => 0],
['value' => 'option_2', 'label' => 'Option 2', 'displayOrder' => 1],
['value' => 'option_3', 'label' => 'Option 3', 'displayOrder' => 2],
],
]
))
;
$this->assertEquals(
[
['id' => 'option_1', 'value' => 'option_1', 'label' => 'Option 1', 'display_order' => 0],
['id' => 'option_2', 'value' => 'option_2', 'label' => 'Option 2', 'display_order' => 1],
['id' => 'option_3', 'value' => 'option_3', 'label' => 'Option 3', 'display_order' => 2],
],
$this->client->fetchMeetingOutcomeFieldOptions($field)
);
}
public static function meetingOutcomeFieldProvider(): array
{
return [
'meeting outcome field' => [
'meetingOutcome',
'[URL_WITH_CREDENTIALS] The class CollectionResponsePipeline will be deprecated in the next Hubspot version
*/
$pipelineStagesResponse = new CollectionResponsePipeline([
'results' => [$this->generatePipeline()],
]);
$this->pipelinesApiMock
->method('getAll')
->willReturn($pipelineStagesResponse);
}
if ($type === self::RESPONSE_TYPE_PIPELINE_FIELD) {
$field->method('isStageField')->willReturn(false);
$field->method('isPipelineField')->willReturn(true);
$pipelineResponse = $this->generateHubSpotResponse([
'results' => [
['id' => '123', 'label' => 'Sales'],
['id' => 'default', 'label' => 'CS'],
],
]);
$this->client
->method('makeRequest')
->with('/crm/v3/pipelines/deals')
->willReturn($pipelineResponse);
}
$this->assertEquals(
$responses[$type],
$this->client->fetchOpportunityFieldOptions($field)
);
}
public static function opportunityFieldOptionsProvider(): array
{
return [
'stage field' => [
'field' => new Field(['crm_provider_id' => 'dealstage']),
'type' => self::RESPONSE_TYPE_STAGE_FIELD,
],
'pipeline field' => [
'field' => new Field(['crm_provider_id' => 'pipeline']),
'type' => self::RESPONSE_TYPE_PIPELINE_FIELD,
],
'regular field' => [
'field' => new Field(['crm_provider_id' => 'some_property']),
'type' => self::RESPONSE_TYPE_REGULAR_FIELD,
],
];
}
private function generateHubSpotResponse(array $data): HubspotResponse
{
return new HubspotResponse(new Response(200, [], json_encode($data)));
}
private function generateProperty(): Property
{
return new Property([
'name' => 'some_property',
'options' => [
[
'label' => 'label_1',
'value' => 'value_1',
],
[
'label' => 'label_2',
'value' => 'value_2',
],
],
]);
}
private function generatePipeline(): Pipeline
{
return new Pipeline(['stages' => [
new PipelineStage(['id' => 'foo', 'label' => 'bar']),
new PipelineStage(['id' => 'baz', 'label' => 'qux']),
]]);
}
public function testFetchOpportunityPipelines(): void
{
$this->client
->method('makeRequest')
->with('/crm/v3/pipelines/deals')
->willReturn($this->generateHubSpotResponse([
'results' => [
['id' => 'id_1', 'label' => 'Option 1', 'displayOrder' => 0],
['id' => 'id_2', 'label' => 'Option 2', 'displayOrder' => 1],
['id' => 'id_3', 'label' => 'Option 3', 'displayOrder' => 2],
],
]));
$this->assertEquals(
[
['id' => 'id_1', 'label' => 'Option 1'],
['id' => 'id_2', 'label' => 'Option 2'],
['id' => 'id_3', 'label' => 'Option 3'],
],
$this->client->fetchOpportunityPipelines()
);
}
public function testGetPaginatedData(): void
{
$expectedResults = [
['id' => 'id_1', 'properties' => []],
['id' => 'id_2', 'properties' => []],
['id' => 'id_3', 'properties' => []],
];
// Mock the pagination service to return a generator and modify reference parameters
$this->paginationServiceMock
->expects($this->once())
->method('getPaginatedDataGenerator')
->with(
$this->client,
['payload_key' => 'payload_value'],
'foobar',
0,
$this->anything(),
$this->anything()
)
->willReturnCallback(function ($client, $payload, $type, $offset, &$total, &$lastRecordId) use ($expectedResults) {
$total = 3;
$lastRecordId = 'id_3';
foreach ($expectedResults as $result) {
yield $result;
}
});
$this->assertEquals(
[
'results' => $expectedResults,
'total' => 3,
'last_record' => 'id_3',
],
$this->client->getPaginatedData(['payload_key' => 'payload_value'], 'foobar')
);
}
public function testGetAssociationsData(): void
{
$ids = ['1', '2', '3'];
$fromObject = 'deals';
$toObject = 'contacts';
$responseResults = [];
foreach ($ids as $id) {
$from = new PublicObjectId();
$from->setId($id);
$to1 = new PublicObjectId();
$to1->setId('contact_' . $id . '_1');
$to2 = new PublicObjectId();
$to2->setId('contact_' . $id . '_2');
$result = new \HubSpot\Client\Crm\Associations\Model\PublicAssociationMulti();
$result->setFrom($from);
$result->setTo([$to1, $to2]);
$responseResults[] = $result;
}
$batchResponse = new BatchResponsePublicAssociationMulti();
$batchResponse->setResults($responseResults);
$this->associationsBatchApiMock->expects($this->once())
->method('read')
->with(
$this->equalTo($fromObject),
$this->equalTo($toObject),
$this->callback(function (BatchInputPublicObjectId $batchInput) use ($ids) {
$inputIds = array_map(
fn ($input) => $input->getId(),
$batchInput->getInputs()
);
return $inputIds === $ids;
})
)
->willReturn($batchResponse);
$result = $this->client->getAssociationsData($ids, $fromObject, $toObject);
$expectedResult = [
'1' => ['contact_1_1', 'contact_1_2'],
'2' => ['contact_2_1', 'contact_2_2'],
'3' => ['contact_3_1', 'contact_3_2'],
];
$this->assertEquals($expectedResult, $result);
}
public function testGetAssociationsDataHandlesException(): void
{
$ids = ['1', '2', '3'];
$fromObject = 'deals';
$toObject = 'contacts';
$exception = new \Exception('API Error');
$this->associationsBatchApiMock->expects($this->once())
->method('read')
->with(
$this->equalTo($fromObject),
$this->equalTo($toObject),
$this->callback(function ($batchInput) use ($ids) {
return $batchInput instanceof \HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId
&& count($batchInput->getInputs()) === count($ids);
})
)
->willThrowException($exception);
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with(
'[Hubspot] Failed to fetch associations',
[
'from_object' => $fromObject,
'to_object' => $toObject,
'reason' => 'API Error',
]
);
$this->client->setLogger($loggerMock);
$result = $this->client->getAssociationsData($ids, $fromObject, $toObject);
$this->assertEmpty($result);
$this->assertIsArray($result);
}
public function testGetAssociationsDataWithLargeDataSet(): void
{
$ids = array_map(fn ($i) => (string) $i, range(1, 2500)); // More than 1000 items
$fromObject = 'deals';
$toObject = 'contacts';
$firstBatchResponse = new BatchResponsePublicAssociationMulti();
$firstBatchResults = array_map(function ($id) {
$from = new PublicObjectId();
$from->setId($id);
$to = new PublicObjectId();
$to->setId('contact_' . $id);
$result = new \HubSpot\Client\Crm\Associations\Model\PublicAssociationMulti();
$result->setFrom($from);
$result->setTo([$to]);
return $result;
}, array_slice($ids, 0, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));
$firstBatchResponse->setResults($firstBatchResults);
$secondBatchResponse = new BatchResponsePublicAssociationMulti();
$secondBatchResults = array_map(function ($id) {
$from = new PublicObjectId();
$from->setId($id);
$to = new PublicObjectId();
$to->setId('contact_' . $id);
$result = new \HubSpot\Client\Crm\Associations\Model\PublicAssociationMulti();
$result->setFrom($from);
$result->setTo([$to]);
return $result;
}, array_slice($ids, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));
$secondBatchResponse->setResults($secondBatchResults);
$this->associationsBatchApiMock->expects($this->exactly(3))
->method('read')
->willReturnOnConsecutiveCalls($firstBatchResponse, $secondBatchResponse);
$result = $this->client->getAssociationsData($ids, $fromObject, $toObject);
$this->assertCount(2500, $result);
$this->assertArrayHasKey('1', $result);
$this->assertArrayHasKey('2500', $result);
$this->assertEquals(['contact_1'], $result['1']);
$this->assertEquals(['contact_2500'], $result['2500']);
}
public function testGetContactByEmailSuccess(): void
{
$email = '[EMAIL]';
$fields = ['firstname', 'lastname', 'email'];
$contactMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations::class);
$contactMock->method('getId')->willReturn('12345');
$contactMock->method('getProperties')->willReturn([
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[EMAIL]',
]);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($email, 'firstname,lastname,email', null, false, 'email')
->willReturn($contactMock);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new NullLogger());
$result = $client->getContactByEmail($email, $fields);
$this->assertEquals([
'id' => '12345',
'properties' => [
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[EMAIL]',
],
], $result);
}
public function testGetContactByEmailWithEmptyFields(): void
{
$email = '[EMAIL]';
$fields = [];
$contactMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations::class);
$contactMock->method('getId')->willReturn('12345');
$contactMock->method('getProperties')->willReturn(['email' => '[EMAIL]']);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($email, '', null, false, 'email')
->willReturn($contactMock);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new NullLogger());
$result = $client->getContactByEmail($email, $fields);
$this->assertEquals([
'id' => '12345',
'properties' => ['email' => '[EMAIL]'],
], $result);
}
public function testGetContactByEmailApiException(): void
{
$email = '[EMAIL]';
$fields = ['firstname', 'lastname'];
$exception = new \HubSpot\Client\Crm\Contacts\ApiException('Contact not found', 404);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($email, 'firstname,lastname', null, false, 'email')
->willThrowException($exception);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('info')
->with(
'[Hubspot] Failed to fetch contact',
[
'email' => $email,
'reason' => 'Contact not found',
]
);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger($loggerMock);
$result = $client->getContactByEmail($email, $fields);
$this->assertEquals([], $result);
}
public function testGetOpportunityById(): void
{
$opportunityId = '12345';
$expectedProperties = [
'dealname' => 'Test Opportunity',
'amount' => '1000.00',
'closedate' => '2024-12-31T23:59:59.999Z',
'dealstage' => 'presentationscheduled',
'pipeline' => 'default',
];
$mockHubspotOpportunity = $this->createMock(DealWithAssociations::class);
$mockHubspotOpportunity->method('getProperties')->willReturn((object) $expectedProperties);
$mockHubspotOpportunity->method('getId')->willReturn($opportunityId);
$now = new \DateTimeImmutable();
$mockHubspotOpportunity->method('getCreatedAt')->willReturn($now);
$mockHubspotOpportunity->method('getUpdatedAt')->willReturn($now);
$mockHubspotOpportunity->method('getArchived')->willReturn(false);
$this->dealsBasicApiMock
->expects($this->once())
->method('getById')
->willReturn($mockHubspotOpportunity);
// Assuming Client::getOpportunityById processes the SimplePublicObject and returns an associative array.
// The structure might be like: ['id' => ..., 'properties' => [...], 'createdAt' => ..., ...]
// Adjust assertions below based on the actual return structure of your method.
$result = $this->client->getOpportunityById($opportunityId, ['test', 'test']);
$this->assertIsArray($result);
$this->assertArrayHasKey('id', $result);
$this->assertEquals($opportunityId, $result['id']);
}
public function testGetContactById(): void
{
$crmId = 'contact-123';
$fields = ['firstname', 'lastname'];
$expectedProperties = ['firstname' => 'John', 'lastname' => 'Doe'];
$mockContact = $this->createMock(\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations::class);
$mockContact->method('getId')->willReturn($crmId);
$mockContact->method('getProperties')->willReturn((object) $expectedProperties);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($crmId, 'firstname,lastname')
->willReturn($mockContact);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new \Psr\Log\NullLogger());
$result = $client->getContactById($crmId, $fields);
$this->assertIsArray($result);
$this->assertArrayHasKey('id', $result);
$this->assertArrayHasKey('properties', $result);
$this->assertEquals($crmId, $result['id']);
$this->assertEquals((object) $expectedProperties, $result['properties']);
}
public function testGetAccountById(): void
{
$crmId = 'account-123';
$fields = ['name', 'industry'];
$expectedProperties = ['name' => 'Acme Corp', 'industry' => 'Technology'];
$mockCompany = $this->createMock(\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations::class);
$mockCompany->method('getId')->willReturn($crmId);
$mockCompany->method('getProperties')->willReturn((object) $expectedProperties);
$companiesApiMock = $this->createMock(\HubSpot\Client\Crm\Companies\Api\BasicApi::class);
$companiesApiMock->expects($this->once())
->method('getById')
->with($crmId, 'name,industry')
->willReturn($mockCompany);
$companiesDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Companies\Discovery::class);
$companiesDiscoveryMock->method('__call')->with('basicApi')->willReturn($companiesApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($companiesDiscoveryMock) {
if ($name === 'companies') {
return $companiesDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new \Psr\Log\NullLogger());
$result = $client->getAccountById($crmId, $fields);
$this->assertIsArray($result);
$this->assertArrayHasKey('id', $result);
$this->assertArrayHasKey('properties', $result);
$this->assertEquals($crmId, $result['id']);
$this->assertEquals((object) $expectedProperties, $result['properties']);
}
public function testEnsureValidTokenWithNoTokenUpdate(): void
{
$socialAccountMock = $this->createMock(SocialAccount::class);
// Set up OAuth account
$reflection = new \ReflectionClass($this->client);
$oauthAccountProperty = $reflection->getProperty('oauthAccount');
$oauthAccountProperty->setAccessible(true);
$oauthAccountProperty->setValue($this->client, $socialAccountMock);
$originalToken = 'original_token';
$accessTokenProperty = $reflection->getProperty('accessToken');
$accessTokenProperty->setAccessible(true);
$accessTokenProperty->setValue($this->client, $originalToken);
// Mock token manager to return null (no refresh needed)
$this->tokenManagerMock
->expects($this->once())
->method('ensureValidToken')
->with($socialAccountMock)
->willReturn(null);
// Call ensureValidToken
$this->client->ensureValidToken();
// Verify access token was not changed
$this->assertEquals($originalToken, $accessTokenProperty->getValue($this->client));
}
public function testGetPaginatedDataGeneratorDelegatesToPaginationService(): void
{
$payload = ['filters' => []];
$type = 'contacts';
$offset = 0;
$total = 0;
$lastRecordId = null;
$expectedResults = [
['id' => 'id_1', 'properties' => []],
['id' => 'id_2', 'properties' => []],
];
// Mock the pagination service to return a generator
$this->paginationServiceMock
->expects($this->once())
->method('getPaginatedDataGenerator')
->with(
$this->client,
$payload,
$type,
$offset,
$this->anything(),
$this->anything()
)
->willReturnCallback(function () use ($expectedResults) {
foreach ($expectedResults as $result) {
yield $result;
}
});
// Execute the pagination
$results = [];
foreach ($this->client->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastRecordId) as $result) {
$results[] = $result;
}
$this->assertCount(2, $results);
$this->assertEquals('id_1', $results[0]['id']);
$this->assertEquals('id_2', $results[1]['id']);
}
public function testEnsureValidTokenDelegatesToTokenManager(): void
{
$socialAccountMock = $this->createMock(SocialAccount::class);
// Set up OAuth account
$reflection = new \ReflectionClass($this->client);
$oauthAccountProperty = $reflection->getProperty('oauthAccount');
$oauthAccountProperty->setAccessible(true);
$oauthAccountProperty->setValue($this->client, $socialAccountMock);
// Mock token manager to return new token
$this->tokenManagerMock
->expects($this->once())
->method('ensureValidToken')
->with($socialAccountMock)
->willReturn('new_access_token');
// Call ensureValidToken
$this->client->ensureValidToken();
// Verify access token was updated
$accessTokenProperty = $reflection->getProperty('accessToken');
$accessTokenProperty->setAccessible(true);
$this->assertEquals('new_access_token', $accessTokenProperty->getValue($this->client));
}
public function testGetOwnersArchivedWithValidResponse(): void
{
$responseData = [
'results' => [
[
'id' => '123',
'email' => '[EMAIL]',
'type' => 'PERSON',
'firstName' => 'John',
'lastName' => 'Doe',
'userId' => 456,
'userIdIncludingInactive' => 789,
'createdAt' => '2023-01-01T12:00:00Z',
'updatedAt' => '2023-01-02T12:00:00Z',
'archived' => true,
],
],
];
// Create a mock response object
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willReturn($responseData);
// Set up the client to return our test data
$this->client->method('makeRequest')
->with(
'/crm/v3/owners',
'GET',
[],
'archived=true'
)
->willReturn($response);
// Call the method
$result = $this->client->getOwnersArchived(true);
// Assert the results
$this->assertCount(1, $result);
$this->assertEquals('123', $result[0]->getId());
$this->assertEquals('[EMAIL]', $result[0]->getEmail());
$this->assertEquals('John Doe', $result[0]->getFullName());
$this->assertTrue($result[0]->isArchived());
}
public function testGetOwnersArchivedWithEmptyResponse(): void
{
// Create a mock response object with empty results
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willReturn(['results' => []]);
// Set up the client to return empty results
$this->client->method('makeRequest')
->with(
'/crm/v3/owners',
'GET',
[],
'archived=false'
)
->willReturn($response);
// Call the method
$result = $this->client->getOwnersArchived(false);
// Assert the results
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testGetOwnersArchivedWithInvalidResponse(): void
{
// Create a mock response that will throw an exception when toArray is called
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willThrowException(new \InvalidArgumentException('Invalid JSON'));
// Set up the client to return the problematic response
$this->client->method('makeRequest')
->willReturn($response);
// Mock the logger to expect an error message
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with($this->stringContains('Failed to fetch owners'));
$reflection = new \ReflectionClass($this->client);
$loggerProperty = $reflection->getProperty('log');
$loggerProperty->setAccessible(true);
$loggerProperty->setValue($this->client, $loggerMock);
// Call the method and expect an empty array on error
$result = $this->client->getOwnersArchived(true);
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testGetOwnersArchivedWithHttpError(): void
{
// Set up the client to throw an exception
$this->client->method('makeRequest')
->willThrowException(new \Exception('HTTP Error'));
// Mock the logger to expect an error message
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with($this->stringContains('Failed to fetch owners'));
$reflection = new \ReflectionClass($this->client);
$loggerProperty = $reflection->getProperty('log');
$loggerProperty->setAccessible(true);
$loggerProperty->setValue($this->client, $loggerMock);
// Call the method and expect an empty array on error
$result = $this->client->getOwnersArchived(false);
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testGetOwnersArchivedWithOwnerCreationException(): void
{
$responseData = [
'results' => [
[
'id' => '123',
'email' => '[EMAIL]',
'type' => 'PERSON',
'firstName' => 'John',
'lastName' => 'Doe',
'userId' => 456,
'userIdIncludingInactive' => 789,
'createdAt' => '2023-01-01T12:00:00Z',
'updatedAt' => '2023-01-02T12:00:00Z',
'archived' => false,
],
[
'id' => '456',
'email' => '[EMAIL]',
'type' => 'PERSON',
'createdAt' => 'invalid-date-format',
],
[
'id' => '789',
'email' => '[EMAIL]',
'type' => 'PERSON',
'firstName' => 'Jane',
'lastName' => 'Smith',
'userId' => 999,
'userIdIncludingInactive' => 888,
'createdAt' => '2023-01-03T12:00:00Z',
'updatedAt' => '2023-01-04T12:00:00Z',
'archived' => false,
],
],
];
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willReturn($responseData);
$this->client->method('makeRequest')
->with(
'/crm/v3/owners',
'GET',
[],
'archived=false'
)
->willReturn($response);
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with(
'[HubSpot] Failed to process owner data',
$this->callback(function ($context) {
return isset($context['result']) &&
isset($context['error']) &&
$context['result']['id'] === '456' &&
$context['result']['email'] === '[EMAIL]' &&
str_contains($context['error'], 'invalid-date-format');
})
);
$reflection = new \ReflectionClass($this->client);
$loggerProperty = $reflection->getProperty('log');
$loggerProperty->setAccessible(true);
$loggerProperty->setValue($this->client, $loggerMock);
$result = $this->client->getOwnersArchived(false);
$this->assertIsArray($result);
$this->assertCount(2, $result);
$this->assertEquals('123', $result[0]->getId());
$this->assertEquals('[EMAIL]', $result[0]->getEmail());
$this->assertEquals('789', $result[1]->getId());
$this->assertEquals('[EMAIL]', $result[1]->getEmail());
}
public function testMakeRequestWithGetMethod(): void
{
$socialAccountService = $this->createMock(SocialAccountService::class);
$paginationService = $this->createMock(HubspotPaginationService::class);
$tokenManager = $this->createMock(HubspotTokenManager::class);
$psrResponse = new Response(200, [], json_encode(['status' => 'success']));
$expectedResponse = new HubspotResponse($psrResponse);
$hubspotClientMock = $this->createMock(HubspotClient::class);
$hubspotClientMock->expects($this->once())
->method('request')
->with(
'GET',
'https://api.hubapi.com/crm/v3/objects/contacts',
[],
null,
true
)
->willReturn($expectedResponse);
$factoryMock = $this->createMock(Factory::class);
$factoryMock->method('getClient')->willReturn($hubspotClientMock);
$client = $this->getMockBuilder(Client::class)
->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])
->onlyMethods(['getInstance'])
->getMock();
$client->method('getInstance')->willReturn($factoryMock);
$client->setAccessToken(new AccessToken(['access_token' => 'test_token']));
$result = $client->makeRequest('/crm/v3/objects/contacts', 'GET');
$this->assertSame($expectedResponse, $result);
}
public function testMakeRequestWithGetMethodAndQueryString(): void
{
$socialAccountService = $this->createMock(SocialAccountService::class);
$paginationService = $this->createMock(HubspotPaginationService...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"ClientTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Rerun 'PHPUnit: ClientTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'ClientTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Stop 'ClientTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"19","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"144","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"11","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Tests\\Unit\\Services\\Crm\\Hubspot;\n\nuse GuzzleHttp\\Psr7\\Response;\nuse HubSpot\\Client\\Crm\\Associations\\Api\\BatchApi;\nuse HubSpot\\Client\\Crm\\Associations\\Model\\BatchInputPublicObjectId;\nuse HubSpot\\Client\\Crm\\Associations\\Model\\BatchResponsePublicAssociationMulti;\nuse HubSpot\\Client\\Crm\\Associations\\Model\\PublicObjectId;\nuse HubSpot\\Client\\Crm\\Companies\\ApiException as CompanyApiException;\nuse HubSpot\\Client\\Crm\\Contacts\\ApiException as ContactApiException;\nuse HubSpot\\Client\\Crm\\Deals\\Api\\BasicApi as DealsBasicApi;\nuse HubSpot\\Client\\Crm\\Deals\\ApiException as DealApiException;\nuse HubSpot\\Client\\Crm\\Deals\\Model\\SimplePublicObjectWithAssociations as DealWithAssociations;\nuse HubSpot\\Client\\Crm\\Pipelines\\Api\\PipelinesApi;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\CollectionResponsePipeline;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\Error;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\Pipeline;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\PipelineStage;\nuse HubSpot\\Client\\Crm\\Properties\\Api\\CoreApi;\nuse HubSpot\\Client\\Crm\\Properties\\Model\\Property;\nuse HubSpot\\Discovery as HubSpotDiscovery;\nuse HubSpot\\Discovery\\Crm\\Deals\\Discovery as DealsDiscovery;\nuse Jiminny\\Exceptions\\RateLimitException;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Services\\Crm\\Hubspot\\Client;\nuse Jiminny\\Services\\Crm\\Hubspot\\HubspotTokenManager;\nuse Jiminny\\Services\\Crm\\Hubspot\\Pagination\\HubspotPaginationService;\nuse Jiminny\\Services\\SocialAccountService;\nuse League\\OAuth2\\Client\\Token\\AccessToken;\nuse Mockery;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Log\\NullLogger;\nuse SevenShores\\Hubspot\\Endpoints\\Engagements;\nuse SevenShores\\Hubspot\\Exceptions\\BadRequest;\nuse SevenShores\\Hubspot\\Factory;\nuse SevenShores\\Hubspot\\Http\\Client as HubspotClient;\nuse SevenShores\\Hubspot\\Http\\Response as HubspotResponse;\n\n/**\n * @runTestsInSeparateProcesses\n *\n * @preserveGlobalState disabled\n */\nclass ClientTest extends TestCase\n{\n private const string RESPONSE_TYPE_STAGE_FIELD = 'stage';\n private const string RESPONSE_TYPE_PIPELINE_FIELD = 'pipeline';\n private const string RESPONSE_TYPE_REGULAR_FIELD = 'regular';\n /**\n * @var Client&MockObject\n */\n private Client $client;\n private Configuration $config;\n\n /**\n * @var SocialAccountService&MockObject\n */\n private SocialAccountService $socialAccountServiceMock;\n\n /**\n * @var HubspotPaginationService&MockObject\n */\n private HubspotPaginationService $paginationServiceMock;\n\n /**\n * @var HubspotTokenManager&MockObject\n */\n private HubspotTokenManager $tokenManagerMock;\n\n /**\n * @var CoreApi&MockObject\n */\n private CoreApi $coreApiMock;\n\n /**\n * @var PipelinesApi&MockObject\n */\n private PipelinesApi $pipelinesApiMock;\n\n /**\n * @var BatchApi&MockObject\n */\n private BatchApi $associationsBatchApiMock;\n\n /**\n * @var DealsBasicApi&MockObject\n */\n private DealsBasicApi $dealsBasicApiMock;\n\n /**\n * @var Engagements&MockObject\n */\n private $engagementsMock;\n\n /**\n * @var HubspotClient&MockObject\n */\n private HubspotClient $hubspotClientMock;\n\n protected function setUp(): void\n {\n // Create mocks for dependencies\n $this->socialAccountServiceMock = $this->createMock(SocialAccountService::class);\n $this->paginationServiceMock = $this->createMock(HubspotPaginationService::class);\n $this->tokenManagerMock = $this->createMock(HubspotTokenManager::class);\n\n // Create a real Client instance with mocked dependencies\n // Create a partial mock only for the methods we need to mock\n $client = $this->createPartialMock(Client::class, ['getInstance', 'getNewInstance', 'makeRequest']);\n $client->setLogger(new NullLogger());\n\n // Inject the real dependencies using reflection\n $reflection = new \\ReflectionClass(Client::class);\n\n $accountServiceProperty = $reflection->getProperty('accountService');\n $accountServiceProperty->setAccessible(true);\n $accountServiceProperty->setValue($client, $this->socialAccountServiceMock);\n\n $paginationServiceProperty = $reflection->getProperty('paginationService');\n $paginationServiceProperty->setAccessible(true);\n $paginationServiceProperty->setValue($client, $this->paginationServiceMock);\n\n $tokenManagerProperty = $reflection->getProperty('tokenManager');\n $tokenManagerProperty->setAccessible(true);\n $tokenManagerProperty->setValue($client, $this->tokenManagerMock);\n $factoryMock = $this->createMock(Factory::class);\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $engagementsMock = $this->createMock(\\SevenShores\\Hubspot\\Endpoints\\Engagements::class);\n\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n $factoryMock->method('__call')->with('engagements')->willReturn($engagementsMock);\n\n $client->method('getInstance')->willReturn($factoryMock);\n\n $discoveryMock = $this->createMock(HubSpotDiscovery\\Discovery::class);\n $crmMock = $this->createMock(HubSpotDiscovery\\Crm\\Discovery::class);\n $associationsMock = $this->createMock(HubSpotDiscovery\\Crm\\Associations\\Discovery::class);\n $propertiesMock = $this->createMock(HubSpotDiscovery\\Crm\\Properties\\Discovery::class);\n $pipelinesMock = $this->createMock(HubSpotDiscovery\\Crm\\Pipelines\\Discovery::class);\n $coreApiMock = $this->createMock(CoreApi::class);\n $pipelinesApiMock = $this->createMock(PipelinesApi::class);\n $associationsBatchApiMock = $this->createMock(BatchApi::class);\n $dealsBasicApiMock = $this->createMock(DealsBasicApi::class);\n\n $propertiesMock->method('__call')->with('coreApi')->willReturn($coreApiMock);\n $pipelinesMock->method('__call')->with('pipelinesApi')->willReturn($pipelinesApiMock);\n $associationsMock->method('__call')->with('batchApi')->willReturn($associationsBatchApiMock);\n $dealsDiscoveryMock = $this->createMock(DealsDiscovery::class);\n $dealsDiscoveryMock->method('__call')->with('basicApi')->willReturn($dealsBasicApiMock);\n\n $returnMap = ['properties' => $propertiesMock, 'pipelines' => $pipelinesMock, 'associations' => $associationsMock, 'deals' => $dealsDiscoveryMock];\n $crmMock->method('__call')\n ->willReturnCallback(static fn (string $name) => $returnMap[$name])\n ;\n\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n\n $this->client = $client;\n $this->config = $this->createMock(Configuration::class);\n $this->client->setConfiguration($this->config);\n $this->coreApiMock = $coreApiMock;\n $this->pipelinesApiMock = $pipelinesApiMock;\n $this->associationsBatchApiMock = $associationsBatchApiMock;\n $this->dealsBasicApiMock = $dealsBasicApiMock;\n $this->engagementsMock = $engagementsMock;\n $this->hubspotClientMock = $hubspotClientMock;\n }\n\n public function testGetMinimumApiVersion(): void\n {\n $this->assertIsString($this->client->getMinimumApiVersion());\n }\n\n public function testGetInstance(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $client = new Client($socialAccountService, $paginationService, $tokenManager);\n $client->setBaseUrl('https://example.com');\n $client->setAccessToken(new AccessToken(['access_token' => 'foo']));\n $factory = $client->getInstance();\n\n $this->assertEquals('foo', $factory->getClient()->key);\n }\n\n public function testGetNewInstance(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $client = new Client($socialAccountService, $paginationService, $tokenManager);\n $client->setAccessToken(new AccessToken(['access_token' => 'foo']));\n\n $factory = $client->getNewInstance();\n $token = $factory->auth()->oAuth()->accessTokensApi()->getConfig()->getAccessToken();\n $this->assertEquals('foo', $token);\n }\n\n public function testFetchProperty(): void\n {\n $this->coreApiMock->method('getByName')->willReturn($this->generateProperty());\n\n $this->assertEquals(\n 'some_property',\n $this->client->fetchProperty('foo', 'test')['name']\n );\n }\n\n public function testFetchPropertyOptions(): void\n {\n $this->coreApiMock->method('getByName')->willReturn($this->generateProperty());\n\n $this->assertEquals(\n [\n [\n 'label' => 'label_1',\n 'value' => 'value_1',\n ],\n [\n 'label' => 'label_2',\n 'value' => 'value_2',\n ],\n ],\n $this->client->fetchPropertyOptions('foo', 'test')\n );\n }\n\n public function testFetchCallDispositions(): void\n {\n $this->engagementsMock\n ->method('getCallDispositions')\n ->willReturn($this->generateHubSpotResponse([\n [\n 'id' => 1,\n 'label' => 'foo',\n 'deleted' => false,\n ],\n [\n 'id' => 2,\n 'label' => 'bar',\n 'deleted' => false,\n ],\n ]))\n ;\n\n $this->assertEquals(\n [\n [\n 'id' => 1,\n 'label' => 'foo',\n 'deleted' => false,\n ],\n [\n 'id' => 2,\n 'label' => 'bar',\n 'deleted' => false,\n ],\n ],\n $this->client->fetchCallDispositions()\n );\n }\n\n public function testFetchDispositionFieldOptions(): void\n {\n $this->engagementsMock->method('getCallDispositions')\n ->willReturn($this->generateHubSpotResponse(\n [\n [\n 'id' => 1,\n 'label' => 'Label 1',\n 'deleted' => false,\n ],\n [\n 'id' => 2,\n 'label' => 'Label 2',\n 'deleted' => true,\n ],\n ]\n ))\n ;\n\n $this->assertEquals(\n [\n [\n 'value' => 1,\n 'id' => 1,\n 'label' => 'Label 1',\n ],\n ],\n $this->client->fetchDispositionFieldOptions()\n );\n }\n\n public function testFetchOpportunityPipelineStages(): void\n {\n /**\n * @TODO: The class CollectionResponsePipeline will be deprecated in the next Hubspot version\n */\n $this->pipelinesApiMock\n ->method('getAll')\n ->with('deals')\n ->willReturn(new CollectionResponsePipeline([\n 'results' => [$this->generatePipeline()],\n ]))\n ;\n\n $this->assertEquals(\n [\n ['id' => 'foo', 'label' => 'bar'],\n ['id' => 'baz', 'label' => 'qux'],\n ],\n $this->client->fetchOpportunityPipelineStages()\n );\n }\n\n public function testFetchOpportunityPipelineStagesErrorResponse(): void\n {\n $this->pipelinesApiMock\n ->method('getAll')\n ->with('deals')\n ->willReturn(new Error(['message' => 'test error']))\n ;\n\n $this->assertEmpty($this->client->fetchOpportunityPipelineStages());\n }\n\n #[\\PHPUnit\\Framework\\Attributes\\DataProvider('meetingOutcomeFieldProvider')]\n public function testFetchMeetingOutcomeFieldOptions(string $fieldId, string $expectedEndpoint): void\n {\n $field = new Field(['crm_provider_id' => $fieldId]);\n\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->with('GET', $expectedEndpoint)\n ->willReturn($this->generateHubSpotResponse(\n [\n 'options' => [\n ['value' => 'option_1', 'label' => 'Option 1', 'displayOrder' => 0],\n ['value' => 'option_2', 'label' => 'Option 2', 'displayOrder' => 1],\n ['value' => 'option_3', 'label' => 'Option 3', 'displayOrder' => 2],\n ],\n ]\n ))\n ;\n\n $this->assertEquals(\n [\n ['id' => 'option_1', 'value' => 'option_1', 'label' => 'Option 1', 'display_order' => 0],\n ['id' => 'option_2', 'value' => 'option_2', 'label' => 'Option 2', 'display_order' => 1],\n ['id' => 'option_3', 'value' => 'option_3', 'label' => 'Option 3', 'display_order' => 2],\n ],\n $this->client->fetchMeetingOutcomeFieldOptions($field)\n );\n }\n\n public static function meetingOutcomeFieldProvider(): array\n {\n return [\n 'meeting outcome field' => [\n 'meetingOutcome',\n 'https://api.hubapi.com/crm/v3/properties/meeting/hs_meeting_outcome',\n ],\n 'activity type field' => [\n 'foobar',\n 'https://api.hubapi.com/crm/v3/properties/call/hs_activity_type',\n ],\n ];\n }\n\n #[\\PHPUnit\\Framework\\Attributes\\DataProvider('opportunityFieldOptionsProvider')]\n public function testFetchOpportunityFieldOptions(Field $field, string $type): void\n {\n $responses = [\n self::RESPONSE_TYPE_STAGE_FIELD => [\n ['id' => 'foo', 'label' => 'bar'],\n ['id' => 'baz', 'label' => 'qux'],\n ],\n self::RESPONSE_TYPE_PIPELINE_FIELD => [\n ['id' => '123', 'label' => 'Sales'],\n ['id' => 'default', 'label' => 'CS'],\n ],\n self::RESPONSE_TYPE_REGULAR_FIELD => [\n [\n 'label' => 'label_1',\n 'value' => 'value_1',\n ],\n [\n 'label' => 'label_2',\n 'value' => 'value_2',\n ],\n ],\n ];\n\n $field = $this->createMock(Field::class);\n\n if ($type === self::RESPONSE_TYPE_REGULAR_FIELD) {\n $field->method('isStageField')->willReturn(false);\n $field->method('isPipelineField')->willReturn(false);\n $propertyResponse = $this->generateProperty();\n $this->coreApiMock->method('getByName')->willReturn($propertyResponse);\n }\n\n if ($type === self::RESPONSE_TYPE_STAGE_FIELD) {\n $field->method('isStageField')->willReturn(true);\n /**\n * @TODO: The class CollectionResponsePipeline will be deprecated in the next Hubspot version\n */\n\n $pipelineStagesResponse = new CollectionResponsePipeline([\n 'results' => [$this->generatePipeline()],\n ]);\n $this->pipelinesApiMock\n ->method('getAll')\n ->willReturn($pipelineStagesResponse);\n }\n\n if ($type === self::RESPONSE_TYPE_PIPELINE_FIELD) {\n $field->method('isStageField')->willReturn(false);\n $field->method('isPipelineField')->willReturn(true);\n $pipelineResponse = $this->generateHubSpotResponse([\n 'results' => [\n ['id' => '123', 'label' => 'Sales'],\n ['id' => 'default', 'label' => 'CS'],\n ],\n ]);\n $this->client\n ->method('makeRequest')\n ->with('/crm/v3/pipelines/deals')\n ->willReturn($pipelineResponse);\n }\n\n $this->assertEquals(\n $responses[$type],\n $this->client->fetchOpportunityFieldOptions($field)\n );\n }\n\n public static function opportunityFieldOptionsProvider(): array\n {\n return [\n 'stage field' => [\n 'field' => new Field(['crm_provider_id' => 'dealstage']),\n 'type' => self::RESPONSE_TYPE_STAGE_FIELD,\n ],\n 'pipeline field' => [\n 'field' => new Field(['crm_provider_id' => 'pipeline']),\n 'type' => self::RESPONSE_TYPE_PIPELINE_FIELD,\n ],\n 'regular field' => [\n 'field' => new Field(['crm_provider_id' => 'some_property']),\n 'type' => self::RESPONSE_TYPE_REGULAR_FIELD,\n ],\n ];\n }\n\n private function generateHubSpotResponse(array $data): HubspotResponse\n {\n return new HubspotResponse(new Response(200, [], json_encode($data)));\n }\n\n private function generateProperty(): Property\n {\n return new Property([\n 'name' => 'some_property',\n 'options' => [\n [\n 'label' => 'label_1',\n 'value' => 'value_1',\n ],\n [\n 'label' => 'label_2',\n 'value' => 'value_2',\n ],\n ],\n ]);\n }\n\n private function generatePipeline(): Pipeline\n {\n return new Pipeline(['stages' => [\n new PipelineStage(['id' => 'foo', 'label' => 'bar']),\n new PipelineStage(['id' => 'baz', 'label' => 'qux']),\n ]]);\n }\n\n public function testFetchOpportunityPipelines(): void\n {\n $this->client\n ->method('makeRequest')\n ->with('/crm/v3/pipelines/deals')\n ->willReturn($this->generateHubSpotResponse([\n 'results' => [\n ['id' => 'id_1', 'label' => 'Option 1', 'displayOrder' => 0],\n ['id' => 'id_2', 'label' => 'Option 2', 'displayOrder' => 1],\n ['id' => 'id_3', 'label' => 'Option 3', 'displayOrder' => 2],\n ],\n ]));\n\n $this->assertEquals(\n [\n ['id' => 'id_1', 'label' => 'Option 1'],\n ['id' => 'id_2', 'label' => 'Option 2'],\n ['id' => 'id_3', 'label' => 'Option 3'],\n ],\n $this->client->fetchOpportunityPipelines()\n );\n }\n\n public function testGetPaginatedData(): void\n {\n $expectedResults = [\n ['id' => 'id_1', 'properties' => []],\n ['id' => 'id_2', 'properties' => []],\n ['id' => 'id_3', 'properties' => []],\n ];\n\n // Mock the pagination service to return a generator and modify reference parameters\n $this->paginationServiceMock\n ->expects($this->once())\n ->method('getPaginatedDataGenerator')\n ->with(\n $this->client,\n ['payload_key' => 'payload_value'],\n 'foobar',\n 0,\n $this->anything(),\n $this->anything()\n )\n ->willReturnCallback(function ($client, $payload, $type, $offset, &$total, &$lastRecordId) use ($expectedResults) {\n $total = 3;\n $lastRecordId = 'id_3';\n foreach ($expectedResults as $result) {\n yield $result;\n }\n });\n\n $this->assertEquals(\n [\n 'results' => $expectedResults,\n 'total' => 3,\n 'last_record' => 'id_3',\n ],\n $this->client->getPaginatedData(['payload_key' => 'payload_value'], 'foobar')\n );\n }\n\n public function testGetAssociationsData(): void\n {\n $ids = ['1', '2', '3'];\n $fromObject = 'deals';\n $toObject = 'contacts';\n\n $responseResults = [];\n foreach ($ids as $id) {\n $from = new PublicObjectId();\n $from->setId($id);\n\n $to1 = new PublicObjectId();\n $to1->setId('contact_' . $id . '_1');\n $to2 = new PublicObjectId();\n $to2->setId('contact_' . $id . '_2');\n\n $result = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicAssociationMulti();\n $result->setFrom($from);\n $result->setTo([$to1, $to2]);\n\n $responseResults[] = $result;\n }\n\n $batchResponse = new BatchResponsePublicAssociationMulti();\n $batchResponse->setResults($responseResults);\n\n $this->associationsBatchApiMock->expects($this->once())\n ->method('read')\n ->with(\n $this->equalTo($fromObject),\n $this->equalTo($toObject),\n $this->callback(function (BatchInputPublicObjectId $batchInput) use ($ids) {\n $inputIds = array_map(\n fn ($input) => $input->getId(),\n $batchInput->getInputs()\n );\n\n return $inputIds === $ids;\n })\n )\n ->willReturn($batchResponse);\n\n $result = $this->client->getAssociationsData($ids, $fromObject, $toObject);\n\n $expectedResult = [\n '1' => ['contact_1_1', 'contact_1_2'],\n '2' => ['contact_2_1', 'contact_2_2'],\n '3' => ['contact_3_1', 'contact_3_2'],\n ];\n\n $this->assertEquals($expectedResult, $result);\n }\n\n public function testGetAssociationsDataHandlesException(): void\n {\n $ids = ['1', '2', '3'];\n $fromObject = 'deals';\n $toObject = 'contacts';\n\n $exception = new \\Exception('API Error');\n\n $this->associationsBatchApiMock->expects($this->once())\n ->method('read')\n ->with(\n $this->equalTo($fromObject),\n $this->equalTo($toObject),\n $this->callback(function ($batchInput) use ($ids) {\n return $batchInput instanceof \\HubSpot\\Client\\Crm\\Associations\\Model\\BatchInputPublicObjectId\n && count($batchInput->getInputs()) === count($ids);\n })\n )\n ->willThrowException($exception);\n\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with(\n '[Hubspot] Failed to fetch associations',\n [\n 'from_object' => $fromObject,\n 'to_object' => $toObject,\n 'reason' => 'API Error',\n ]\n );\n\n $this->client->setLogger($loggerMock);\n\n $result = $this->client->getAssociationsData($ids, $fromObject, $toObject);\n\n $this->assertEmpty($result);\n $this->assertIsArray($result);\n }\n\n public function testGetAssociationsDataWithLargeDataSet(): void\n {\n $ids = array_map(fn ($i) => (string) $i, range(1, 2500)); // More than 1000 items\n $fromObject = 'deals';\n $toObject = 'contacts';\n\n $firstBatchResponse = new BatchResponsePublicAssociationMulti();\n $firstBatchResults = array_map(function ($id) {\n $from = new PublicObjectId();\n $from->setId($id);\n $to = new PublicObjectId();\n $to->setId('contact_' . $id);\n $result = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicAssociationMulti();\n $result->setFrom($from);\n $result->setTo([$to]);\n\n return $result;\n }, array_slice($ids, 0, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));\n $firstBatchResponse->setResults($firstBatchResults);\n\n $secondBatchResponse = new BatchResponsePublicAssociationMulti();\n $secondBatchResults = array_map(function ($id) {\n $from = new PublicObjectId();\n $from->setId($id);\n $to = new PublicObjectId();\n $to->setId('contact_' . $id);\n $result = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicAssociationMulti();\n $result->setFrom($from);\n $result->setTo([$to]);\n\n return $result;\n }, array_slice($ids, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));\n $secondBatchResponse->setResults($secondBatchResults);\n\n $this->associationsBatchApiMock->expects($this->exactly(3))\n ->method('read')\n ->willReturnOnConsecutiveCalls($firstBatchResponse, $secondBatchResponse);\n\n $result = $this->client->getAssociationsData($ids, $fromObject, $toObject);\n\n $this->assertCount(2500, $result);\n $this->assertArrayHasKey('1', $result);\n $this->assertArrayHasKey('2500', $result);\n $this->assertEquals(['contact_1'], $result['1']);\n $this->assertEquals(['contact_2500'], $result['2500']);\n }\n\n public function testGetContactByEmailSuccess(): void\n {\n $email = 'test@example.com';\n $fields = ['firstname', 'lastname', 'email'];\n\n $contactMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations::class);\n $contactMock->method('getId')->willReturn('12345');\n $contactMock->method('getProperties')->willReturn([\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n 'email' => 'test@example.com',\n ]);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($email, 'firstname,lastname,email', null, false, 'email')\n ->willReturn($contactMock);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new NullLogger());\n\n $result = $client->getContactByEmail($email, $fields);\n\n $this->assertEquals([\n 'id' => '12345',\n 'properties' => [\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n 'email' => 'test@example.com',\n ],\n ], $result);\n }\n\n public function testGetContactByEmailWithEmptyFields(): void\n {\n $email = 'test@example.com';\n $fields = [];\n\n $contactMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations::class);\n $contactMock->method('getId')->willReturn('12345');\n $contactMock->method('getProperties')->willReturn(['email' => 'test@example.com']);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($email, '', null, false, 'email')\n ->willReturn($contactMock);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new NullLogger());\n\n $result = $client->getContactByEmail($email, $fields);\n\n $this->assertEquals([\n 'id' => '12345',\n 'properties' => ['email' => 'test@example.com'],\n ], $result);\n }\n\n public function testGetContactByEmailApiException(): void\n {\n $email = 'nonexistent@example.com';\n $fields = ['firstname', 'lastname'];\n\n $exception = new \\HubSpot\\Client\\Crm\\Contacts\\ApiException('Contact not found', 404);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($email, 'firstname,lastname', null, false, 'email')\n ->willThrowException($exception);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('info')\n ->with(\n '[Hubspot] Failed to fetch contact',\n [\n 'email' => $email,\n 'reason' => 'Contact not found',\n ]\n );\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger($loggerMock);\n\n $result = $client->getContactByEmail($email, $fields);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetOpportunityById(): void\n {\n $opportunityId = '12345';\n $expectedProperties = [\n 'dealname' => 'Test Opportunity',\n 'amount' => '1000.00',\n 'closedate' => '2024-12-31T23:59:59.999Z',\n 'dealstage' => 'presentationscheduled',\n 'pipeline' => 'default',\n ];\n\n $mockHubspotOpportunity = $this->createMock(DealWithAssociations::class);\n $mockHubspotOpportunity->method('getProperties')->willReturn((object) $expectedProperties);\n $mockHubspotOpportunity->method('getId')->willReturn($opportunityId);\n $now = new \\DateTimeImmutable();\n $mockHubspotOpportunity->method('getCreatedAt')->willReturn($now);\n $mockHubspotOpportunity->method('getUpdatedAt')->willReturn($now);\n $mockHubspotOpportunity->method('getArchived')->willReturn(false);\n\n $this->dealsBasicApiMock\n ->expects($this->once())\n ->method('getById')\n ->willReturn($mockHubspotOpportunity);\n\n // Assuming Client::getOpportunityById processes the SimplePublicObject and returns an associative array.\n // The structure might be like: ['id' => ..., 'properties' => [...], 'createdAt' => ..., ...]\n // Adjust assertions below based on the actual return structure of your method.\n $result = $this->client->getOpportunityById($opportunityId, ['test', 'test']);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('id', $result);\n $this->assertEquals($opportunityId, $result['id']);\n }\n\n public function testGetContactById(): void\n {\n $crmId = 'contact-123';\n $fields = ['firstname', 'lastname'];\n $expectedProperties = ['firstname' => 'John', 'lastname' => 'Doe'];\n\n $mockContact = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations::class);\n $mockContact->method('getId')->willReturn($crmId);\n $mockContact->method('getProperties')->willReturn((object) $expectedProperties);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($crmId, 'firstname,lastname')\n ->willReturn($mockContact);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new \\Psr\\Log\\NullLogger());\n\n $result = $client->getContactById($crmId, $fields);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('id', $result);\n $this->assertArrayHasKey('properties', $result);\n $this->assertEquals($crmId, $result['id']);\n $this->assertEquals((object) $expectedProperties, $result['properties']);\n }\n\n public function testGetAccountById(): void\n {\n $crmId = 'account-123';\n $fields = ['name', 'industry'];\n $expectedProperties = ['name' => 'Acme Corp', 'industry' => 'Technology'];\n\n $mockCompany = $this->createMock(\\HubSpot\\Client\\Crm\\Companies\\Model\\SimplePublicObjectWithAssociations::class);\n $mockCompany->method('getId')->willReturn($crmId);\n $mockCompany->method('getProperties')->willReturn((object) $expectedProperties);\n\n $companiesApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Companies\\Api\\BasicApi::class);\n $companiesApiMock->expects($this->once())\n ->method('getById')\n ->with($crmId, 'name,industry')\n ->willReturn($mockCompany);\n\n $companiesDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Companies\\Discovery::class);\n $companiesDiscoveryMock->method('__call')->with('basicApi')->willReturn($companiesApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($companiesDiscoveryMock) {\n if ($name === 'companies') {\n return $companiesDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new \\Psr\\Log\\NullLogger());\n\n $result = $client->getAccountById($crmId, $fields);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('id', $result);\n $this->assertArrayHasKey('properties', $result);\n $this->assertEquals($crmId, $result['id']);\n $this->assertEquals((object) $expectedProperties, $result['properties']);\n }\n\n public function testEnsureValidTokenWithNoTokenUpdate(): void\n {\n $socialAccountMock = $this->createMock(SocialAccount::class);\n\n // Set up OAuth account\n $reflection = new \\ReflectionClass($this->client);\n $oauthAccountProperty = $reflection->getProperty('oauthAccount');\n $oauthAccountProperty->setAccessible(true);\n $oauthAccountProperty->setValue($this->client, $socialAccountMock);\n\n $originalToken = 'original_token';\n $accessTokenProperty = $reflection->getProperty('accessToken');\n $accessTokenProperty->setAccessible(true);\n $accessTokenProperty->setValue($this->client, $originalToken);\n\n // Mock token manager to return null (no refresh needed)\n $this->tokenManagerMock\n ->expects($this->once())\n ->method('ensureValidToken')\n ->with($socialAccountMock)\n ->willReturn(null);\n\n // Call ensureValidToken\n $this->client->ensureValidToken();\n\n // Verify access token was not changed\n $this->assertEquals($originalToken, $accessTokenProperty->getValue($this->client));\n }\n\n\n\n\n\n\n public function testGetPaginatedDataGeneratorDelegatesToPaginationService(): void\n {\n $payload = ['filters' => []];\n $type = 'contacts';\n $offset = 0;\n $total = 0;\n $lastRecordId = null;\n\n $expectedResults = [\n ['id' => 'id_1', 'properties' => []],\n ['id' => 'id_2', 'properties' => []],\n ];\n\n // Mock the pagination service to return a generator\n $this->paginationServiceMock\n ->expects($this->once())\n ->method('getPaginatedDataGenerator')\n ->with(\n $this->client,\n $payload,\n $type,\n $offset,\n $this->anything(),\n $this->anything()\n )\n ->willReturnCallback(function () use ($expectedResults) {\n foreach ($expectedResults as $result) {\n yield $result;\n }\n });\n\n // Execute the pagination\n $results = [];\n foreach ($this->client->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastRecordId) as $result) {\n $results[] = $result;\n }\n\n $this->assertCount(2, $results);\n $this->assertEquals('id_1', $results[0]['id']);\n $this->assertEquals('id_2', $results[1]['id']);\n }\n\n public function testEnsureValidTokenDelegatesToTokenManager(): void\n {\n $socialAccountMock = $this->createMock(SocialAccount::class);\n\n // Set up OAuth account\n $reflection = new \\ReflectionClass($this->client);\n $oauthAccountProperty = $reflection->getProperty('oauthAccount');\n $oauthAccountProperty->setAccessible(true);\n $oauthAccountProperty->setValue($this->client, $socialAccountMock);\n\n // Mock token manager to return new token\n $this->tokenManagerMock\n ->expects($this->once())\n ->method('ensureValidToken')\n ->with($socialAccountMock)\n ->willReturn('new_access_token');\n\n // Call ensureValidToken\n $this->client->ensureValidToken();\n\n // Verify access token was updated\n $accessTokenProperty = $reflection->getProperty('accessToken');\n $accessTokenProperty->setAccessible(true);\n $this->assertEquals('new_access_token', $accessTokenProperty->getValue($this->client));\n }\n\n public function testGetOwnersArchivedWithValidResponse(): void\n {\n $responseData = [\n 'results' => [\n [\n 'id' => '123',\n 'email' => 'owner1@example.com',\n 'type' => 'PERSON',\n 'firstName' => 'John',\n 'lastName' => 'Doe',\n 'userId' => 456,\n 'userIdIncludingInactive' => 789,\n 'createdAt' => '2023-01-01T12:00:00Z',\n 'updatedAt' => '2023-01-02T12:00:00Z',\n 'archived' => true,\n ],\n ],\n ];\n\n // Create a mock response object\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willReturn($responseData);\n\n // Set up the client to return our test data\n $this->client->method('makeRequest')\n ->with(\n '/crm/v3/owners',\n 'GET',\n [],\n 'archived=true'\n )\n ->willReturn($response);\n\n // Call the method\n $result = $this->client->getOwnersArchived(true);\n\n // Assert the results\n $this->assertCount(1, $result);\n $this->assertEquals('123', $result[0]->getId());\n $this->assertEquals('owner1@example.com', $result[0]->getEmail());\n $this->assertEquals('John Doe', $result[0]->getFullName());\n $this->assertTrue($result[0]->isArchived());\n }\n\n public function testGetOwnersArchivedWithEmptyResponse(): void\n {\n // Create a mock response object with empty results\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willReturn(['results' => []]);\n\n // Set up the client to return empty results\n $this->client->method('makeRequest')\n ->with(\n '/crm/v3/owners',\n 'GET',\n [],\n 'archived=false'\n )\n ->willReturn($response);\n\n // Call the method\n $result = $this->client->getOwnersArchived(false);\n\n // Assert the results\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testGetOwnersArchivedWithInvalidResponse(): void\n {\n // Create a mock response that will throw an exception when toArray is called\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willThrowException(new \\InvalidArgumentException('Invalid JSON'));\n\n // Set up the client to return the problematic response\n $this->client->method('makeRequest')\n ->willReturn($response);\n\n // Mock the logger to expect an error message\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with($this->stringContains('Failed to fetch owners'));\n\n $reflection = new \\ReflectionClass($this->client);\n $loggerProperty = $reflection->getProperty('log');\n $loggerProperty->setAccessible(true);\n $loggerProperty->setValue($this->client, $loggerMock);\n\n // Call the method and expect an empty array on error\n $result = $this->client->getOwnersArchived(true);\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testGetOwnersArchivedWithHttpError(): void\n {\n // Set up the client to throw an exception\n $this->client->method('makeRequest')\n ->willThrowException(new \\Exception('HTTP Error'));\n\n // Mock the logger to expect an error message\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with($this->stringContains('Failed to fetch owners'));\n\n $reflection = new \\ReflectionClass($this->client);\n $loggerProperty = $reflection->getProperty('log');\n $loggerProperty->setAccessible(true);\n $loggerProperty->setValue($this->client, $loggerMock);\n\n // Call the method and expect an empty array on error\n $result = $this->client->getOwnersArchived(false);\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testGetOwnersArchivedWithOwnerCreationException(): void\n {\n $responseData = [\n 'results' => [\n [\n 'id' => '123',\n 'email' => 'valid@example.com',\n 'type' => 'PERSON',\n 'firstName' => 'John',\n 'lastName' => 'Doe',\n 'userId' => 456,\n 'userIdIncludingInactive' => 789,\n 'createdAt' => '2023-01-01T12:00:00Z',\n 'updatedAt' => '2023-01-02T12:00:00Z',\n 'archived' => false,\n ],\n [\n 'id' => '456',\n 'email' => 'invalid@example.com',\n 'type' => 'PERSON',\n 'createdAt' => 'invalid-date-format',\n ],\n [\n 'id' => '789',\n 'email' => 'another@example.com',\n 'type' => 'PERSON',\n 'firstName' => 'Jane',\n 'lastName' => 'Smith',\n 'userId' => 999,\n 'userIdIncludingInactive' => 888,\n 'createdAt' => '2023-01-03T12:00:00Z',\n 'updatedAt' => '2023-01-04T12:00:00Z',\n 'archived' => false,\n ],\n ],\n ];\n\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willReturn($responseData);\n\n $this->client->method('makeRequest')\n ->with(\n '/crm/v3/owners',\n 'GET',\n [],\n 'archived=false'\n )\n ->willReturn($response);\n\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with(\n '[HubSpot] Failed to process owner data',\n $this->callback(function ($context) {\n return isset($context['result']) &&\n isset($context['error']) &&\n $context['result']['id'] === '456' &&\n $context['result']['email'] === 'invalid@example.com' &&\n str_contains($context['error'], 'invalid-date-format');\n })\n );\n\n $reflection = new \\ReflectionClass($this->client);\n $loggerProperty = $reflection->getProperty('log');\n $loggerProperty->setAccessible(true);\n $loggerProperty->setValue($this->client, $loggerMock);\n\n $result = $this->client->getOwnersArchived(false);\n\n $this->assertIsArray($result);\n $this->assertCount(2, $result);\n $this->assertEquals('123', $result[0]->getId());\n $this->assertEquals('valid@example.com', $result[0]->getEmail());\n $this->assertEquals('789', $result[1]->getId());\n $this->assertEquals('another@example.com', $result[1]->getEmail());\n }\n\n public function testMakeRequestWithGetMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'success']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'GET',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n [],\n null,\n true\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'GET');\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithGetMethodAndQueryString(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'success']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'GET',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n [],\n 'limit=10&offset=0',\n true\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'GET', [], 'limit=10&offset=0');\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithPostMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $payload = [\n 'properties' => [\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n ],\n ];\n\n $psrResponse = new Response(200, [], json_encode(['id' => '12345']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'POST',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n ['json' => $payload]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'POST', $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithPutMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $payload = [\n 'properties' => [\n 'firstname' => 'Jane',\n ],\n ];\n\n $psrResponse = new Response(200, [], json_encode(['id' => '12345', 'updated' => true]));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'PUT',\n 'https://api.hubapi.com/crm/v3/objects/contacts/12345',\n ['json' => $payload]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts/12345', 'PUT', $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithPatchMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $payload = [\n 'properties' => [\n 'email' => 'newemail@example.com',\n ],\n ];\n\n $psrResponse = new Response(200, [], json_encode(['id' => '12345', 'patched' => true]));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'PATCH',\n 'https://api.hubapi.com/crm/v3/objects/contacts/12345',\n ['json' => $payload]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts/12345', 'PATCH', $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithDeleteMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['deleted' => true]));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'DELETE',\n 'https://api.hubapi.com/crm/v3/objects/contacts/12345',\n ['json' => []]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts/12345', 'DELETE');\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithEmptyPayload(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'ok']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'POST',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n ['json' => []]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'POST', []);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestPrependsBaseUrl(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'success']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n $this->anything(),\n 'https://api.hubapi.com/test/endpoint',\n $this->anything()\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $client->makeRequest('/test/endpoint', 'GET');\n }\n\n public function testGetOpportunitiesByIds(): void\n {\n $crmIds = ['deal1', 'deal2', 'deal3'];\n $fields = ['dealname', 'amount'];\n\n // Test basic functionality - method exists and returns array\n $this->assertTrue(method_exists($this->client, 'getOpportunitiesByIds'));\n }\n\n public function testGetCompaniesByIds(): void\n {\n $crmIds = ['company1', 'company2'];\n $fields = ['name', 'industry'];\n\n // Test basic functionality - method exists and returns array\n $this->assertTrue(method_exists($this->client, 'getCompaniesByIds'));\n }\n\n public function testGetContactsByIds(): void\n {\n $crmIds = ['contact1', 'contact2'];\n $fields = ['firstname', 'lastname'];\n\n // Test basic functionality - method exists and returns array\n $this->assertTrue(method_exists($this->client, 'getContactsByIds'));\n }\n\n public function testBatchReadObjectsEmptyIds(): void\n {\n $reflection = new \\ReflectionClass($this->client);\n $method = $reflection->getMethod('batchReadObjects');\n $method->setAccessible(true);\n\n $result = $method->invokeArgs($this->client, ['deals', [], ['dealname']]);\n\n $this->assertEquals([], $result);\n }\n\n public function testBatchReadObjectsExceedsBatchSize(): void\n {\n $crmIds = array_fill(0, 101, 'deal_id'); // 101 IDs, exceeds limit of 100\n\n $reflection = new \\ReflectionClass($this->client);\n $method = $reflection->getMethod('batchReadObjects');\n $method->setAccessible(true);\n\n $this->expectException(\\InvalidArgumentException::class);\n $this->expectExceptionMessage('Batch size cannot exceed 100 deals');\n\n $method->invokeArgs($this->client, ['deals', $crmIds, ['dealname']]);\n }\n\n public function testBatchReadObjectsUnsupportedObjectType(): void\n {\n $reflection = new \\ReflectionClass($this->client);\n $method = $reflection->getMethod('batchReadObjects');\n $method->setAccessible(true);\n\n $this->expectException(\\Jiminny\\Exceptions\\CrmException::class);\n $this->expectExceptionMessage('Failed to batch fetch unsupported');\n\n $method->invokeArgs($this->client, ['unsupported', ['id1'], ['field1']]);\n }\n\n public function testIsUnauthorizedExceptionWithBadRequest401(): void\n {\n $exception = new \\SevenShores\\Hubspot\\Exceptions\\BadRequest('Unauthorized', 401);\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithBadRequestNon401(): void\n {\n $exception = new \\SevenShores\\Hubspot\\Exceptions\\BadRequest('Bad Request', 400);\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertFalse($result);\n }\n\n public function testIsUnauthorizedExceptionWithGuzzleRequestException(): void\n {\n $response = new Response(401, [], 'Unauthorized');\n $exception = new \\GuzzleHttp\\Exception\\RequestException('Unauthorized', new \\GuzzleHttp\\Psr7\\Request('GET', 'test'), $response);\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithGuzzleClientException(): void\n {\n $exception = new \\GuzzleHttp\\Exception\\ClientException('Unauthorized', new \\GuzzleHttp\\Psr7\\Request('GET', 'test'), new Response(401));\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithStringMatching(): void\n {\n $exception = new \\Exception('HTTP 401 Unauthorized error occurred');\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithNonUnauthorized(): void\n {\n $exception = new \\Exception('Some other error');\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertFalse($result);\n }\n\n public function testEnsureValidTokenWithNullOauthAccount(): void\n {\n $reflection = new \\ReflectionClass($this->client);\n $oauthAccountProperty = $reflection->getProperty('oauthAccount');\n $oauthAccountProperty->setAccessible(true);\n $oauthAccountProperty->setValue($this->client, null);\n\n // Should not throw exception and not call token manager\n $this->tokenManagerMock->expects($this->never())->method('ensureValidToken');\n\n $this->client->ensureValidToken();\n\n $this->assertTrue(true); // Test passes if no exception is thrown\n }\n\n public function testGetConfig(): void\n {\n $result = $this->client->getConfig();\n\n $this->assertSame($this->config, $result);\n }\n\n public function testGetOwners(): void\n {\n // Test that the method exists and can be called\n $this->assertTrue(method_exists($this->client, 'getOwners'));\n\n // Since getOwners has complex HubSpot API dependencies,\n // we'll just verify the method exists for now\n $this->assertIsCallable([$this->client, 'getOwners']);\n }\n\n public function testCreateMeeting(): void\n {\n $payload = [\n 'properties' => [\n 'hs_meeting_title' => 'Test Meeting',\n 'hs_meeting_start_time' => '2024-01-01T10:00:00Z',\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['id' => 'meeting123']);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with('/crm/v3/objects/meetings', 'POST', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->createMeeting($payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testUpdateMeeting(): void\n {\n $meetingId = 'meeting123';\n $payload = [\n 'properties' => [\n 'hs_meeting_title' => 'Updated Meeting',\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['id' => $meetingId, 'updated' => true]);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with(\"/crm/v3/objects/meetings/{$meetingId}\", 'PATCH', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->updateMeeting($meetingId, $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testAddAssociations(): void\n {\n $objectType = 'deals';\n $associationType = 'contacts';\n $payload = [\n 'inputs' => [\n ['from' => ['id' => 'deal1'], 'to' => ['id' => 'contact1']],\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['status' => 'success']);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with(\"/crm/v4/associations/{$objectType}/{$associationType}/batch/create\", 'POST', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->addAssociations($objectType, $associationType, $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testRemoveAssociations(): void\n {\n $objectType = 'deals';\n $associationType = 'contacts';\n $payload = [\n 'inputs' => [\n ['from' => ['id' => 'deal1'], 'to' => ['id' => 'contact1']],\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['status' => 'success']);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with(\"/crm/v4/associations/{$objectType}/{$associationType}/batch/archive\", 'POST', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->removeAssociations($objectType, $associationType, $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n // -------------------------------------------------------------------------\n // search() / executeRequest() tests\n // -------------------------------------------------------------------------\n\n public function testSearchReturnsDecodedArrayOnSuccess(): void\n {\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn(null);\n\n $this->config->method('getId')->willReturn(42);\n\n $payload = ['filters' => []];\n $responseData = ['results' => [['id' => '1']], 'total' => 1, 'paging' => []];\n $hubspotResponse = new HubspotResponse(new Response(200, [], json_encode($responseData)));\n\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->with('POST', Client::BASE_URL . '/crm/v3/objects/contacts/search', ['json' => $payload])\n ->willReturn($hubspotResponse);\n\n $result = $this->client->search('contacts', $payload);\n\n $this->assertSame($responseData, $result);\n\n Mockery::close();\n }\n\n public function testSearchThrowsRateLimitExceptionWhenCircuitBreakerActive(): void\n {\n $futureTimestamp = (string) (time() + 30);\n\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn($futureTimestamp);\n\n $this->config->method('getId')->willReturn(42);\n\n $this->hubspotClientMock->expects($this->never())->method('request');\n\n $this->expectException(RateLimitException::class);\n $this->expectExceptionMessage('Hubspot rate limit (cached circuit-breaker)');\n\n try {\n $this->client->search('contacts', []);\n } finally {\n Mockery::close();\n }\n }\n\n public function testSearchThrowsRateLimitExceptionAndSetsNxOnFresh429(): void\n {\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn(null);\n // NX + TTL option array — exact TTL depends on parseRetryAfter, verified separately\n $redisMock->shouldReceive('set')\n ->once()\n ->with(\n 'hubspot:ratelimit:config:42',\n Mockery::type('string'),\n Mockery::on(fn ($opts) => is_array($opts) && in_array('nx', $opts, true))\n );\n\n $this->config->method('getId')->willReturn(42);\n\n $badRequest = new BadRequest('Rate limit exceeded', 429);\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->willThrowException($badRequest);\n\n $this->expectException(RateLimitException::class);\n $this->expectExceptionMessage('Hubspot returned 429');\n\n try {\n $this->client->search('contacts', []);\n } finally {\n Mockery::close();\n }\n }\n\n public function testSearchPropagatesNonRateLimitException(): void\n {\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn(null);\n\n $this->config->method('getId')->willReturn(42);\n\n $exception = new \\SevenShores\\Hubspot\\Exceptions\\HubspotException('Server error', 500);\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->willThrowException($exception);\n\n $this->expectException(\\SevenShores\\Hubspot\\Exceptions\\HubspotException::class);\n $this->expectExceptionMessage('Server error');\n\n try {\n $this->client->search('contacts', []);\n } finally {\n Mockery::close();\n }\n }\n\n public function testSearchCircuitBreakerRetryAfterComputedFromStoredTimestamp(): void\n {\n $remaining = 45;\n $futureTimestamp = (string) (time() + $remaining);\n\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn($futureTimestamp);\n\n $this->config->method('getId')->willReturn(1);\n\n try {\n $this->client->search('deals', []);\n $this->fail('Expected RateLimitException');\n } catch (RateLimitException $e) {\n $this->assertGreaterThanOrEqual(1, $e->getRetryAfter());\n $this->assertLessThanOrEqual($remaining, $e->getRetryAfter());\n } finally {\n Mockery::close();\n }\n }\n\n // -------------------------------------------------------------------------\n // isHubspotRateLimit() tests (private method — tested via reflection)\n // -------------------------------------------------------------------------\n\n private function callIsHubspotRateLimit(\\Throwable $e): bool\n {\n $method = new \\ReflectionMethod($this->client, 'isHubspotRateLimit');\n $method->setAccessible(true);\n\n return $method->invoke($this->client, $e);\n }\n\n public function testIsHubspotRateLimitReturnsTrueForBadRequest429(): void\n {\n $e = new BadRequest('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForDealApiException429(): void\n {\n $e = new DealApiException('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForContactApiException429(): void\n {\n $e = new ContactApiException('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForCompanyApiException429(): void\n {\n $e = new CompanyApiException('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForGuzzleRequestException429(): void\n {\n $request = new \\GuzzleHttp\\Psr7\\Request('POST', 'https://api.hubapi.com/test');\n $response = new \\GuzzleHttp\\Psr7\\Response(429);\n $e = new \\GuzzleHttp\\Exception\\RequestException('Too Many Requests', $request, $response);\n\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsFalseForBadRequestNon429(): void\n {\n $e = new BadRequest('Bad Request', 400);\n $this->assertFalse($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsFalseForGenericException(): void\n {\n $e = new \\RuntimeException('Something went wrong');\n $this->assertFalse($this->callIsHubspotRateLimit($e));\n }\n\n // -------------------------------------------------------------------------\n // parseRetryAfter() tests (private method — tested via reflection)\n // -------------------------------------------------------------------------\n\n private function callParseRetryAfter(\\Throwable $e): int\n {\n $method = new \\ReflectionMethod($this->client, 'parseRetryAfter');\n $method->setAccessible(true);\n\n return $method->invoke($this->client, $e);\n }\n\n public function testParseRetryAfterReadsRetryAfterHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['Retry-After' => ['30']]);\n $this->assertSame(30, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReadsLowercaseRetryAfterHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['retry-after' => ['15']]);\n $this->assertSame(15, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterHandlesScalarHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['Retry-After' => '60']);\n $this->assertSame(60, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsDailyLimitDelay(): void\n {\n $e = new BadRequest('Daily rate limit exceeded');\n $this->assertSame(600, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsTenSecondlyDelay(): void\n {\n $e = new BadRequest('Ten secondly rate limit exceeded');\n $this->assertSame(10, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsSecondlyDelay(): void\n {\n $e = new BadRequest('Secondly rate limit exceeded');\n $this->assertSame(1, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsDefaultWhenNoHint(): void\n {\n $e = new BadRequest('Rate limit exceeded');\n $this->assertSame(10, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterIgnoresNonNumericHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['Retry-After' => ['not-a-number']]);\n // Falls through to message parsing; \"Too Many Requests\" has no known keyword → default 10\n $this->assertSame(10, $this->callParseRetryAfter($e));\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Tests\\Unit\\Services\\Crm\\Hubspot;\n\nuse GuzzleHttp\\Psr7\\Response;\nuse HubSpot\\Client\\Crm\\Associations\\Api\\BatchApi;\nuse HubSpot\\Client\\Crm\\Associations\\Model\\BatchInputPublicObjectId;\nuse HubSpot\\Client\\Crm\\Associations\\Model\\BatchResponsePublicAssociationMulti;\nuse HubSpot\\Client\\Crm\\Associations\\Model\\PublicObjectId;\nuse HubSpot\\Client\\Crm\\Companies\\ApiException as CompanyApiException;\nuse HubSpot\\Client\\Crm\\Contacts\\ApiException as ContactApiException;\nuse HubSpot\\Client\\Crm\\Deals\\Api\\BasicApi as DealsBasicApi;\nuse HubSpot\\Client\\Crm\\Deals\\ApiException as DealApiException;\nuse HubSpot\\Client\\Crm\\Deals\\Model\\SimplePublicObjectWithAssociations as DealWithAssociations;\nuse HubSpot\\Client\\Crm\\Pipelines\\Api\\PipelinesApi;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\CollectionResponsePipeline;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\Error;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\Pipeline;\nuse HubSpot\\Client\\Crm\\Pipelines\\Model\\PipelineStage;\nuse HubSpot\\Client\\Crm\\Properties\\Api\\CoreApi;\nuse HubSpot\\Client\\Crm\\Properties\\Model\\Property;\nuse HubSpot\\Discovery as HubSpotDiscovery;\nuse HubSpot\\Discovery\\Crm\\Deals\\Discovery as DealsDiscovery;\nuse Jiminny\\Exceptions\\RateLimitException;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Services\\Crm\\Hubspot\\Client;\nuse Jiminny\\Services\\Crm\\Hubspot\\HubspotTokenManager;\nuse Jiminny\\Services\\Crm\\Hubspot\\Pagination\\HubspotPaginationService;\nuse Jiminny\\Services\\SocialAccountService;\nuse League\\OAuth2\\Client\\Token\\AccessToken;\nuse Mockery;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Log\\NullLogger;\nuse SevenShores\\Hubspot\\Endpoints\\Engagements;\nuse SevenShores\\Hubspot\\Exceptions\\BadRequest;\nuse SevenShores\\Hubspot\\Factory;\nuse SevenShores\\Hubspot\\Http\\Client as HubspotClient;\nuse SevenShores\\Hubspot\\Http\\Response as HubspotResponse;\n\n/**\n * @runTestsInSeparateProcesses\n *\n * @preserveGlobalState disabled\n */\nclass ClientTest extends TestCase\n{\n private const string RESPONSE_TYPE_STAGE_FIELD = 'stage';\n private const string RESPONSE_TYPE_PIPELINE_FIELD = 'pipeline';\n private const string RESPONSE_TYPE_REGULAR_FIELD = 'regular';\n /**\n * @var Client&MockObject\n */\n private Client $client;\n private Configuration $config;\n\n /**\n * @var SocialAccountService&MockObject\n */\n private SocialAccountService $socialAccountServiceMock;\n\n /**\n * @var HubspotPaginationService&MockObject\n */\n private HubspotPaginationService $paginationServiceMock;\n\n /**\n * @var HubspotTokenManager&MockObject\n */\n private HubspotTokenManager $tokenManagerMock;\n\n /**\n * @var CoreApi&MockObject\n */\n private CoreApi $coreApiMock;\n\n /**\n * @var PipelinesApi&MockObject\n */\n private PipelinesApi $pipelinesApiMock;\n\n /**\n * @var BatchApi&MockObject\n */\n private BatchApi $associationsBatchApiMock;\n\n /**\n * @var DealsBasicApi&MockObject\n */\n private DealsBasicApi $dealsBasicApiMock;\n\n /**\n * @var Engagements&MockObject\n */\n private $engagementsMock;\n\n /**\n * @var HubspotClient&MockObject\n */\n private HubspotClient $hubspotClientMock;\n\n protected function setUp(): void\n {\n // Create mocks for dependencies\n $this->socialAccountServiceMock = $this->createMock(SocialAccountService::class);\n $this->paginationServiceMock = $this->createMock(HubspotPaginationService::class);\n $this->tokenManagerMock = $this->createMock(HubspotTokenManager::class);\n\n // Create a real Client instance with mocked dependencies\n // Create a partial mock only for the methods we need to mock\n $client = $this->createPartialMock(Client::class, ['getInstance', 'getNewInstance', 'makeRequest']);\n $client->setLogger(new NullLogger());\n\n // Inject the real dependencies using reflection\n $reflection = new \\ReflectionClass(Client::class);\n\n $accountServiceProperty = $reflection->getProperty('accountService');\n $accountServiceProperty->setAccessible(true);\n $accountServiceProperty->setValue($client, $this->socialAccountServiceMock);\n\n $paginationServiceProperty = $reflection->getProperty('paginationService');\n $paginationServiceProperty->setAccessible(true);\n $paginationServiceProperty->setValue($client, $this->paginationServiceMock);\n\n $tokenManagerProperty = $reflection->getProperty('tokenManager');\n $tokenManagerProperty->setAccessible(true);\n $tokenManagerProperty->setValue($client, $this->tokenManagerMock);\n $factoryMock = $this->createMock(Factory::class);\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $engagementsMock = $this->createMock(\\SevenShores\\Hubspot\\Endpoints\\Engagements::class);\n\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n $factoryMock->method('__call')->with('engagements')->willReturn($engagementsMock);\n\n $client->method('getInstance')->willReturn($factoryMock);\n\n $discoveryMock = $this->createMock(HubSpotDiscovery\\Discovery::class);\n $crmMock = $this->createMock(HubSpotDiscovery\\Crm\\Discovery::class);\n $associationsMock = $this->createMock(HubSpotDiscovery\\Crm\\Associations\\Discovery::class);\n $propertiesMock = $this->createMock(HubSpotDiscovery\\Crm\\Properties\\Discovery::class);\n $pipelinesMock = $this->createMock(HubSpotDiscovery\\Crm\\Pipelines\\Discovery::class);\n $coreApiMock = $this->createMock(CoreApi::class);\n $pipelinesApiMock = $this->createMock(PipelinesApi::class);\n $associationsBatchApiMock = $this->createMock(BatchApi::class);\n $dealsBasicApiMock = $this->createMock(DealsBasicApi::class);\n\n $propertiesMock->method('__call')->with('coreApi')->willReturn($coreApiMock);\n $pipelinesMock->method('__call')->with('pipelinesApi')->willReturn($pipelinesApiMock);\n $associationsMock->method('__call')->with('batchApi')->willReturn($associationsBatchApiMock);\n $dealsDiscoveryMock = $this->createMock(DealsDiscovery::class);\n $dealsDiscoveryMock->method('__call')->with('basicApi')->willReturn($dealsBasicApiMock);\n\n $returnMap = ['properties' => $propertiesMock, 'pipelines' => $pipelinesMock, 'associations' => $associationsMock, 'deals' => $dealsDiscoveryMock];\n $crmMock->method('__call')\n ->willReturnCallback(static fn (string $name) => $returnMap[$name])\n ;\n\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n\n $this->client = $client;\n $this->config = $this->createMock(Configuration::class);\n $this->client->setConfiguration($this->config);\n $this->coreApiMock = $coreApiMock;\n $this->pipelinesApiMock = $pipelinesApiMock;\n $this->associationsBatchApiMock = $associationsBatchApiMock;\n $this->dealsBasicApiMock = $dealsBasicApiMock;\n $this->engagementsMock = $engagementsMock;\n $this->hubspotClientMock = $hubspotClientMock;\n }\n\n public function testGetMinimumApiVersion(): void\n {\n $this->assertIsString($this->client->getMinimumApiVersion());\n }\n\n public function testGetInstance(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $client = new Client($socialAccountService, $paginationService, $tokenManager);\n $client->setBaseUrl('https://example.com');\n $client->setAccessToken(new AccessToken(['access_token' => 'foo']));\n $factory = $client->getInstance();\n\n $this->assertEquals('foo', $factory->getClient()->key);\n }\n\n public function testGetNewInstance(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $client = new Client($socialAccountService, $paginationService, $tokenManager);\n $client->setAccessToken(new AccessToken(['access_token' => 'foo']));\n\n $factory = $client->getNewInstance();\n $token = $factory->auth()->oAuth()->accessTokensApi()->getConfig()->getAccessToken();\n $this->assertEquals('foo', $token);\n }\n\n public function testFetchProperty(): void\n {\n $this->coreApiMock->method('getByName')->willReturn($this->generateProperty());\n\n $this->assertEquals(\n 'some_property',\n $this->client->fetchProperty('foo', 'test')['name']\n );\n }\n\n public function testFetchPropertyOptions(): void\n {\n $this->coreApiMock->method('getByName')->willReturn($this->generateProperty());\n\n $this->assertEquals(\n [\n [\n 'label' => 'label_1',\n 'value' => 'value_1',\n ],\n [\n 'label' => 'label_2',\n 'value' => 'value_2',\n ],\n ],\n $this->client->fetchPropertyOptions('foo', 'test')\n );\n }\n\n public function testFetchCallDispositions(): void\n {\n $this->engagementsMock\n ->method('getCallDispositions')\n ->willReturn($this->generateHubSpotResponse([\n [\n 'id' => 1,\n 'label' => 'foo',\n 'deleted' => false,\n ],\n [\n 'id' => 2,\n 'label' => 'bar',\n 'deleted' => false,\n ],\n ]))\n ;\n\n $this->assertEquals(\n [\n [\n 'id' => 1,\n 'label' => 'foo',\n 'deleted' => false,\n ],\n [\n 'id' => 2,\n 'label' => 'bar',\n 'deleted' => false,\n ],\n ],\n $this->client->fetchCallDispositions()\n );\n }\n\n public function testFetchDispositionFieldOptions(): void\n {\n $this->engagementsMock->method('getCallDispositions')\n ->willReturn($this->generateHubSpotResponse(\n [\n [\n 'id' => 1,\n 'label' => 'Label 1',\n 'deleted' => false,\n ],\n [\n 'id' => 2,\n 'label' => 'Label 2',\n 'deleted' => true,\n ],\n ]\n ))\n ;\n\n $this->assertEquals(\n [\n [\n 'value' => 1,\n 'id' => 1,\n 'label' => 'Label 1',\n ],\n ],\n $this->client->fetchDispositionFieldOptions()\n );\n }\n\n public function testFetchOpportunityPipelineStages(): void\n {\n /**\n * @TODO: The class CollectionResponsePipeline will be deprecated in the next Hubspot version\n */\n $this->pipelinesApiMock\n ->method('getAll')\n ->with('deals')\n ->willReturn(new CollectionResponsePipeline([\n 'results' => [$this->generatePipeline()],\n ]))\n ;\n\n $this->assertEquals(\n [\n ['id' => 'foo', 'label' => 'bar'],\n ['id' => 'baz', 'label' => 'qux'],\n ],\n $this->client->fetchOpportunityPipelineStages()\n );\n }\n\n public function testFetchOpportunityPipelineStagesErrorResponse(): void\n {\n $this->pipelinesApiMock\n ->method('getAll')\n ->with('deals')\n ->willReturn(new Error(['message' => 'test error']))\n ;\n\n $this->assertEmpty($this->client->fetchOpportunityPipelineStages());\n }\n\n #[\\PHPUnit\\Framework\\Attributes\\DataProvider('meetingOutcomeFieldProvider')]\n public function testFetchMeetingOutcomeFieldOptions(string $fieldId, string $expectedEndpoint): void\n {\n $field = new Field(['crm_provider_id' => $fieldId]);\n\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->with('GET', $expectedEndpoint)\n ->willReturn($this->generateHubSpotResponse(\n [\n 'options' => [\n ['value' => 'option_1', 'label' => 'Option 1', 'displayOrder' => 0],\n ['value' => 'option_2', 'label' => 'Option 2', 'displayOrder' => 1],\n ['value' => 'option_3', 'label' => 'Option 3', 'displayOrder' => 2],\n ],\n ]\n ))\n ;\n\n $this->assertEquals(\n [\n ['id' => 'option_1', 'value' => 'option_1', 'label' => 'Option 1', 'display_order' => 0],\n ['id' => 'option_2', 'value' => 'option_2', 'label' => 'Option 2', 'display_order' => 1],\n ['id' => 'option_3', 'value' => 'option_3', 'label' => 'Option 3', 'display_order' => 2],\n ],\n $this->client->fetchMeetingOutcomeFieldOptions($field)\n );\n }\n\n public static function meetingOutcomeFieldProvider(): array\n {\n return [\n 'meeting outcome field' => [\n 'meetingOutcome',\n 'https://api.hubapi.com/crm/v3/properties/meeting/hs_meeting_outcome',\n ],\n 'activity type field' => [\n 'foobar',\n 'https://api.hubapi.com/crm/v3/properties/call/hs_activity_type',\n ],\n ];\n }\n\n #[\\PHPUnit\\Framework\\Attributes\\DataProvider('opportunityFieldOptionsProvider')]\n public function testFetchOpportunityFieldOptions(Field $field, string $type): void\n {\n $responses = [\n self::RESPONSE_TYPE_STAGE_FIELD => [\n ['id' => 'foo', 'label' => 'bar'],\n ['id' => 'baz', 'label' => 'qux'],\n ],\n self::RESPONSE_TYPE_PIPELINE_FIELD => [\n ['id' => '123', 'label' => 'Sales'],\n ['id' => 'default', 'label' => 'CS'],\n ],\n self::RESPONSE_TYPE_REGULAR_FIELD => [\n [\n 'label' => 'label_1',\n 'value' => 'value_1',\n ],\n [\n 'label' => 'label_2',\n 'value' => 'value_2',\n ],\n ],\n ];\n\n $field = $this->createMock(Field::class);\n\n if ($type === self::RESPONSE_TYPE_REGULAR_FIELD) {\n $field->method('isStageField')->willReturn(false);\n $field->method('isPipelineField')->willReturn(false);\n $propertyResponse = $this->generateProperty();\n $this->coreApiMock->method('getByName')->willReturn($propertyResponse);\n }\n\n if ($type === self::RESPONSE_TYPE_STAGE_FIELD) {\n $field->method('isStageField')->willReturn(true);\n /**\n * @TODO: The class CollectionResponsePipeline will be deprecated in the next Hubspot version\n */\n\n $pipelineStagesResponse = new CollectionResponsePipeline([\n 'results' => [$this->generatePipeline()],\n ]);\n $this->pipelinesApiMock\n ->method('getAll')\n ->willReturn($pipelineStagesResponse);\n }\n\n if ($type === self::RESPONSE_TYPE_PIPELINE_FIELD) {\n $field->method('isStageField')->willReturn(false);\n $field->method('isPipelineField')->willReturn(true);\n $pipelineResponse = $this->generateHubSpotResponse([\n 'results' => [\n ['id' => '123', 'label' => 'Sales'],\n ['id' => 'default', 'label' => 'CS'],\n ],\n ]);\n $this->client\n ->method('makeRequest')\n ->with('/crm/v3/pipelines/deals')\n ->willReturn($pipelineResponse);\n }\n\n $this->assertEquals(\n $responses[$type],\n $this->client->fetchOpportunityFieldOptions($field)\n );\n }\n\n public static function opportunityFieldOptionsProvider(): array\n {\n return [\n 'stage field' => [\n 'field' => new Field(['crm_provider_id' => 'dealstage']),\n 'type' => self::RESPONSE_TYPE_STAGE_FIELD,\n ],\n 'pipeline field' => [\n 'field' => new Field(['crm_provider_id' => 'pipeline']),\n 'type' => self::RESPONSE_TYPE_PIPELINE_FIELD,\n ],\n 'regular field' => [\n 'field' => new Field(['crm_provider_id' => 'some_property']),\n 'type' => self::RESPONSE_TYPE_REGULAR_FIELD,\n ],\n ];\n }\n\n private function generateHubSpotResponse(array $data): HubspotResponse\n {\n return new HubspotResponse(new Response(200, [], json_encode($data)));\n }\n\n private function generateProperty(): Property\n {\n return new Property([\n 'name' => 'some_property',\n 'options' => [\n [\n 'label' => 'label_1',\n 'value' => 'value_1',\n ],\n [\n 'label' => 'label_2',\n 'value' => 'value_2',\n ],\n ],\n ]);\n }\n\n private function generatePipeline(): Pipeline\n {\n return new Pipeline(['stages' => [\n new PipelineStage(['id' => 'foo', 'label' => 'bar']),\n new PipelineStage(['id' => 'baz', 'label' => 'qux']),\n ]]);\n }\n\n public function testFetchOpportunityPipelines(): void\n {\n $this->client\n ->method('makeRequest')\n ->with('/crm/v3/pipelines/deals')\n ->willReturn($this->generateHubSpotResponse([\n 'results' => [\n ['id' => 'id_1', 'label' => 'Option 1', 'displayOrder' => 0],\n ['id' => 'id_2', 'label' => 'Option 2', 'displayOrder' => 1],\n ['id' => 'id_3', 'label' => 'Option 3', 'displayOrder' => 2],\n ],\n ]));\n\n $this->assertEquals(\n [\n ['id' => 'id_1', 'label' => 'Option 1'],\n ['id' => 'id_2', 'label' => 'Option 2'],\n ['id' => 'id_3', 'label' => 'Option 3'],\n ],\n $this->client->fetchOpportunityPipelines()\n );\n }\n\n public function testGetPaginatedData(): void\n {\n $expectedResults = [\n ['id' => 'id_1', 'properties' => []],\n ['id' => 'id_2', 'properties' => []],\n ['id' => 'id_3', 'properties' => []],\n ];\n\n // Mock the pagination service to return a generator and modify reference parameters\n $this->paginationServiceMock\n ->expects($this->once())\n ->method('getPaginatedDataGenerator')\n ->with(\n $this->client,\n ['payload_key' => 'payload_value'],\n 'foobar',\n 0,\n $this->anything(),\n $this->anything()\n )\n ->willReturnCallback(function ($client, $payload, $type, $offset, &$total, &$lastRecordId) use ($expectedResults) {\n $total = 3;\n $lastRecordId = 'id_3';\n foreach ($expectedResults as $result) {\n yield $result;\n }\n });\n\n $this->assertEquals(\n [\n 'results' => $expectedResults,\n 'total' => 3,\n 'last_record' => 'id_3',\n ],\n $this->client->getPaginatedData(['payload_key' => 'payload_value'], 'foobar')\n );\n }\n\n public function testGetAssociationsData(): void\n {\n $ids = ['1', '2', '3'];\n $fromObject = 'deals';\n $toObject = 'contacts';\n\n $responseResults = [];\n foreach ($ids as $id) {\n $from = new PublicObjectId();\n $from->setId($id);\n\n $to1 = new PublicObjectId();\n $to1->setId('contact_' . $id . '_1');\n $to2 = new PublicObjectId();\n $to2->setId('contact_' . $id . '_2');\n\n $result = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicAssociationMulti();\n $result->setFrom($from);\n $result->setTo([$to1, $to2]);\n\n $responseResults[] = $result;\n }\n\n $batchResponse = new BatchResponsePublicAssociationMulti();\n $batchResponse->setResults($responseResults);\n\n $this->associationsBatchApiMock->expects($this->once())\n ->method('read')\n ->with(\n $this->equalTo($fromObject),\n $this->equalTo($toObject),\n $this->callback(function (BatchInputPublicObjectId $batchInput) use ($ids) {\n $inputIds = array_map(\n fn ($input) => $input->getId(),\n $batchInput->getInputs()\n );\n\n return $inputIds === $ids;\n })\n )\n ->willReturn($batchResponse);\n\n $result = $this->client->getAssociationsData($ids, $fromObject, $toObject);\n\n $expectedResult = [\n '1' => ['contact_1_1', 'contact_1_2'],\n '2' => ['contact_2_1', 'contact_2_2'],\n '3' => ['contact_3_1', 'contact_3_2'],\n ];\n\n $this->assertEquals($expectedResult, $result);\n }\n\n public function testGetAssociationsDataHandlesException(): void\n {\n $ids = ['1', '2', '3'];\n $fromObject = 'deals';\n $toObject = 'contacts';\n\n $exception = new \\Exception('API Error');\n\n $this->associationsBatchApiMock->expects($this->once())\n ->method('read')\n ->with(\n $this->equalTo($fromObject),\n $this->equalTo($toObject),\n $this->callback(function ($batchInput) use ($ids) {\n return $batchInput instanceof \\HubSpot\\Client\\Crm\\Associations\\Model\\BatchInputPublicObjectId\n && count($batchInput->getInputs()) === count($ids);\n })\n )\n ->willThrowException($exception);\n\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with(\n '[Hubspot] Failed to fetch associations',\n [\n 'from_object' => $fromObject,\n 'to_object' => $toObject,\n 'reason' => 'API Error',\n ]\n );\n\n $this->client->setLogger($loggerMock);\n\n $result = $this->client->getAssociationsData($ids, $fromObject, $toObject);\n\n $this->assertEmpty($result);\n $this->assertIsArray($result);\n }\n\n public function testGetAssociationsDataWithLargeDataSet(): void\n {\n $ids = array_map(fn ($i) => (string) $i, range(1, 2500)); // More than 1000 items\n $fromObject = 'deals';\n $toObject = 'contacts';\n\n $firstBatchResponse = new BatchResponsePublicAssociationMulti();\n $firstBatchResults = array_map(function ($id) {\n $from = new PublicObjectId();\n $from->setId($id);\n $to = new PublicObjectId();\n $to->setId('contact_' . $id);\n $result = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicAssociationMulti();\n $result->setFrom($from);\n $result->setTo([$to]);\n\n return $result;\n }, array_slice($ids, 0, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));\n $firstBatchResponse->setResults($firstBatchResults);\n\n $secondBatchResponse = new BatchResponsePublicAssociationMulti();\n $secondBatchResults = array_map(function ($id) {\n $from = new PublicObjectId();\n $from->setId($id);\n $to = new PublicObjectId();\n $to->setId('contact_' . $id);\n $result = new \\HubSpot\\Client\\Crm\\Associations\\Model\\PublicAssociationMulti();\n $result->setFrom($from);\n $result->setTo([$to]);\n\n return $result;\n }, array_slice($ids, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));\n $secondBatchResponse->setResults($secondBatchResults);\n\n $this->associationsBatchApiMock->expects($this->exactly(3))\n ->method('read')\n ->willReturnOnConsecutiveCalls($firstBatchResponse, $secondBatchResponse);\n\n $result = $this->client->getAssociationsData($ids, $fromObject, $toObject);\n\n $this->assertCount(2500, $result);\n $this->assertArrayHasKey('1', $result);\n $this->assertArrayHasKey('2500', $result);\n $this->assertEquals(['contact_1'], $result['1']);\n $this->assertEquals(['contact_2500'], $result['2500']);\n }\n\n public function testGetContactByEmailSuccess(): void\n {\n $email = 'test@example.com';\n $fields = ['firstname', 'lastname', 'email'];\n\n $contactMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations::class);\n $contactMock->method('getId')->willReturn('12345');\n $contactMock->method('getProperties')->willReturn([\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n 'email' => 'test@example.com',\n ]);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($email, 'firstname,lastname,email', null, false, 'email')\n ->willReturn($contactMock);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new NullLogger());\n\n $result = $client->getContactByEmail($email, $fields);\n\n $this->assertEquals([\n 'id' => '12345',\n 'properties' => [\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n 'email' => 'test@example.com',\n ],\n ], $result);\n }\n\n public function testGetContactByEmailWithEmptyFields(): void\n {\n $email = 'test@example.com';\n $fields = [];\n\n $contactMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations::class);\n $contactMock->method('getId')->willReturn('12345');\n $contactMock->method('getProperties')->willReturn(['email' => 'test@example.com']);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($email, '', null, false, 'email')\n ->willReturn($contactMock);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new NullLogger());\n\n $result = $client->getContactByEmail($email, $fields);\n\n $this->assertEquals([\n 'id' => '12345',\n 'properties' => ['email' => 'test@example.com'],\n ], $result);\n }\n\n public function testGetContactByEmailApiException(): void\n {\n $email = 'nonexistent@example.com';\n $fields = ['firstname', 'lastname'];\n\n $exception = new \\HubSpot\\Client\\Crm\\Contacts\\ApiException('Contact not found', 404);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($email, 'firstname,lastname', null, false, 'email')\n ->willThrowException($exception);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('info')\n ->with(\n '[Hubspot] Failed to fetch contact',\n [\n 'email' => $email,\n 'reason' => 'Contact not found',\n ]\n );\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger($loggerMock);\n\n $result = $client->getContactByEmail($email, $fields);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetOpportunityById(): void\n {\n $opportunityId = '12345';\n $expectedProperties = [\n 'dealname' => 'Test Opportunity',\n 'amount' => '1000.00',\n 'closedate' => '2024-12-31T23:59:59.999Z',\n 'dealstage' => 'presentationscheduled',\n 'pipeline' => 'default',\n ];\n\n $mockHubspotOpportunity = $this->createMock(DealWithAssociations::class);\n $mockHubspotOpportunity->method('getProperties')->willReturn((object) $expectedProperties);\n $mockHubspotOpportunity->method('getId')->willReturn($opportunityId);\n $now = new \\DateTimeImmutable();\n $mockHubspotOpportunity->method('getCreatedAt')->willReturn($now);\n $mockHubspotOpportunity->method('getUpdatedAt')->willReturn($now);\n $mockHubspotOpportunity->method('getArchived')->willReturn(false);\n\n $this->dealsBasicApiMock\n ->expects($this->once())\n ->method('getById')\n ->willReturn($mockHubspotOpportunity);\n\n // Assuming Client::getOpportunityById processes the SimplePublicObject and returns an associative array.\n // The structure might be like: ['id' => ..., 'properties' => [...], 'createdAt' => ..., ...]\n // Adjust assertions below based on the actual return structure of your method.\n $result = $this->client->getOpportunityById($opportunityId, ['test', 'test']);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('id', $result);\n $this->assertEquals($opportunityId, $result['id']);\n }\n\n public function testGetContactById(): void\n {\n $crmId = 'contact-123';\n $fields = ['firstname', 'lastname'];\n $expectedProperties = ['firstname' => 'John', 'lastname' => 'Doe'];\n\n $mockContact = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Model\\SimplePublicObjectWithAssociations::class);\n $mockContact->method('getId')->willReturn($crmId);\n $mockContact->method('getProperties')->willReturn((object) $expectedProperties);\n\n $contactsApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Contacts\\Api\\BasicApi::class);\n $contactsApiMock->expects($this->once())\n ->method('getById')\n ->with($crmId, 'firstname,lastname')\n ->willReturn($mockContact);\n\n $contactsDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Contacts\\Discovery::class);\n $contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {\n if ($name === 'contacts') {\n return $contactsDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new \\Psr\\Log\\NullLogger());\n\n $result = $client->getContactById($crmId, $fields);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('id', $result);\n $this->assertArrayHasKey('properties', $result);\n $this->assertEquals($crmId, $result['id']);\n $this->assertEquals((object) $expectedProperties, $result['properties']);\n }\n\n public function testGetAccountById(): void\n {\n $crmId = 'account-123';\n $fields = ['name', 'industry'];\n $expectedProperties = ['name' => 'Acme Corp', 'industry' => 'Technology'];\n\n $mockCompany = $this->createMock(\\HubSpot\\Client\\Crm\\Companies\\Model\\SimplePublicObjectWithAssociations::class);\n $mockCompany->method('getId')->willReturn($crmId);\n $mockCompany->method('getProperties')->willReturn((object) $expectedProperties);\n\n $companiesApiMock = $this->createMock(\\HubSpot\\Client\\Crm\\Companies\\Api\\BasicApi::class);\n $companiesApiMock->expects($this->once())\n ->method('getById')\n ->with($crmId, 'name,industry')\n ->willReturn($mockCompany);\n\n $companiesDiscoveryMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Companies\\Discovery::class);\n $companiesDiscoveryMock->method('__call')->with('basicApi')->willReturn($companiesApiMock);\n\n $crmMock = $this->createMock(\\HubSpot\\Discovery\\Crm\\Discovery::class);\n $crmMock->method('__call')->willReturnCallback(function ($name) use ($companiesDiscoveryMock) {\n if ($name === 'companies') {\n return $companiesDiscoveryMock;\n }\n\n return $this->createMock(\\HubSpot\\Discovery\\Crm\\Properties\\Discovery::class);\n });\n\n $discoveryMock = $this->createMock(\\HubSpot\\Discovery\\Discovery::class);\n $discoveryMock->method('__call')->with('crm')->willReturn($crmMock);\n\n $client = $this->createPartialMock(Client::class, ['getNewInstance']);\n $client->method('getNewInstance')->willReturn($discoveryMock);\n $client->setLogger(new \\Psr\\Log\\NullLogger());\n\n $result = $client->getAccountById($crmId, $fields);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('id', $result);\n $this->assertArrayHasKey('properties', $result);\n $this->assertEquals($crmId, $result['id']);\n $this->assertEquals((object) $expectedProperties, $result['properties']);\n }\n\n public function testEnsureValidTokenWithNoTokenUpdate(): void\n {\n $socialAccountMock = $this->createMock(SocialAccount::class);\n\n // Set up OAuth account\n $reflection = new \\ReflectionClass($this->client);\n $oauthAccountProperty = $reflection->getProperty('oauthAccount');\n $oauthAccountProperty->setAccessible(true);\n $oauthAccountProperty->setValue($this->client, $socialAccountMock);\n\n $originalToken = 'original_token';\n $accessTokenProperty = $reflection->getProperty('accessToken');\n $accessTokenProperty->setAccessible(true);\n $accessTokenProperty->setValue($this->client, $originalToken);\n\n // Mock token manager to return null (no refresh needed)\n $this->tokenManagerMock\n ->expects($this->once())\n ->method('ensureValidToken')\n ->with($socialAccountMock)\n ->willReturn(null);\n\n // Call ensureValidToken\n $this->client->ensureValidToken();\n\n // Verify access token was not changed\n $this->assertEquals($originalToken, $accessTokenProperty->getValue($this->client));\n }\n\n\n\n\n\n\n public function testGetPaginatedDataGeneratorDelegatesToPaginationService(): void\n {\n $payload = ['filters' => []];\n $type = 'contacts';\n $offset = 0;\n $total = 0;\n $lastRecordId = null;\n\n $expectedResults = [\n ['id' => 'id_1', 'properties' => []],\n ['id' => 'id_2', 'properties' => []],\n ];\n\n // Mock the pagination service to return a generator\n $this->paginationServiceMock\n ->expects($this->once())\n ->method('getPaginatedDataGenerator')\n ->with(\n $this->client,\n $payload,\n $type,\n $offset,\n $this->anything(),\n $this->anything()\n )\n ->willReturnCallback(function () use ($expectedResults) {\n foreach ($expectedResults as $result) {\n yield $result;\n }\n });\n\n // Execute the pagination\n $results = [];\n foreach ($this->client->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastRecordId) as $result) {\n $results[] = $result;\n }\n\n $this->assertCount(2, $results);\n $this->assertEquals('id_1', $results[0]['id']);\n $this->assertEquals('id_2', $results[1]['id']);\n }\n\n public function testEnsureValidTokenDelegatesToTokenManager(): void\n {\n $socialAccountMock = $this->createMock(SocialAccount::class);\n\n // Set up OAuth account\n $reflection = new \\ReflectionClass($this->client);\n $oauthAccountProperty = $reflection->getProperty('oauthAccount');\n $oauthAccountProperty->setAccessible(true);\n $oauthAccountProperty->setValue($this->client, $socialAccountMock);\n\n // Mock token manager to return new token\n $this->tokenManagerMock\n ->expects($this->once())\n ->method('ensureValidToken')\n ->with($socialAccountMock)\n ->willReturn('new_access_token');\n\n // Call ensureValidToken\n $this->client->ensureValidToken();\n\n // Verify access token was updated\n $accessTokenProperty = $reflection->getProperty('accessToken');\n $accessTokenProperty->setAccessible(true);\n $this->assertEquals('new_access_token', $accessTokenProperty->getValue($this->client));\n }\n\n public function testGetOwnersArchivedWithValidResponse(): void\n {\n $responseData = [\n 'results' => [\n [\n 'id' => '123',\n 'email' => 'owner1@example.com',\n 'type' => 'PERSON',\n 'firstName' => 'John',\n 'lastName' => 'Doe',\n 'userId' => 456,\n 'userIdIncludingInactive' => 789,\n 'createdAt' => '2023-01-01T12:00:00Z',\n 'updatedAt' => '2023-01-02T12:00:00Z',\n 'archived' => true,\n ],\n ],\n ];\n\n // Create a mock response object\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willReturn($responseData);\n\n // Set up the client to return our test data\n $this->client->method('makeRequest')\n ->with(\n '/crm/v3/owners',\n 'GET',\n [],\n 'archived=true'\n )\n ->willReturn($response);\n\n // Call the method\n $result = $this->client->getOwnersArchived(true);\n\n // Assert the results\n $this->assertCount(1, $result);\n $this->assertEquals('123', $result[0]->getId());\n $this->assertEquals('owner1@example.com', $result[0]->getEmail());\n $this->assertEquals('John Doe', $result[0]->getFullName());\n $this->assertTrue($result[0]->isArchived());\n }\n\n public function testGetOwnersArchivedWithEmptyResponse(): void\n {\n // Create a mock response object with empty results\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willReturn(['results' => []]);\n\n // Set up the client to return empty results\n $this->client->method('makeRequest')\n ->with(\n '/crm/v3/owners',\n 'GET',\n [],\n 'archived=false'\n )\n ->willReturn($response);\n\n // Call the method\n $result = $this->client->getOwnersArchived(false);\n\n // Assert the results\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testGetOwnersArchivedWithInvalidResponse(): void\n {\n // Create a mock response that will throw an exception when toArray is called\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willThrowException(new \\InvalidArgumentException('Invalid JSON'));\n\n // Set up the client to return the problematic response\n $this->client->method('makeRequest')\n ->willReturn($response);\n\n // Mock the logger to expect an error message\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with($this->stringContains('Failed to fetch owners'));\n\n $reflection = new \\ReflectionClass($this->client);\n $loggerProperty = $reflection->getProperty('log');\n $loggerProperty->setAccessible(true);\n $loggerProperty->setValue($this->client, $loggerMock);\n\n // Call the method and expect an empty array on error\n $result = $this->client->getOwnersArchived(true);\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testGetOwnersArchivedWithHttpError(): void\n {\n // Set up the client to throw an exception\n $this->client->method('makeRequest')\n ->willThrowException(new \\Exception('HTTP Error'));\n\n // Mock the logger to expect an error message\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with($this->stringContains('Failed to fetch owners'));\n\n $reflection = new \\ReflectionClass($this->client);\n $loggerProperty = $reflection->getProperty('log');\n $loggerProperty->setAccessible(true);\n $loggerProperty->setValue($this->client, $loggerMock);\n\n // Call the method and expect an empty array on error\n $result = $this->client->getOwnersArchived(false);\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testGetOwnersArchivedWithOwnerCreationException(): void\n {\n $responseData = [\n 'results' => [\n [\n 'id' => '123',\n 'email' => 'valid@example.com',\n 'type' => 'PERSON',\n 'firstName' => 'John',\n 'lastName' => 'Doe',\n 'userId' => 456,\n 'userIdIncludingInactive' => 789,\n 'createdAt' => '2023-01-01T12:00:00Z',\n 'updatedAt' => '2023-01-02T12:00:00Z',\n 'archived' => false,\n ],\n [\n 'id' => '456',\n 'email' => 'invalid@example.com',\n 'type' => 'PERSON',\n 'createdAt' => 'invalid-date-format',\n ],\n [\n 'id' => '789',\n 'email' => 'another@example.com',\n 'type' => 'PERSON',\n 'firstName' => 'Jane',\n 'lastName' => 'Smith',\n 'userId' => 999,\n 'userIdIncludingInactive' => 888,\n 'createdAt' => '2023-01-03T12:00:00Z',\n 'updatedAt' => '2023-01-04T12:00:00Z',\n 'archived' => false,\n ],\n ],\n ];\n\n $response = $this->createMock(\\SevenShores\\Hubspot\\Http\\Response::class);\n $response->method('toArray')\n ->willReturn($responseData);\n\n $this->client->method('makeRequest')\n ->with(\n '/crm/v3/owners',\n 'GET',\n [],\n 'archived=false'\n )\n ->willReturn($response);\n\n $loggerMock = $this->createMock(\\Psr\\Log\\LoggerInterface::class);\n $loggerMock->expects($this->once())\n ->method('error')\n ->with(\n '[HubSpot] Failed to process owner data',\n $this->callback(function ($context) {\n return isset($context['result']) &&\n isset($context['error']) &&\n $context['result']['id'] === '456' &&\n $context['result']['email'] === 'invalid@example.com' &&\n str_contains($context['error'], 'invalid-date-format');\n })\n );\n\n $reflection = new \\ReflectionClass($this->client);\n $loggerProperty = $reflection->getProperty('log');\n $loggerProperty->setAccessible(true);\n $loggerProperty->setValue($this->client, $loggerMock);\n\n $result = $this->client->getOwnersArchived(false);\n\n $this->assertIsArray($result);\n $this->assertCount(2, $result);\n $this->assertEquals('123', $result[0]->getId());\n $this->assertEquals('valid@example.com', $result[0]->getEmail());\n $this->assertEquals('789', $result[1]->getId());\n $this->assertEquals('another@example.com', $result[1]->getEmail());\n }\n\n public function testMakeRequestWithGetMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'success']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'GET',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n [],\n null,\n true\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'GET');\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithGetMethodAndQueryString(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'success']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'GET',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n [],\n 'limit=10&offset=0',\n true\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'GET', [], 'limit=10&offset=0');\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithPostMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $payload = [\n 'properties' => [\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n ],\n ];\n\n $psrResponse = new Response(200, [], json_encode(['id' => '12345']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'POST',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n ['json' => $payload]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'POST', $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithPutMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $payload = [\n 'properties' => [\n 'firstname' => 'Jane',\n ],\n ];\n\n $psrResponse = new Response(200, [], json_encode(['id' => '12345', 'updated' => true]));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'PUT',\n 'https://api.hubapi.com/crm/v3/objects/contacts/12345',\n ['json' => $payload]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts/12345', 'PUT', $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithPatchMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $payload = [\n 'properties' => [\n 'email' => 'newemail@example.com',\n ],\n ];\n\n $psrResponse = new Response(200, [], json_encode(['id' => '12345', 'patched' => true]));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'PATCH',\n 'https://api.hubapi.com/crm/v3/objects/contacts/12345',\n ['json' => $payload]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts/12345', 'PATCH', $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithDeleteMethod(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['deleted' => true]));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'DELETE',\n 'https://api.hubapi.com/crm/v3/objects/contacts/12345',\n ['json' => []]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts/12345', 'DELETE');\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestWithEmptyPayload(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'ok']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n 'POST',\n 'https://api.hubapi.com/crm/v3/objects/contacts',\n ['json' => []]\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $result = $client->makeRequest('/crm/v3/objects/contacts', 'POST', []);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testMakeRequestPrependsBaseUrl(): void\n {\n $socialAccountService = $this->createMock(SocialAccountService::class);\n $paginationService = $this->createMock(HubspotPaginationService::class);\n $tokenManager = $this->createMock(HubspotTokenManager::class);\n\n $psrResponse = new Response(200, [], json_encode(['status' => 'success']));\n $expectedResponse = new HubspotResponse($psrResponse);\n\n $hubspotClientMock = $this->createMock(HubspotClient::class);\n $hubspotClientMock->expects($this->once())\n ->method('request')\n ->with(\n $this->anything(),\n 'https://api.hubapi.com/test/endpoint',\n $this->anything()\n )\n ->willReturn($expectedResponse);\n\n $factoryMock = $this->createMock(Factory::class);\n $factoryMock->method('getClient')->willReturn($hubspotClientMock);\n\n $client = $this->getMockBuilder(Client::class)\n ->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])\n ->onlyMethods(['getInstance'])\n ->getMock();\n\n $client->method('getInstance')->willReturn($factoryMock);\n $client->setAccessToken(new AccessToken(['access_token' => 'test_token']));\n\n $client->makeRequest('/test/endpoint', 'GET');\n }\n\n public function testGetOpportunitiesByIds(): void\n {\n $crmIds = ['deal1', 'deal2', 'deal3'];\n $fields = ['dealname', 'amount'];\n\n // Test basic functionality - method exists and returns array\n $this->assertTrue(method_exists($this->client, 'getOpportunitiesByIds'));\n }\n\n public function testGetCompaniesByIds(): void\n {\n $crmIds = ['company1', 'company2'];\n $fields = ['name', 'industry'];\n\n // Test basic functionality - method exists and returns array\n $this->assertTrue(method_exists($this->client, 'getCompaniesByIds'));\n }\n\n public function testGetContactsByIds(): void\n {\n $crmIds = ['contact1', 'contact2'];\n $fields = ['firstname', 'lastname'];\n\n // Test basic functionality - method exists and returns array\n $this->assertTrue(method_exists($this->client, 'getContactsByIds'));\n }\n\n public function testBatchReadObjectsEmptyIds(): void\n {\n $reflection = new \\ReflectionClass($this->client);\n $method = $reflection->getMethod('batchReadObjects');\n $method->setAccessible(true);\n\n $result = $method->invokeArgs($this->client, ['deals', [], ['dealname']]);\n\n $this->assertEquals([], $result);\n }\n\n public function testBatchReadObjectsExceedsBatchSize(): void\n {\n $crmIds = array_fill(0, 101, 'deal_id'); // 101 IDs, exceeds limit of 100\n\n $reflection = new \\ReflectionClass($this->client);\n $method = $reflection->getMethod('batchReadObjects');\n $method->setAccessible(true);\n\n $this->expectException(\\InvalidArgumentException::class);\n $this->expectExceptionMessage('Batch size cannot exceed 100 deals');\n\n $method->invokeArgs($this->client, ['deals', $crmIds, ['dealname']]);\n }\n\n public function testBatchReadObjectsUnsupportedObjectType(): void\n {\n $reflection = new \\ReflectionClass($this->client);\n $method = $reflection->getMethod('batchReadObjects');\n $method->setAccessible(true);\n\n $this->expectException(\\Jiminny\\Exceptions\\CrmException::class);\n $this->expectExceptionMessage('Failed to batch fetch unsupported');\n\n $method->invokeArgs($this->client, ['unsupported', ['id1'], ['field1']]);\n }\n\n public function testIsUnauthorizedExceptionWithBadRequest401(): void\n {\n $exception = new \\SevenShores\\Hubspot\\Exceptions\\BadRequest('Unauthorized', 401);\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithBadRequestNon401(): void\n {\n $exception = new \\SevenShores\\Hubspot\\Exceptions\\BadRequest('Bad Request', 400);\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertFalse($result);\n }\n\n public function testIsUnauthorizedExceptionWithGuzzleRequestException(): void\n {\n $response = new Response(401, [], 'Unauthorized');\n $exception = new \\GuzzleHttp\\Exception\\RequestException('Unauthorized', new \\GuzzleHttp\\Psr7\\Request('GET', 'test'), $response);\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithGuzzleClientException(): void\n {\n $exception = new \\GuzzleHttp\\Exception\\ClientException('Unauthorized', new \\GuzzleHttp\\Psr7\\Request('GET', 'test'), new Response(401));\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithStringMatching(): void\n {\n $exception = new \\Exception('HTTP 401 Unauthorized error occurred');\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertTrue($result);\n }\n\n public function testIsUnauthorizedExceptionWithNonUnauthorized(): void\n {\n $exception = new \\Exception('Some other error');\n\n $result = $this->client->isUnauthorizedException($exception);\n\n $this->assertFalse($result);\n }\n\n public function testEnsureValidTokenWithNullOauthAccount(): void\n {\n $reflection = new \\ReflectionClass($this->client);\n $oauthAccountProperty = $reflection->getProperty('oauthAccount');\n $oauthAccountProperty->setAccessible(true);\n $oauthAccountProperty->setValue($this->client, null);\n\n // Should not throw exception and not call token manager\n $this->tokenManagerMock->expects($this->never())->method('ensureValidToken');\n\n $this->client->ensureValidToken();\n\n $this->assertTrue(true); // Test passes if no exception is thrown\n }\n\n public function testGetConfig(): void\n {\n $result = $this->client->getConfig();\n\n $this->assertSame($this->config, $result);\n }\n\n public function testGetOwners(): void\n {\n // Test that the method exists and can be called\n $this->assertTrue(method_exists($this->client, 'getOwners'));\n\n // Since getOwners has complex HubSpot API dependencies,\n // we'll just verify the method exists for now\n $this->assertIsCallable([$this->client, 'getOwners']);\n }\n\n public function testCreateMeeting(): void\n {\n $payload = [\n 'properties' => [\n 'hs_meeting_title' => 'Test Meeting',\n 'hs_meeting_start_time' => '2024-01-01T10:00:00Z',\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['id' => 'meeting123']);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with('/crm/v3/objects/meetings', 'POST', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->createMeeting($payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testUpdateMeeting(): void\n {\n $meetingId = 'meeting123';\n $payload = [\n 'properties' => [\n 'hs_meeting_title' => 'Updated Meeting',\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['id' => $meetingId, 'updated' => true]);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with(\"/crm/v3/objects/meetings/{$meetingId}\", 'PATCH', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->updateMeeting($meetingId, $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testAddAssociations(): void\n {\n $objectType = 'deals';\n $associationType = 'contacts';\n $payload = [\n 'inputs' => [\n ['from' => ['id' => 'deal1'], 'to' => ['id' => 'contact1']],\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['status' => 'success']);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with(\"/crm/v4/associations/{$objectType}/{$associationType}/batch/create\", 'POST', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->addAssociations($objectType, $associationType, $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n public function testRemoveAssociations(): void\n {\n $objectType = 'deals';\n $associationType = 'contacts';\n $payload = [\n 'inputs' => [\n ['from' => ['id' => 'deal1'], 'to' => ['id' => 'contact1']],\n ],\n ];\n\n $expectedResponse = $this->generateHubSpotResponse(['status' => 'success']);\n\n $this->client->expects($this->once())\n ->method('makeRequest')\n ->with(\"/crm/v4/associations/{$objectType}/{$associationType}/batch/archive\", 'POST', $payload)\n ->willReturn($expectedResponse);\n\n $result = $this->client->removeAssociations($objectType, $associationType, $payload);\n\n $this->assertSame($expectedResponse, $result);\n }\n\n // -------------------------------------------------------------------------\n // search() / executeRequest() tests\n // -------------------------------------------------------------------------\n\n public function testSearchReturnsDecodedArrayOnSuccess(): void\n {\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn(null);\n\n $this->config->method('getId')->willReturn(42);\n\n $payload = ['filters' => []];\n $responseData = ['results' => [['id' => '1']], 'total' => 1, 'paging' => []];\n $hubspotResponse = new HubspotResponse(new Response(200, [], json_encode($responseData)));\n\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->with('POST', Client::BASE_URL . '/crm/v3/objects/contacts/search', ['json' => $payload])\n ->willReturn($hubspotResponse);\n\n $result = $this->client->search('contacts', $payload);\n\n $this->assertSame($responseData, $result);\n\n Mockery::close();\n }\n\n public function testSearchThrowsRateLimitExceptionWhenCircuitBreakerActive(): void\n {\n $futureTimestamp = (string) (time() + 30);\n\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn($futureTimestamp);\n\n $this->config->method('getId')->willReturn(42);\n\n $this->hubspotClientMock->expects($this->never())->method('request');\n\n $this->expectException(RateLimitException::class);\n $this->expectExceptionMessage('Hubspot rate limit (cached circuit-breaker)');\n\n try {\n $this->client->search('contacts', []);\n } finally {\n Mockery::close();\n }\n }\n\n public function testSearchThrowsRateLimitExceptionAndSetsNxOnFresh429(): void\n {\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn(null);\n // NX + TTL option array — exact TTL depends on parseRetryAfter, verified separately\n $redisMock->shouldReceive('set')\n ->once()\n ->with(\n 'hubspot:ratelimit:config:42',\n Mockery::type('string'),\n Mockery::on(fn ($opts) => is_array($opts) && in_array('nx', $opts, true))\n );\n\n $this->config->method('getId')->willReturn(42);\n\n $badRequest = new BadRequest('Rate limit exceeded', 429);\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->willThrowException($badRequest);\n\n $this->expectException(RateLimitException::class);\n $this->expectExceptionMessage('Hubspot returned 429');\n\n try {\n $this->client->search('contacts', []);\n } finally {\n Mockery::close();\n }\n }\n\n public function testSearchPropagatesNonRateLimitException(): void\n {\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn(null);\n\n $this->config->method('getId')->willReturn(42);\n\n $exception = new \\SevenShores\\Hubspot\\Exceptions\\HubspotException('Server error', 500);\n $this->hubspotClientMock\n ->expects($this->once())\n ->method('request')\n ->willThrowException($exception);\n\n $this->expectException(\\SevenShores\\Hubspot\\Exceptions\\HubspotException::class);\n $this->expectExceptionMessage('Server error');\n\n try {\n $this->client->search('contacts', []);\n } finally {\n Mockery::close();\n }\n }\n\n public function testSearchCircuitBreakerRetryAfterComputedFromStoredTimestamp(): void\n {\n $remaining = 45;\n $futureTimestamp = (string) (time() + $remaining);\n\n $redisMock = Mockery::mock('alias:Illuminate\\Support\\Facades\\Redis');\n $redisMock->shouldReceive('get')->once()->andReturn($futureTimestamp);\n\n $this->config->method('getId')->willReturn(1);\n\n try {\n $this->client->search('deals', []);\n $this->fail('Expected RateLimitException');\n } catch (RateLimitException $e) {\n $this->assertGreaterThanOrEqual(1, $e->getRetryAfter());\n $this->assertLessThanOrEqual($remaining, $e->getRetryAfter());\n } finally {\n Mockery::close();\n }\n }\n\n // -------------------------------------------------------------------------\n // isHubspotRateLimit() tests (private method — tested via reflection)\n // -------------------------------------------------------------------------\n\n private function callIsHubspotRateLimit(\\Throwable $e): bool\n {\n $method = new \\ReflectionMethod($this->client, 'isHubspotRateLimit');\n $method->setAccessible(true);\n\n return $method->invoke($this->client, $e);\n }\n\n public function testIsHubspotRateLimitReturnsTrueForBadRequest429(): void\n {\n $e = new BadRequest('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForDealApiException429(): void\n {\n $e = new DealApiException('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForContactApiException429(): void\n {\n $e = new ContactApiException('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForCompanyApiException429(): void\n {\n $e = new CompanyApiException('Too Many Requests', 429);\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsTrueForGuzzleRequestException429(): void\n {\n $request = new \\GuzzleHttp\\Psr7\\Request('POST', 'https://api.hubapi.com/test');\n $response = new \\GuzzleHttp\\Psr7\\Response(429);\n $e = new \\GuzzleHttp\\Exception\\RequestException('Too Many Requests', $request, $response);\n\n $this->assertTrue($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsFalseForBadRequestNon429(): void\n {\n $e = new BadRequest('Bad Request', 400);\n $this->assertFalse($this->callIsHubspotRateLimit($e));\n }\n\n public function testIsHubspotRateLimitReturnsFalseForGenericException(): void\n {\n $e = new \\RuntimeException('Something went wrong');\n $this->assertFalse($this->callIsHubspotRateLimit($e));\n }\n\n // -------------------------------------------------------------------------\n // parseRetryAfter() tests (private method — tested via reflection)\n // -------------------------------------------------------------------------\n\n private function callParseRetryAfter(\\Throwable $e): int\n {\n $method = new \\ReflectionMethod($this->client, 'parseRetryAfter');\n $method->setAccessible(true);\n\n return $method->invoke($this->client, $e);\n }\n\n public function testParseRetryAfterReadsRetryAfterHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['Retry-After' => ['30']]);\n $this->assertSame(30, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReadsLowercaseRetryAfterHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['retry-after' => ['15']]);\n $this->assertSame(15, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterHandlesScalarHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['Retry-After' => '60']);\n $this->assertSame(60, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsDailyLimitDelay(): void\n {\n $e = new BadRequest('Daily rate limit exceeded');\n $this->assertSame(600, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsTenSecondlyDelay(): void\n {\n $e = new BadRequest('Ten secondly rate limit exceeded');\n $this->assertSame(10, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsSecondlyDelay(): void\n {\n $e = new BadRequest('Secondly rate limit exceeded');\n $this->assertSame(1, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterReturnsDefaultWhenNoHint(): void\n {\n $e = new BadRequest('Rate limit exceeded');\n $this->assertSame(10, $this->callParseRetryAfter($e));\n }\n\n public function testParseRetryAfterIgnoresNonNumericHeader(): void\n {\n $e = new DealApiException('Too Many Requests', 429, ['Retry-After' => ['not-a-number']]);\n // Falls through to message parsing; \"Too Many Requests\" has no known keyword → default 10\n $this->assertSame(10, $this->callParseRetryAfter($e));\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"19","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {\n\"headers\":{\n\"Date\":[\"Thu,07 May 2026 14:21:15 GMT\"],\n \"Content-Type\":[\"application/json;charset=utf-8\"],\n \"Transfer-Encoding\":[\"chunked\"],\n \"Connection\":[\"keep-alive\"],\n \"CF-Ray\":[\"9f80deb8db60dc3a-SOF\"],\n \"CF-Cache-Status\":[\"DYNAMIC\"],\n \"Strict-Transport-Security\":[\"max-age=31536000; includeSubDomains; preload\"],\n \"Vary\":[\"origin,\n accept-encoding\"],\n \"access-control-allow-credentials\":[\"false\"],\n \"server-timing\":[\"hcid;desc=\\\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\\\",\n cfr;desc=\\\"9f80deb8e7c6dc3a-IAD\\\"\"],\n \"x-content-type-options\":[\"nosniff\"],\n \"x-hubspot-correlation-id\":[\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\"],\n \"Set-Cookie\":[\"__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-1.0.1.1-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,\n 07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None\"],\n \"Report-To\":[\"{\n\\\"endpoints\\\":[{\n\\\"url\\\":\\\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report\\\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\\\"}],\n\\\"group\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"NEL\":[\"{\n\\\"success_fraction\\\":0.01,\n\\\"report_to\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"Server\":[\"cloudflare\"]}} {\n\"correlation_id\":\"95236535-ec98-4541-b92a-adfa73b69eab\",\n\"trace_id\":\"c7ab8365-903f-46d4-9403-0e5b551e3545\"}","depth":4,"on_screen":true,"value":"[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {\n\"headers\":{\n\"Date\":[\"Thu,07 May 2026 14:21:15 GMT\"],\n \"Content-Type\":[\"application/json;charset=utf-8\"],\n \"Transfer-Encoding\":[\"chunked\"],\n \"Connection\":[\"keep-alive\"],\n \"CF-Ray\":[\"9f80deb8db60dc3a-SOF\"],\n \"CF-Cache-Status\":[\"DYNAMIC\"],\n \"Strict-Transport-Security\":[\"max-age=31536000; includeSubDomains; preload\"],\n \"Vary\":[\"origin,\n accept-encoding\"],\n \"access-control-allow-credentials\":[\"false\"],\n \"server-timing\":[\"hcid;desc=\\\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\\\",\n cfr;desc=\\\"9f80deb8e7c6dc3a-IAD\\\"\"],\n \"x-content-type-options\":[\"nosniff\"],\n \"x-hubspot-correlation-id\":[\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\"],\n \"Set-Cookie\":[\"__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-1.0.1.1-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,\n 07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None\"],\n \"Report-To\":[\"{\n\\\"endpoints\\\":[{\n\\\"url\\\":\\\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report\\\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\\\"}],\n\\\"group\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"NEL\":[\"{\n\\\"success_fraction\\\":0.01,\n\\\"report_to\\\":\\\"cf-nel\\\",\n\\\"max_age\\\":604800}\"],\n\"Server\":[\"cloudflare\"]}} {\n\"correlation_id\":\"95236535-ec98-4541-b92a-adfa73b69eab\",\n\"trace_id\":\"c7ab8365-903f-46d4-9403-0e5b551e3545\"}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8016712486324069616
|
4446428687123393012
|
idle
|
accessibility
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
ClientTest
Rerun 'PHPUnit: ClientTest'
Debug 'ClientTest'
Stop 'ClientTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
19
144
11
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Tests\Unit\Services\Crm\Hubspot;
use GuzzleHttp\Psr7\Response;
use HubSpot\Client\Crm\Associations\Api\BatchApi;
use HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId;
use HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti;
use HubSpot\Client\Crm\Associations\Model\PublicObjectId;
use HubSpot\Client\Crm\Companies\ApiException as CompanyApiException;
use HubSpot\Client\Crm\Contacts\ApiException as ContactApiException;
use HubSpot\Client\Crm\Deals\Api\BasicApi as DealsBasicApi;
use HubSpot\Client\Crm\Deals\ApiException as DealApiException;
use HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations as DealWithAssociations;
use HubSpot\Client\Crm\Pipelines\Api\PipelinesApi;
use HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipeline;
use HubSpot\Client\Crm\Pipelines\Model\Error;
use HubSpot\Client\Crm\Pipelines\Model\Pipeline;
use HubSpot\Client\Crm\Pipelines\Model\PipelineStage;
use HubSpot\Client\Crm\Properties\Api\CoreApi;
use HubSpot\Client\Crm\Properties\Model\Property;
use HubSpot\Discovery as HubSpotDiscovery;
use HubSpot\Discovery\Crm\Deals\Discovery as DealsDiscovery;
use Jiminny\Exceptions\RateLimitException;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\SocialAccount;
use Jiminny\Services\Crm\Hubspot\Client;
use Jiminny\Services\Crm\Hubspot\HubspotTokenManager;
use Jiminny\Services\Crm\Hubspot\Pagination\HubspotPaginationService;
use Jiminny\Services\SocialAccountService;
use League\OAuth2\Client\Token\AccessToken;
use Mockery;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
use SevenShores\Hubspot\Endpoints\Engagements;
use SevenShores\Hubspot\Exceptions\BadRequest;
use SevenShores\Hubspot\Factory;
use SevenShores\Hubspot\Http\Client as HubspotClient;
use SevenShores\Hubspot\Http\Response as HubspotResponse;
/**
* @runTestsInSeparateProcesses
*
* @preserveGlobalState disabled
*/
class ClientTest extends TestCase
{
private const string RESPONSE_TYPE_STAGE_FIELD = 'stage';
private const string RESPONSE_TYPE_PIPELINE_FIELD = 'pipeline';
private const string RESPONSE_TYPE_REGULAR_FIELD = 'regular';
/**
* @var Client&MockObject
*/
private Client $client;
private Configuration $config;
/**
* @var SocialAccountService&MockObject
*/
private SocialAccountService $socialAccountServiceMock;
/**
* @var HubspotPaginationService&MockObject
*/
private HubspotPaginationService $paginationServiceMock;
/**
* @var HubspotTokenManager&MockObject
*/
private HubspotTokenManager $tokenManagerMock;
/**
* @var CoreApi&MockObject
*/
private CoreApi $coreApiMock;
/**
* @var PipelinesApi&MockObject
*/
private PipelinesApi $pipelinesApiMock;
/**
* @var BatchApi&MockObject
*/
private BatchApi $associationsBatchApiMock;
/**
* @var DealsBasicApi&MockObject
*/
private DealsBasicApi $dealsBasicApiMock;
/**
* @var Engagements&MockObject
*/
private $engagementsMock;
/**
* @var HubspotClient&MockObject
*/
private HubspotClient $hubspotClientMock;
protected function setUp(): void
{
// Create mocks for dependencies
$this->socialAccountServiceMock = $this->createMock(SocialAccountService::class);
$this->paginationServiceMock = $this->createMock(HubspotPaginationService::class);
$this->tokenManagerMock = $this->createMock(HubspotTokenManager::class);
// Create a real Client instance with mocked dependencies
// Create a partial mock only for the methods we need to mock
$client = $this->createPartialMock(Client::class, ['getInstance', 'getNewInstance', 'makeRequest']);
$client->setLogger(new NullLogger());
// Inject the real dependencies using reflection
$reflection = new \ReflectionClass(Client::class);
$accountServiceProperty = $reflection->getProperty('accountService');
$accountServiceProperty->setAccessible(true);
$accountServiceProperty->setValue($client, $this->socialAccountServiceMock);
$paginationServiceProperty = $reflection->getProperty('paginationService');
$paginationServiceProperty->setAccessible(true);
$paginationServiceProperty->setValue($client, $this->paginationServiceMock);
$tokenManagerProperty = $reflection->getProperty('tokenManager');
$tokenManagerProperty->setAccessible(true);
$tokenManagerProperty->setValue($client, $this->tokenManagerMock);
$factoryMock = $this->createMock(Factory::class);
$hubspotClientMock = $this->createMock(HubspotClient::class);
$engagementsMock = $this->createMock(\SevenShores\Hubspot\Endpoints\Engagements::class);
$factoryMock->method('getClient')->willReturn($hubspotClientMock);
$factoryMock->method('__call')->with('engagements')->willReturn($engagementsMock);
$client->method('getInstance')->willReturn($factoryMock);
$discoveryMock = $this->createMock(HubSpotDiscovery\Discovery::class);
$crmMock = $this->createMock(HubSpotDiscovery\Crm\Discovery::class);
$associationsMock = $this->createMock(HubSpotDiscovery\Crm\Associations\Discovery::class);
$propertiesMock = $this->createMock(HubSpotDiscovery\Crm\Properties\Discovery::class);
$pipelinesMock = $this->createMock(HubSpotDiscovery\Crm\Pipelines\Discovery::class);
$coreApiMock = $this->createMock(CoreApi::class);
$pipelinesApiMock = $this->createMock(PipelinesApi::class);
$associationsBatchApiMock = $this->createMock(BatchApi::class);
$dealsBasicApiMock = $this->createMock(DealsBasicApi::class);
$propertiesMock->method('__call')->with('coreApi')->willReturn($coreApiMock);
$pipelinesMock->method('__call')->with('pipelinesApi')->willReturn($pipelinesApiMock);
$associationsMock->method('__call')->with('batchApi')->willReturn($associationsBatchApiMock);
$dealsDiscoveryMock = $this->createMock(DealsDiscovery::class);
$dealsDiscoveryMock->method('__call')->with('basicApi')->willReturn($dealsBasicApiMock);
$returnMap = ['properties' => $propertiesMock, 'pipelines' => $pipelinesMock, 'associations' => $associationsMock, 'deals' => $dealsDiscoveryMock];
$crmMock->method('__call')
->willReturnCallback(static fn (string $name) => $returnMap[$name])
;
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client->method('getNewInstance')->willReturn($discoveryMock);
$this->client = $client;
$this->config = $this->createMock(Configuration::class);
$this->client->setConfiguration($this->config);
$this->coreApiMock = $coreApiMock;
$this->pipelinesApiMock = $pipelinesApiMock;
$this->associationsBatchApiMock = $associationsBatchApiMock;
$this->dealsBasicApiMock = $dealsBasicApiMock;
$this->engagementsMock = $engagementsMock;
$this->hubspotClientMock = $hubspotClientMock;
}
public function testGetMinimumApiVersion(): void
{
$this->assertIsString($this->client->getMinimumApiVersion());
}
public function testGetInstance(): void
{
$socialAccountService = $this->createMock(SocialAccountService::class);
$paginationService = $this->createMock(HubspotPaginationService::class);
$tokenManager = $this->createMock(HubspotTokenManager::class);
$client = new Client($socialAccountService, $paginationService, $tokenManager);
$client->setBaseUrl('[URL_WITH_CREDENTIALS] The class CollectionResponsePipeline will be deprecated in the next Hubspot version
*/
$this->pipelinesApiMock
->method('getAll')
->with('deals')
->willReturn(new CollectionResponsePipeline([
'results' => [$this->generatePipeline()],
]))
;
$this->assertEquals(
[
['id' => 'foo', 'label' => 'bar'],
['id' => 'baz', 'label' => 'qux'],
],
$this->client->fetchOpportunityPipelineStages()
);
}
public function testFetchOpportunityPipelineStagesErrorResponse(): void
{
$this->pipelinesApiMock
->method('getAll')
->with('deals')
->willReturn(new Error(['message' => 'test error']))
;
$this->assertEmpty($this->client->fetchOpportunityPipelineStages());
}
#[\PHPUnit\Framework\Attributes\DataProvider('meetingOutcomeFieldProvider')]
public function testFetchMeetingOutcomeFieldOptions(string $fieldId, string $expectedEndpoint): void
{
$field = new Field(['crm_provider_id' => $fieldId]);
$this->hubspotClientMock
->expects($this->once())
->method('request')
->with('GET', $expectedEndpoint)
->willReturn($this->generateHubSpotResponse(
[
'options' => [
['value' => 'option_1', 'label' => 'Option 1', 'displayOrder' => 0],
['value' => 'option_2', 'label' => 'Option 2', 'displayOrder' => 1],
['value' => 'option_3', 'label' => 'Option 3', 'displayOrder' => 2],
],
]
))
;
$this->assertEquals(
[
['id' => 'option_1', 'value' => 'option_1', 'label' => 'Option 1', 'display_order' => 0],
['id' => 'option_2', 'value' => 'option_2', 'label' => 'Option 2', 'display_order' => 1],
['id' => 'option_3', 'value' => 'option_3', 'label' => 'Option 3', 'display_order' => 2],
],
$this->client->fetchMeetingOutcomeFieldOptions($field)
);
}
public static function meetingOutcomeFieldProvider(): array
{
return [
'meeting outcome field' => [
'meetingOutcome',
'[URL_WITH_CREDENTIALS] The class CollectionResponsePipeline will be deprecated in the next Hubspot version
*/
$pipelineStagesResponse = new CollectionResponsePipeline([
'results' => [$this->generatePipeline()],
]);
$this->pipelinesApiMock
->method('getAll')
->willReturn($pipelineStagesResponse);
}
if ($type === self::RESPONSE_TYPE_PIPELINE_FIELD) {
$field->method('isStageField')->willReturn(false);
$field->method('isPipelineField')->willReturn(true);
$pipelineResponse = $this->generateHubSpotResponse([
'results' => [
['id' => '123', 'label' => 'Sales'],
['id' => 'default', 'label' => 'CS'],
],
]);
$this->client
->method('makeRequest')
->with('/crm/v3/pipelines/deals')
->willReturn($pipelineResponse);
}
$this->assertEquals(
$responses[$type],
$this->client->fetchOpportunityFieldOptions($field)
);
}
public static function opportunityFieldOptionsProvider(): array
{
return [
'stage field' => [
'field' => new Field(['crm_provider_id' => 'dealstage']),
'type' => self::RESPONSE_TYPE_STAGE_FIELD,
],
'pipeline field' => [
'field' => new Field(['crm_provider_id' => 'pipeline']),
'type' => self::RESPONSE_TYPE_PIPELINE_FIELD,
],
'regular field' => [
'field' => new Field(['crm_provider_id' => 'some_property']),
'type' => self::RESPONSE_TYPE_REGULAR_FIELD,
],
];
}
private function generateHubSpotResponse(array $data): HubspotResponse
{
return new HubspotResponse(new Response(200, [], json_encode($data)));
}
private function generateProperty(): Property
{
return new Property([
'name' => 'some_property',
'options' => [
[
'label' => 'label_1',
'value' => 'value_1',
],
[
'label' => 'label_2',
'value' => 'value_2',
],
],
]);
}
private function generatePipeline(): Pipeline
{
return new Pipeline(['stages' => [
new PipelineStage(['id' => 'foo', 'label' => 'bar']),
new PipelineStage(['id' => 'baz', 'label' => 'qux']),
]]);
}
public function testFetchOpportunityPipelines(): void
{
$this->client
->method('makeRequest')
->with('/crm/v3/pipelines/deals')
->willReturn($this->generateHubSpotResponse([
'results' => [
['id' => 'id_1', 'label' => 'Option 1', 'displayOrder' => 0],
['id' => 'id_2', 'label' => 'Option 2', 'displayOrder' => 1],
['id' => 'id_3', 'label' => 'Option 3', 'displayOrder' => 2],
],
]));
$this->assertEquals(
[
['id' => 'id_1', 'label' => 'Option 1'],
['id' => 'id_2', 'label' => 'Option 2'],
['id' => 'id_3', 'label' => 'Option 3'],
],
$this->client->fetchOpportunityPipelines()
);
}
public function testGetPaginatedData(): void
{
$expectedResults = [
['id' => 'id_1', 'properties' => []],
['id' => 'id_2', 'properties' => []],
['id' => 'id_3', 'properties' => []],
];
// Mock the pagination service to return a generator and modify reference parameters
$this->paginationServiceMock
->expects($this->once())
->method('getPaginatedDataGenerator')
->with(
$this->client,
['payload_key' => 'payload_value'],
'foobar',
0,
$this->anything(),
$this->anything()
)
->willReturnCallback(function ($client, $payload, $type, $offset, &$total, &$lastRecordId) use ($expectedResults) {
$total = 3;
$lastRecordId = 'id_3';
foreach ($expectedResults as $result) {
yield $result;
}
});
$this->assertEquals(
[
'results' => $expectedResults,
'total' => 3,
'last_record' => 'id_3',
],
$this->client->getPaginatedData(['payload_key' => 'payload_value'], 'foobar')
);
}
public function testGetAssociationsData(): void
{
$ids = ['1', '2', '3'];
$fromObject = 'deals';
$toObject = 'contacts';
$responseResults = [];
foreach ($ids as $id) {
$from = new PublicObjectId();
$from->setId($id);
$to1 = new PublicObjectId();
$to1->setId('contact_' . $id . '_1');
$to2 = new PublicObjectId();
$to2->setId('contact_' . $id . '_2');
$result = new \HubSpot\Client\Crm\Associations\Model\PublicAssociationMulti();
$result->setFrom($from);
$result->setTo([$to1, $to2]);
$responseResults[] = $result;
}
$batchResponse = new BatchResponsePublicAssociationMulti();
$batchResponse->setResults($responseResults);
$this->associationsBatchApiMock->expects($this->once())
->method('read')
->with(
$this->equalTo($fromObject),
$this->equalTo($toObject),
$this->callback(function (BatchInputPublicObjectId $batchInput) use ($ids) {
$inputIds = array_map(
fn ($input) => $input->getId(),
$batchInput->getInputs()
);
return $inputIds === $ids;
})
)
->willReturn($batchResponse);
$result = $this->client->getAssociationsData($ids, $fromObject, $toObject);
$expectedResult = [
'1' => ['contact_1_1', 'contact_1_2'],
'2' => ['contact_2_1', 'contact_2_2'],
'3' => ['contact_3_1', 'contact_3_2'],
];
$this->assertEquals($expectedResult, $result);
}
public function testGetAssociationsDataHandlesException(): void
{
$ids = ['1', '2', '3'];
$fromObject = 'deals';
$toObject = 'contacts';
$exception = new \Exception('API Error');
$this->associationsBatchApiMock->expects($this->once())
->method('read')
->with(
$this->equalTo($fromObject),
$this->equalTo($toObject),
$this->callback(function ($batchInput) use ($ids) {
return $batchInput instanceof \HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId
&& count($batchInput->getInputs()) === count($ids);
})
)
->willThrowException($exception);
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with(
'[Hubspot] Failed to fetch associations',
[
'from_object' => $fromObject,
'to_object' => $toObject,
'reason' => 'API Error',
]
);
$this->client->setLogger($loggerMock);
$result = $this->client->getAssociationsData($ids, $fromObject, $toObject);
$this->assertEmpty($result);
$this->assertIsArray($result);
}
public function testGetAssociationsDataWithLargeDataSet(): void
{
$ids = array_map(fn ($i) => (string) $i, range(1, 2500)); // More than 1000 items
$fromObject = 'deals';
$toObject = 'contacts';
$firstBatchResponse = new BatchResponsePublicAssociationMulti();
$firstBatchResults = array_map(function ($id) {
$from = new PublicObjectId();
$from->setId($id);
$to = new PublicObjectId();
$to->setId('contact_' . $id);
$result = new \HubSpot\Client\Crm\Associations\Model\PublicAssociationMulti();
$result->setFrom($from);
$result->setTo([$to]);
return $result;
}, array_slice($ids, 0, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));
$firstBatchResponse->setResults($firstBatchResults);
$secondBatchResponse = new BatchResponsePublicAssociationMulti();
$secondBatchResults = array_map(function ($id) {
$from = new PublicObjectId();
$from->setId($id);
$to = new PublicObjectId();
$to->setId('contact_' . $id);
$result = new \HubSpot\Client\Crm\Associations\Model\PublicAssociationMulti();
$result->setFrom($from);
$result->setTo([$to]);
return $result;
}, array_slice($ids, Client::ASSOCIATIONS_BATCH_SIZE_LIMIT));
$secondBatchResponse->setResults($secondBatchResults);
$this->associationsBatchApiMock->expects($this->exactly(3))
->method('read')
->willReturnOnConsecutiveCalls($firstBatchResponse, $secondBatchResponse);
$result = $this->client->getAssociationsData($ids, $fromObject, $toObject);
$this->assertCount(2500, $result);
$this->assertArrayHasKey('1', $result);
$this->assertArrayHasKey('2500', $result);
$this->assertEquals(['contact_1'], $result['1']);
$this->assertEquals(['contact_2500'], $result['2500']);
}
public function testGetContactByEmailSuccess(): void
{
$email = '[EMAIL]';
$fields = ['firstname', 'lastname', 'email'];
$contactMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations::class);
$contactMock->method('getId')->willReturn('12345');
$contactMock->method('getProperties')->willReturn([
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[EMAIL]',
]);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($email, 'firstname,lastname,email', null, false, 'email')
->willReturn($contactMock);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new NullLogger());
$result = $client->getContactByEmail($email, $fields);
$this->assertEquals([
'id' => '12345',
'properties' => [
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[EMAIL]',
],
], $result);
}
public function testGetContactByEmailWithEmptyFields(): void
{
$email = '[EMAIL]';
$fields = [];
$contactMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations::class);
$contactMock->method('getId')->willReturn('12345');
$contactMock->method('getProperties')->willReturn(['email' => '[EMAIL]']);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($email, '', null, false, 'email')
->willReturn($contactMock);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new NullLogger());
$result = $client->getContactByEmail($email, $fields);
$this->assertEquals([
'id' => '12345',
'properties' => ['email' => '[EMAIL]'],
], $result);
}
public function testGetContactByEmailApiException(): void
{
$email = '[EMAIL]';
$fields = ['firstname', 'lastname'];
$exception = new \HubSpot\Client\Crm\Contacts\ApiException('Contact not found', 404);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($email, 'firstname,lastname', null, false, 'email')
->willThrowException($exception);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('info')
->with(
'[Hubspot] Failed to fetch contact',
[
'email' => $email,
'reason' => 'Contact not found',
]
);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger($loggerMock);
$result = $client->getContactByEmail($email, $fields);
$this->assertEquals([], $result);
}
public function testGetOpportunityById(): void
{
$opportunityId = '12345';
$expectedProperties = [
'dealname' => 'Test Opportunity',
'amount' => '1000.00',
'closedate' => '2024-12-31T23:59:59.999Z',
'dealstage' => 'presentationscheduled',
'pipeline' => 'default',
];
$mockHubspotOpportunity = $this->createMock(DealWithAssociations::class);
$mockHubspotOpportunity->method('getProperties')->willReturn((object) $expectedProperties);
$mockHubspotOpportunity->method('getId')->willReturn($opportunityId);
$now = new \DateTimeImmutable();
$mockHubspotOpportunity->method('getCreatedAt')->willReturn($now);
$mockHubspotOpportunity->method('getUpdatedAt')->willReturn($now);
$mockHubspotOpportunity->method('getArchived')->willReturn(false);
$this->dealsBasicApiMock
->expects($this->once())
->method('getById')
->willReturn($mockHubspotOpportunity);
// Assuming Client::getOpportunityById processes the SimplePublicObject and returns an associative array.
// The structure might be like: ['id' => ..., 'properties' => [...], 'createdAt' => ..., ...]
// Adjust assertions below based on the actual return structure of your method.
$result = $this->client->getOpportunityById($opportunityId, ['test', 'test']);
$this->assertIsArray($result);
$this->assertArrayHasKey('id', $result);
$this->assertEquals($opportunityId, $result['id']);
}
public function testGetContactById(): void
{
$crmId = 'contact-123';
$fields = ['firstname', 'lastname'];
$expectedProperties = ['firstname' => 'John', 'lastname' => 'Doe'];
$mockContact = $this->createMock(\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations::class);
$mockContact->method('getId')->willReturn($crmId);
$mockContact->method('getProperties')->willReturn((object) $expectedProperties);
$contactsApiMock = $this->createMock(\HubSpot\Client\Crm\Contacts\Api\BasicApi::class);
$contactsApiMock->expects($this->once())
->method('getById')
->with($crmId, 'firstname,lastname')
->willReturn($mockContact);
$contactsDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Contacts\Discovery::class);
$contactsDiscoveryMock->method('__call')->with('basicApi')->willReturn($contactsApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($contactsDiscoveryMock) {
if ($name === 'contacts') {
return $contactsDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new \Psr\Log\NullLogger());
$result = $client->getContactById($crmId, $fields);
$this->assertIsArray($result);
$this->assertArrayHasKey('id', $result);
$this->assertArrayHasKey('properties', $result);
$this->assertEquals($crmId, $result['id']);
$this->assertEquals((object) $expectedProperties, $result['properties']);
}
public function testGetAccountById(): void
{
$crmId = 'account-123';
$fields = ['name', 'industry'];
$expectedProperties = ['name' => 'Acme Corp', 'industry' => 'Technology'];
$mockCompany = $this->createMock(\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations::class);
$mockCompany->method('getId')->willReturn($crmId);
$mockCompany->method('getProperties')->willReturn((object) $expectedProperties);
$companiesApiMock = $this->createMock(\HubSpot\Client\Crm\Companies\Api\BasicApi::class);
$companiesApiMock->expects($this->once())
->method('getById')
->with($crmId, 'name,industry')
->willReturn($mockCompany);
$companiesDiscoveryMock = $this->createMock(\HubSpot\Discovery\Crm\Companies\Discovery::class);
$companiesDiscoveryMock->method('__call')->with('basicApi')->willReturn($companiesApiMock);
$crmMock = $this->createMock(\HubSpot\Discovery\Crm\Discovery::class);
$crmMock->method('__call')->willReturnCallback(function ($name) use ($companiesDiscoveryMock) {
if ($name === 'companies') {
return $companiesDiscoveryMock;
}
return $this->createMock(\HubSpot\Discovery\Crm\Properties\Discovery::class);
});
$discoveryMock = $this->createMock(\HubSpot\Discovery\Discovery::class);
$discoveryMock->method('__call')->with('crm')->willReturn($crmMock);
$client = $this->createPartialMock(Client::class, ['getNewInstance']);
$client->method('getNewInstance')->willReturn($discoveryMock);
$client->setLogger(new \Psr\Log\NullLogger());
$result = $client->getAccountById($crmId, $fields);
$this->assertIsArray($result);
$this->assertArrayHasKey('id', $result);
$this->assertArrayHasKey('properties', $result);
$this->assertEquals($crmId, $result['id']);
$this->assertEquals((object) $expectedProperties, $result['properties']);
}
public function testEnsureValidTokenWithNoTokenUpdate(): void
{
$socialAccountMock = $this->createMock(SocialAccount::class);
// Set up OAuth account
$reflection = new \ReflectionClass($this->client);
$oauthAccountProperty = $reflection->getProperty('oauthAccount');
$oauthAccountProperty->setAccessible(true);
$oauthAccountProperty->setValue($this->client, $socialAccountMock);
$originalToken = 'original_token';
$accessTokenProperty = $reflection->getProperty('accessToken');
$accessTokenProperty->setAccessible(true);
$accessTokenProperty->setValue($this->client, $originalToken);
// Mock token manager to return null (no refresh needed)
$this->tokenManagerMock
->expects($this->once())
->method('ensureValidToken')
->with($socialAccountMock)
->willReturn(null);
// Call ensureValidToken
$this->client->ensureValidToken();
// Verify access token was not changed
$this->assertEquals($originalToken, $accessTokenProperty->getValue($this->client));
}
public function testGetPaginatedDataGeneratorDelegatesToPaginationService(): void
{
$payload = ['filters' => []];
$type = 'contacts';
$offset = 0;
$total = 0;
$lastRecordId = null;
$expectedResults = [
['id' => 'id_1', 'properties' => []],
['id' => 'id_2', 'properties' => []],
];
// Mock the pagination service to return a generator
$this->paginationServiceMock
->expects($this->once())
->method('getPaginatedDataGenerator')
->with(
$this->client,
$payload,
$type,
$offset,
$this->anything(),
$this->anything()
)
->willReturnCallback(function () use ($expectedResults) {
foreach ($expectedResults as $result) {
yield $result;
}
});
// Execute the pagination
$results = [];
foreach ($this->client->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastRecordId) as $result) {
$results[] = $result;
}
$this->assertCount(2, $results);
$this->assertEquals('id_1', $results[0]['id']);
$this->assertEquals('id_2', $results[1]['id']);
}
public function testEnsureValidTokenDelegatesToTokenManager(): void
{
$socialAccountMock = $this->createMock(SocialAccount::class);
// Set up OAuth account
$reflection = new \ReflectionClass($this->client);
$oauthAccountProperty = $reflection->getProperty('oauthAccount');
$oauthAccountProperty->setAccessible(true);
$oauthAccountProperty->setValue($this->client, $socialAccountMock);
// Mock token manager to return new token
$this->tokenManagerMock
->expects($this->once())
->method('ensureValidToken')
->with($socialAccountMock)
->willReturn('new_access_token');
// Call ensureValidToken
$this->client->ensureValidToken();
// Verify access token was updated
$accessTokenProperty = $reflection->getProperty('accessToken');
$accessTokenProperty->setAccessible(true);
$this->assertEquals('new_access_token', $accessTokenProperty->getValue($this->client));
}
public function testGetOwnersArchivedWithValidResponse(): void
{
$responseData = [
'results' => [
[
'id' => '123',
'email' => '[EMAIL]',
'type' => 'PERSON',
'firstName' => 'John',
'lastName' => 'Doe',
'userId' => 456,
'userIdIncludingInactive' => 789,
'createdAt' => '2023-01-01T12:00:00Z',
'updatedAt' => '2023-01-02T12:00:00Z',
'archived' => true,
],
],
];
// Create a mock response object
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willReturn($responseData);
// Set up the client to return our test data
$this->client->method('makeRequest')
->with(
'/crm/v3/owners',
'GET',
[],
'archived=true'
)
->willReturn($response);
// Call the method
$result = $this->client->getOwnersArchived(true);
// Assert the results
$this->assertCount(1, $result);
$this->assertEquals('123', $result[0]->getId());
$this->assertEquals('[EMAIL]', $result[0]->getEmail());
$this->assertEquals('John Doe', $result[0]->getFullName());
$this->assertTrue($result[0]->isArchived());
}
public function testGetOwnersArchivedWithEmptyResponse(): void
{
// Create a mock response object with empty results
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willReturn(['results' => []]);
// Set up the client to return empty results
$this->client->method('makeRequest')
->with(
'/crm/v3/owners',
'GET',
[],
'archived=false'
)
->willReturn($response);
// Call the method
$result = $this->client->getOwnersArchived(false);
// Assert the results
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testGetOwnersArchivedWithInvalidResponse(): void
{
// Create a mock response that will throw an exception when toArray is called
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willThrowException(new \InvalidArgumentException('Invalid JSON'));
// Set up the client to return the problematic response
$this->client->method('makeRequest')
->willReturn($response);
// Mock the logger to expect an error message
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with($this->stringContains('Failed to fetch owners'));
$reflection = new \ReflectionClass($this->client);
$loggerProperty = $reflection->getProperty('log');
$loggerProperty->setAccessible(true);
$loggerProperty->setValue($this->client, $loggerMock);
// Call the method and expect an empty array on error
$result = $this->client->getOwnersArchived(true);
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testGetOwnersArchivedWithHttpError(): void
{
// Set up the client to throw an exception
$this->client->method('makeRequest')
->willThrowException(new \Exception('HTTP Error'));
// Mock the logger to expect an error message
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with($this->stringContains('Failed to fetch owners'));
$reflection = new \ReflectionClass($this->client);
$loggerProperty = $reflection->getProperty('log');
$loggerProperty->setAccessible(true);
$loggerProperty->setValue($this->client, $loggerMock);
// Call the method and expect an empty array on error
$result = $this->client->getOwnersArchived(false);
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testGetOwnersArchivedWithOwnerCreationException(): void
{
$responseData = [
'results' => [
[
'id' => '123',
'email' => '[EMAIL]',
'type' => 'PERSON',
'firstName' => 'John',
'lastName' => 'Doe',
'userId' => 456,
'userIdIncludingInactive' => 789,
'createdAt' => '2023-01-01T12:00:00Z',
'updatedAt' => '2023-01-02T12:00:00Z',
'archived' => false,
],
[
'id' => '456',
'email' => '[EMAIL]',
'type' => 'PERSON',
'createdAt' => 'invalid-date-format',
],
[
'id' => '789',
'email' => '[EMAIL]',
'type' => 'PERSON',
'firstName' => 'Jane',
'lastName' => 'Smith',
'userId' => 999,
'userIdIncludingInactive' => 888,
'createdAt' => '2023-01-03T12:00:00Z',
'updatedAt' => '2023-01-04T12:00:00Z',
'archived' => false,
],
],
];
$response = $this->createMock(\SevenShores\Hubspot\Http\Response::class);
$response->method('toArray')
->willReturn($responseData);
$this->client->method('makeRequest')
->with(
'/crm/v3/owners',
'GET',
[],
'archived=false'
)
->willReturn($response);
$loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$loggerMock->expects($this->once())
->method('error')
->with(
'[HubSpot] Failed to process owner data',
$this->callback(function ($context) {
return isset($context['result']) &&
isset($context['error']) &&
$context['result']['id'] === '456' &&
$context['result']['email'] === '[EMAIL]' &&
str_contains($context['error'], 'invalid-date-format');
})
);
$reflection = new \ReflectionClass($this->client);
$loggerProperty = $reflection->getProperty('log');
$loggerProperty->setAccessible(true);
$loggerProperty->setValue($this->client, $loggerMock);
$result = $this->client->getOwnersArchived(false);
$this->assertIsArray($result);
$this->assertCount(2, $result);
$this->assertEquals('123', $result[0]->getId());
$this->assertEquals('[EMAIL]', $result[0]->getEmail());
$this->assertEquals('789', $result[1]->getId());
$this->assertEquals('[EMAIL]', $result[1]->getEmail());
}
public function testMakeRequestWithGetMethod(): void
{
$socialAccountService = $this->createMock(SocialAccountService::class);
$paginationService = $this->createMock(HubspotPaginationService::class);
$tokenManager = $this->createMock(HubspotTokenManager::class);
$psrResponse = new Response(200, [], json_encode(['status' => 'success']));
$expectedResponse = new HubspotResponse($psrResponse);
$hubspotClientMock = $this->createMock(HubspotClient::class);
$hubspotClientMock->expects($this->once())
->method('request')
->with(
'GET',
'https://api.hubapi.com/crm/v3/objects/contacts',
[],
null,
true
)
->willReturn($expectedResponse);
$factoryMock = $this->createMock(Factory::class);
$factoryMock->method('getClient')->willReturn($hubspotClientMock);
$client = $this->getMockBuilder(Client::class)
->setConstructorArgs([$socialAccountService, $paginationService, $tokenManager])
->onlyMethods(['getInstance'])
->getMock();
$client->method('getInstance')->willReturn($factoryMock);
$client->setAccessToken(new AccessToken(['access_token' => 'test_token']));
$result = $client->makeRequest('/crm/v3/objects/contacts', 'GET');
$this->assertSame($expectedResponse, $result);
}
public function testMakeRequestWithGetMethodAndQueryString(): void
{
$socialAccountService = $this->createMock(SocialAccountService::class);
$paginationService = $this->createMock(HubspotPaginationService...
|
20391
|
NULL
|
NULL
|
NULL
|