|
32894
|
1256
|
14
|
2026-05-13T09:44:45.938648+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778665485938_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
SlackFile Edit ViewGoHistoryWindowHelpAPPDOCKER₴81 SlackFile Edit ViewGoHistoryWindowHelpAPPDOCKER₴81DEV (docker)₴82APP (-zshtests/Unit/Component/ParticipantSpeech/Services/ParticipantSpeechesDeleterTest.phptests/Unit/Component/ParticipantSpeech/Services/ParticipantSpeechesProviderTest.phptests/Unit/Component/ParticipantSpeech/Services/ParticipantSpeechesUploaderTest.phptests/Unit/Component/Transcription/Diarization/Services/GetNormalizedParticipantSpeeches?tests/Unit/Component/Transcription/Diarization/Source/MeetingBotSourceTest.phptests/Unit/Contracts/Services/Calendar/CalendarTraitTest.phptests/Unit/Http/Controllers/Kiosk/ActivityControllerTest.phptests/Unit/Jobs/Activity/Import/ImportTwilioVideoSpeechesJobTest.phptests/Unit/Jobs/Activity/Import/IsActivityReadyForProcessingJobTest.phptests/Unit/Jobs/Calendar/SetupCalendarSyncTest.phptests/Unit/Services/Activity/ParticipantsServiceTest.phptests/Unit/Services/Calendar/Command/ImportParticipantsTest.phptests/Unit/Services/Calendar/GoogleCalendarServiceTest.phptests/Unit/Services/Crm/Close/ServiceTest.phptests/Unit/Services/Crm/Hubspot/ServiceTest.phptests/Unit/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTest.phptests/Unit/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTraitMatchActivitiesTest.phytests/Unit/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmEntitiesTraitOpportunitiesTe:tests/Unit/Services/Crm/Pipedrive/ImportOpportunityMatchActivitiesTest.phptests/Unit/Services/Crm/Salesforce/ServiceTest.phptests/Unit/Services/Mail/0ffice/EmailApiClientTest.phptests/Unit/Services/RecallAI/RecallAIServiceTest.php113 files changed, 4143 insertions(+), 1740 deletions(-)create mode 120000 CLAUDE.mdcreate mode 100644 app/Component/AiAutomation/Services/CrmFillingEligibilityChecker.phpdelete mode 100644 app/Component/ES/ElasticSearchWorkerManager.phpdelete mode 100644 app/Component/ES/Worker/ActivityWorker.phpdelete mode 100644 app/Component/ES/Worker/EntityWorker.phpdelete mode100644 app/Component/ES/Worker/WorkerAmount.phpdelete mode100644 app/Component/ES/Worker/WorkerInterface.phpcreate mode100644 app/Component/ProphetAi/Exceptions/InsufficientTranscriptException.phtcreate mode100644 app/Component/Transcription/DTO/Http/Transcription/AssemblyAI/Assembl:create mode100644 app/Component/Transcription/DTO/Http/Transcription/TranscriptionIsNot(create mode 100644 app/Console/Commands/Crm/Backfill0pportunityUserFromAccountCommand.phpdelete mode 100644 app/Console/Commands/Elasticsearch/AsyncUpdateEsActivities.phpcreate mode100644 front-end/src/components/shared/modals/EntityPickerModal/__tests__/us‹create mode 100644 tests/Feature/Component/Nudge/Process0rganisationImmediateNudgesJobTe:create mode 100644 tests/Unit/Component/AiAutomation/Services/CrmFillingEligibilityCheck‹delete mode 100644 tests/Unit/Component/ES/ElasticSearchWorkerManagerTest.phpdelete mode 100644 tests/Unit/Component/ES/Worker/ActivityWorkerTest.phpdelete mode 100644 tests/Unit/Component/ES/Worker/EntityWorkerTest.phpdelete mode 100644 tests/Unit/Component/ES/Worker/WorkerAmountTest.phpcreate mode 100644 tests/Unit/Component/ParticipantSpeech/Services/ParticipantSpeechesCr‹create mode 100644 tests/Unit/Http/Controllers/Kiosk/ActivityControllerTest.phpLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ I|HomeDMsActivityFilesLaterMore(aol§ Support Daily - in 2h 16 m100% <78•Wed 13 May12:44:45ED-→Describe what you are looking forJiminny ...Nikolay Ivanov6 0curoaroylau# engineering# general# jiminny-bg# platform-tickets# product_launches#random# releases# sofia-office# support# thank-yous# the_people_of jimi...MessagesAdd canvas@ Files+Lukas Kovalik 11.Today ~мен все ме праща наhttps://app.vanta.com/c/jiminny.com/employee/onboardingNikolay Ivanov 11:01 AMХм, Джейс дали не може да ти помогне?Lukas Kovalik 11:01 AMще питам James, предполагам че нямам правада мерсиNikolay Ivanov 11:01 AMмда° Direct messages& Nikolay Ivanovdo James Graham. Stoyan Tanev. Galya Dimitrova. Steliyan Georgievo Petko Kashinski®. Aneliya Angelovaã. Stefka Stoyanova•. Vasil Vasilev •!Lukas Kovalik y...МОЛЯLukas Kovalik 12:13 PMНики сори, още един въпрос имамкогато ги правеше ти FE ли оправяима vulnerabilities no npmNikolay Ivanov 12:28 PMнетях ги оставямLukas Kovalik 12:29 PMаз погледнах твоя тикет и там друго нямашесамо FEкак стигна до Workerl:: AppsJira CloudMessage Nikolay IvanovToast...
|
NULL
|
-8804658197049154370
|
NULL
|
click
|
ocr
|
NULL
|
SlackFile Edit ViewGoHistoryWindowHelpAPPDOCKER₴81 SlackFile Edit ViewGoHistoryWindowHelpAPPDOCKER₴81DEV (docker)₴82APP (-zshtests/Unit/Component/ParticipantSpeech/Services/ParticipantSpeechesDeleterTest.phptests/Unit/Component/ParticipantSpeech/Services/ParticipantSpeechesProviderTest.phptests/Unit/Component/ParticipantSpeech/Services/ParticipantSpeechesUploaderTest.phptests/Unit/Component/Transcription/Diarization/Services/GetNormalizedParticipantSpeeches?tests/Unit/Component/Transcription/Diarization/Source/MeetingBotSourceTest.phptests/Unit/Contracts/Services/Calendar/CalendarTraitTest.phptests/Unit/Http/Controllers/Kiosk/ActivityControllerTest.phptests/Unit/Jobs/Activity/Import/ImportTwilioVideoSpeechesJobTest.phptests/Unit/Jobs/Activity/Import/IsActivityReadyForProcessingJobTest.phptests/Unit/Jobs/Calendar/SetupCalendarSyncTest.phptests/Unit/Services/Activity/ParticipantsServiceTest.phptests/Unit/Services/Calendar/Command/ImportParticipantsTest.phptests/Unit/Services/Calendar/GoogleCalendarServiceTest.phptests/Unit/Services/Crm/Close/ServiceTest.phptests/Unit/Services/Crm/Hubspot/ServiceTest.phptests/Unit/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTest.phptests/Unit/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTraitMatchActivitiesTest.phytests/Unit/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmEntitiesTraitOpportunitiesTe:tests/Unit/Services/Crm/Pipedrive/ImportOpportunityMatchActivitiesTest.phptests/Unit/Services/Crm/Salesforce/ServiceTest.phptests/Unit/Services/Mail/0ffice/EmailApiClientTest.phptests/Unit/Services/RecallAI/RecallAIServiceTest.php113 files changed, 4143 insertions(+), 1740 deletions(-)create mode 120000 CLAUDE.mdcreate mode 100644 app/Component/AiAutomation/Services/CrmFillingEligibilityChecker.phpdelete mode 100644 app/Component/ES/ElasticSearchWorkerManager.phpdelete mode 100644 app/Component/ES/Worker/ActivityWorker.phpdelete mode 100644 app/Component/ES/Worker/EntityWorker.phpdelete mode100644 app/Component/ES/Worker/WorkerAmount.phpdelete mode100644 app/Component/ES/Worker/WorkerInterface.phpcreate mode100644 app/Component/ProphetAi/Exceptions/InsufficientTranscriptException.phtcreate mode100644 app/Component/Transcription/DTO/Http/Transcription/AssemblyAI/Assembl:create mode100644 app/Component/Transcription/DTO/Http/Transcription/TranscriptionIsNot(create mode 100644 app/Console/Commands/Crm/Backfill0pportunityUserFromAccountCommand.phpdelete mode 100644 app/Console/Commands/Elasticsearch/AsyncUpdateEsActivities.phpcreate mode100644 front-end/src/components/shared/modals/EntityPickerModal/__tests__/us‹create mode 100644 tests/Feature/Component/Nudge/Process0rganisationImmediateNudgesJobTe:create mode 100644 tests/Unit/Component/AiAutomation/Services/CrmFillingEligibilityCheck‹delete mode 100644 tests/Unit/Component/ES/ElasticSearchWorkerManagerTest.phpdelete mode 100644 tests/Unit/Component/ES/Worker/ActivityWorkerTest.phpdelete mode 100644 tests/Unit/Component/ES/Worker/EntityWorkerTest.phpdelete mode 100644 tests/Unit/Component/ES/Worker/WorkerAmountTest.phpcreate mode 100644 tests/Unit/Component/ParticipantSpeech/Services/ParticipantSpeechesCr‹create mode 100644 tests/Unit/Http/Controllers/Kiosk/ActivityControllerTest.phpLukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ I|HomeDMsActivityFilesLaterMore(aol§ Support Daily - in 2h 16 m100% <78•Wed 13 May12:44:45ED-→Describe what you are looking forJiminny ...Nikolay Ivanov6 0curoaroylau# engineering# general# jiminny-bg# platform-tickets# product_launches#random# releases# sofia-office# support# thank-yous# the_people_of jimi...MessagesAdd canvas@ Files+Lukas Kovalik 11.Today ~мен все ме праща наhttps://app.vanta.com/c/jiminny.com/employee/onboardingNikolay Ivanov 11:01 AMХм, Джейс дали не може да ти помогне?Lukas Kovalik 11:01 AMще питам James, предполагам че нямам правада мерсиNikolay Ivanov 11:01 AMмда° Direct messages& Nikolay Ivanovdo James Graham. Stoyan Tanev. Galya Dimitrova. Steliyan Georgievo Petko Kashinski®. Aneliya Angelovaã. Stefka Stoyanova•. Vasil Vasilev •!Lukas Kovalik y...МОЛЯLukas Kovalik 12:13 PMНики сори, още един въпрос имамкогато ги правеше ти FE ли оправяима vulnerabilities no npmNikolay Ivanov 12:28 PMнетях ги оставямLukas Kovalik 12:29 PMаз погледнах твоя тикет и там друго нямашесамо FEкак стигна до Workerl:: AppsJira CloudMessage Nikolay IvanovToast...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
32895
|
1257
|
11
|
2026-05-13T09:44:45.972358+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778665485972_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
PhostormINavigarecodeLaravelKeractorFV faVsco.jsPr PhostormINavigarecodeLaravelKeractorFV faVsco.jsProiect vC CreateTeam.pnpYC) IntecrationContr(C) InvitationControYC) OraanizationSeto reamcoachingsnanespace Jiminny hetp concroulers settingsleansO leamconterene› use •C) leamDealinsigh 18(C) TeamDomaince, 10tinal class Teamcontroller extends controllen© TeamMemberCc 20© TeamPhotoCont 21C) leamkecording: 22© TeamSettingsCc 23c) leamsorphone• D Users124109C) DashboardControlle 25c) GroupController.ohi 26C) JobTitleController.r 279 MomentController.r 29c) Plavbookcatedorvd 20C) PlavbookController. za> M Telenhonv• N Webhook• M HubsootM intearationAonSubs 34(C) ActivitvDroviderCor zc© ActivityTranscriptio 36© BaseController.php 37€ CalendarController. 38(C) PenortController nh z09a) SoftnhoneWehhool 4dc.AbstractController.ong 41( CommentContextinter 42© Controller.php4) SynortController.php© FrontendController.pht 46( FrontendControllerTraGeocodinaController.p cn0g© HealthCheckController 48@ LiveCoachController.ol 4gc)Missing Teamcontrolle saC) MobileController.oho(C) NotificationController.: s8(C) NotificationProviderCo 5:@ PlavbackController.oh@ PlavlistController.ohp(c) PucherControlier ohnYc) SlackController nhn8) SunnortController nhn(C) TeamSetunController* Create a new team. subscription and invitation.posTaoivlsettinas/oraanizationslkiosk.oraanizations.storelnublic function storeCreateTeamRequest Srequest,CreateTeam Screateteam.InvitelserToTeamAction SinvitelsertoteamAction.): void 1/** @var User $teamCreator */SteamCreator = $request->userO:try{$data = $request->allO:Steam = $createTeam->handle($teamCreator, $data, Srequest->getDomainO):SinviteUserToTeamAction->execute(UserInvitationDTO:: for0wner(Srequest, $team)):} catch (\Exception Sexception) {Log::error( message: "An error occurred while creating team'. "'e message' => sexception->qetmessaqeoi= Sexception->qetCodeoPUTlaoi/v1/kiosk/oraanizations/team›lkiosk.oraanizations.editoublic function editdTeam Steam.EdrtTeamPenues+ Srequest.EditTeam SeditTeam!): JsonResponse {...}572— 573587588589596597— 594596— 60€60660%— 609612|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]« console (PROD] X 4 console [EU]A console [STAGING]Tx: AutovSo jiminnyCONCAT(u.id, CASE WHEN U.id = t.owner_id THEN ' (owner)' ELSE'' END) AS user_id,040 A1 A40 V 64 ^sa.*t.owner_id FROM social_accounts saNolN usens u on u.id e sa.sociablle i.diJOIN teams t .n<->l: on t.id = u.team_icWHERE 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 za desc;sclzu * Frur automated revort resulrsWHERE id = 1919select * from automated report results WHERE renort 10 = 54:select * from opportunities where 1d = 75943494SELE * FROM teams WHERE name LIKE "%Les%': # 711, 692. 16067 - Timinnvintearationdlesmils.comselect * from playbooks where team id = 711; # event 226147SELEd * FROM Davbook catedonies WHERE Dlavbook 10 e 55151SELECT * SROM eom fields WHERE eom confiauration 1d = 692 and obnect tvne =SELECT * SROM com fields WHERE 1d = 226147-SELECT * EROM eom field values WHERE com field 1d = 226147.SELECT * FROM crm_configurations WHERE id = 692;SELSCTCONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '• END) AS user_id,nemailiSa.xt.owner id FROM social accounts saJOIN users u on u.id = sa.sociable idJOIN teams t 1..n<->1: on t.id = u.team idWHERE U.team id = 711 and sa.provider = 'salesforce':SELECT * FROM crm profiles co JOIN users u 1..n<->1: on u.id = co.user id WHERE u.team_id = 711:select * from leads:select * from calendars:SELECTS0 hlsuppont Dally • In Zn 10m100% L2• Wed 13 May 12:44:45AskJiminnyReportActivityServiceTest -CascadeTrial Owner Role Selec+0 ..kead kegistercontroller.php ana OnboardController.pnp ›Searched UserRegistered invitation. accept in ~/iminnyappThought for 3s ›Read UpdateProtile.phg0// tasks done ?• Review current role assianment when owner sians in7 Document findinas and provide imolementation olanInoughttor 4s7 7 tasks done)Ihought for 4SCurrent Flow Analvsis: Owner Role Assianment in Trial CreationBackend Flow1. Team Creation Entrv Point• TeamController::store() (lines 24-45)app Actions/InviteUsertoreamaction.php the team• Calls InviteUserToTeamAction with UserInvitationDTO: : for0wner(Srequest, Steam)2. Owner Role Assianment (HARDCODED)• UserInvitationDTO:: for0wner() (lines 52-72 in/app/DTO/Invitation/UserInvitationDT0.php)•Lines 54-57: This is where the owner's role is hardcodediohrUser:: ROLE RECORDER,→>oluck("id')→>toArravo:•Alwavs assians ROLE ADMIN + ROLE RECORDER to the ownenThic ic the koy ioention that noode modification3. Invitation Creatior•InviteUserToTeamAction::execute@ (lines 28-81)• Creates an Invitation with roles from the DTO (line 45: Sinvitation->roles()->sync(Sdto->roleIds))• Sends OwnerInvitedToTrial notificationl1 Owner Sian-in FlowOwner receives email invitation• Regrstercontroller:: showRegnstratonformo shows registration form with invitation dataOwner redisters and accents invitationRoles are already assigned via the invitation, so owner gets ROLE ADMIN + ROLE RECORDER automaticallvFrontend FlowAsk anvthina (84-D)« Code SWF-1.6O0 1WN Windsurf Teams26.52UTE.8io 4 spaces...
|
NULL
|
-5932179578530406328
|
NULL
|
click
|
ocr
|
NULL
|
PhostormINavigarecodeLaravelKeractorFV faVsco.jsPr PhostormINavigarecodeLaravelKeractorFV faVsco.jsProiect vC CreateTeam.pnpYC) IntecrationContr(C) InvitationControYC) OraanizationSeto reamcoachingsnanespace Jiminny hetp concroulers settingsleansO leamconterene› use •C) leamDealinsigh 18(C) TeamDomaince, 10tinal class Teamcontroller extends controllen© TeamMemberCc 20© TeamPhotoCont 21C) leamkecording: 22© TeamSettingsCc 23c) leamsorphone• D Users124109C) DashboardControlle 25c) GroupController.ohi 26C) JobTitleController.r 279 MomentController.r 29c) Plavbookcatedorvd 20C) PlavbookController. za> M Telenhonv• N Webhook• M HubsootM intearationAonSubs 34(C) ActivitvDroviderCor zc© ActivityTranscriptio 36© BaseController.php 37€ CalendarController. 38(C) PenortController nh z09a) SoftnhoneWehhool 4dc.AbstractController.ong 41( CommentContextinter 42© Controller.php4) SynortController.php© FrontendController.pht 46( FrontendControllerTraGeocodinaController.p cn0g© HealthCheckController 48@ LiveCoachController.ol 4gc)Missing Teamcontrolle saC) MobileController.oho(C) NotificationController.: s8(C) NotificationProviderCo 5:@ PlavbackController.oh@ PlavlistController.ohp(c) PucherControlier ohnYc) SlackController nhn8) SunnortController nhn(C) TeamSetunController* Create a new team. subscription and invitation.posTaoivlsettinas/oraanizationslkiosk.oraanizations.storelnublic function storeCreateTeamRequest Srequest,CreateTeam Screateteam.InvitelserToTeamAction SinvitelsertoteamAction.): void 1/** @var User $teamCreator */SteamCreator = $request->userO:try{$data = $request->allO:Steam = $createTeam->handle($teamCreator, $data, Srequest->getDomainO):SinviteUserToTeamAction->execute(UserInvitationDTO:: for0wner(Srequest, $team)):} catch (\Exception Sexception) {Log::error( message: "An error occurred while creating team'. "'e message' => sexception->qetmessaqeoi= Sexception->qetCodeoPUTlaoi/v1/kiosk/oraanizations/team›lkiosk.oraanizations.editoublic function editdTeam Steam.EdrtTeamPenues+ Srequest.EditTeam SeditTeam!): JsonResponse {...}572— 573587588589596597— 594596— 60€60660%— 609612|aravel.l0gA SF (jiminny@localhost]4 HS_local [jiminny@localhost]« console (PROD] X 4 console [EU]A console [STAGING]Tx: AutovSo jiminnyCONCAT(u.id, CASE WHEN U.id = t.owner_id THEN ' (owner)' ELSE'' END) AS user_id,040 A1 A40 V 64 ^sa.*t.owner_id FROM social_accounts saNolN usens u on u.id e sa.sociablle i.diJOIN teams t .n<->l: on t.id = u.team_icWHERE 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 za desc;sclzu * Frur automated revort resulrsWHERE id = 1919select * from automated report results WHERE renort 10 = 54:select * from opportunities where 1d = 75943494SELE * FROM teams WHERE name LIKE "%Les%': # 711, 692. 16067 - Timinnvintearationdlesmils.comselect * from playbooks where team id = 711; # event 226147SELEd * FROM Davbook catedonies WHERE Dlavbook 10 e 55151SELECT * SROM eom fields WHERE eom confiauration 1d = 692 and obnect tvne =SELECT * SROM com fields WHERE 1d = 226147-SELECT * EROM eom field values WHERE com field 1d = 226147.SELECT * FROM crm_configurations WHERE id = 692;SELSCTCONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '• END) AS user_id,nemailiSa.xt.owner id FROM social accounts saJOIN users u on u.id = sa.sociable idJOIN teams t 1..n<->1: on t.id = u.team idWHERE U.team id = 711 and sa.provider = 'salesforce':SELECT * FROM crm profiles co JOIN users u 1..n<->1: on u.id = co.user id WHERE u.team_id = 711:select * from leads:select * from calendars:SELECTS0 hlsuppont Dally • In Zn 10m100% L2• Wed 13 May 12:44:45AskJiminnyReportActivityServiceTest -CascadeTrial Owner Role Selec+0 ..kead kegistercontroller.php ana OnboardController.pnp ›Searched UserRegistered invitation. accept in ~/iminnyappThought for 3s ›Read UpdateProtile.phg0// tasks done ?• Review current role assianment when owner sians in7 Document findinas and provide imolementation olanInoughttor 4s7 7 tasks done)Ihought for 4SCurrent Flow Analvsis: Owner Role Assianment in Trial CreationBackend Flow1. Team Creation Entrv Point• TeamController::store() (lines 24-45)app Actions/InviteUsertoreamaction.php the team• Calls InviteUserToTeamAction with UserInvitationDTO: : for0wner(Srequest, Steam)2. Owner Role Assianment (HARDCODED)• UserInvitationDTO:: for0wner() (lines 52-72 in/app/DTO/Invitation/UserInvitationDT0.php)•Lines 54-57: This is where the owner's role is hardcodediohrUser:: ROLE RECORDER,→>oluck("id')→>toArravo:•Alwavs assians ROLE ADMIN + ROLE RECORDER to the ownenThic ic the koy ioention that noode modification3. Invitation Creatior•InviteUserToTeamAction::execute@ (lines 28-81)• Creates an Invitation with roles from the DTO (line 45: Sinvitation->roles()->sync(Sdto->roleIds))• Sends OwnerInvitedToTrial notificationl1 Owner Sian-in FlowOwner receives email invitation• Regrstercontroller:: showRegnstratonformo shows registration form with invitation dataOwner redisters and accents invitationRoles are already assigned via the invitation, so owner gets ROLE ADMIN + ROLE RECORDER automaticallvFrontend FlowAsk anvthina (84-D)« Code SWF-1.6O0 1WN Windsurf Teams26.52UTE.8io 4 spaces...
|
32893
|
NULL
|
NULL
|
NULL
|
|
49911
|
1771
|
66
|
2026-05-18T07:04:02.527452+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087842527_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-5144026249968099006
|
1739586043254377858
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comNikolay Yankov (Presenting)Ede0 +8 QЗEACKIapiMsettingslorganizationsfiles to include0S8E6fies to exclude119 results in 56 files - exclude settings and ignore files are dizabled (enable) - Open is/apw/ylhettings/orgarczabons//team.value.jo//playbooks*Prpww/pattingsforganizationa/S(team.vatuo.l)/group/S(propa.id//douiRialosam vanue 1d)/group/S(args.id)/scopeаIОRGФ:0UAEERAtURiK11 deal-insights-fäters json$ws.compary.ld)/themes/imoort(I tools-list.json) tools-iszgson (Working Thee)бооз, пер ) вкріосие 0 екріосеснальAncesaute chattroineta nases vitwport contente wiothedevice-width, snacsal-scale).0 /»titte-Jiatuny MCP - Tools Explorerc/title>DLYNCbox-sizing: border-box;padding: e;Bogot-Fpsilyr -astesystes, BlinifucSystafert, Seye И1*, 5и0-4т1).васхуre: Оeтersга:colors BniEhieader {border-bottom, tpx solil Ondelterрабозлд: 14рк 200кdisplayr flexiauierasess centereдир: 12шк:eader N &font-size: L5pxgTont-veiat7o0coter: Bntt:teader som (tools.ndLvatuo id)/dosi-insightsMрикiловгоко оАльосоти нрароммaоiреyооока lrо(5. Nen update woatsceCro-)saley eslara7 noee pesate.t9-tosls-LIst-des.Ign-2MacBook-Pro-Jiminay explorer & git push11,43 MiB/S.pack-reused e [1ron 0)conpleted with 6 tacal ebjects.Mecbook-Pro-Jiairey exglorer. 5.Пl10:04 AM | Daily - PlatformDaily - Platform • 1 m left100% C8 • Mon 18 May 10:04:023Mon 18 May 10:04O ta 9ШAo 28.° 20129Nikolay Yankov82% - 8еLukas Kovalik• 17:36....
|
49909
|
NULL
|
NULL
|
NULL
|
|
49912
|
1772
|
31
|
2026-05-18T07:04:06.011481+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087846011_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.05618351,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
-8603436982613086966
|
-8708828999581586494
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
PhostormProiect vcodeC) TeamCoachingSettingscontroller.f © ConvertLeadActivities.png© SyncToPlanhat.phpC leamconterencesetuingscontrolle0) TeamController.oneC1eambealinsigntssettingcontrollercreatePlaybookcreatedevent.ong©) salestorce/service.phpleambomainscontroller.onp" TeamMemberController.phpTeamPhotoController.pho© UserAutomatedReportsController.phppnp api.ono" TeamController.phpc) IntearationApp/Service.php(C) CreateCommentedEvent.phpC) CreateSmsSentEvent.pho(C) TeamRecordingSettingscontrollerC) PlanhatactivityListener.php(C) AutomatedReportsRepository.ohp©TeamsettingsController.phpc) TeamsoftphoneSettingscontroller.©AutomatedReportsCommand.ohpphp api_y2.ohdC) RequestGenerateReport.Job.ohv• D Usersc) DashboardController.ohp© GroupController.phpc).oolitlecontroller.ono@ MomentController.phnC) PlavbookCategorvControlier.ohvC) PlavbookController.oho>• Telephonyv M WehhookM Lubsnot>D IntegrationAppSubscriptions© ActivityProviderController.php© ActivityTranscriptionController.php(c) RaseController.ong0 CalendarController.phpkeporcontoller.onp0 SoftnhoneWebhookController.php(a AhctractController.pho@ CommentContextinterface.php© ConferencesOptInOutController.phpc) controller.php€ ExportController.php© FrontendController.php© FrontendControllerTrait.php€ Geocodina Controller.pho(C)HealthCheckController.ono@ LiveCoachController.ohdC) MissinaTeamController.ohoC)MobileController.ohv@ NotificationController.phpC)NotificationProviderController.ohnl@ PlavbackController.nhnC) PlavlistController.nhnl(C) PucherController.nhn"C) SlackController nhn8) SunnortController nhn(C) TeamSetunController.nhn© UserAutomatedReportsController.php© WelcomeController.php• M Middlowaro• M Requests(C)AutomatedReportResult.ohv© CreateTeamRequest.phpC) UserinvitationDTo.onpEЗAYfinal class TeamController extends Controller* Create a new team, subscription and invitation.24 (U9pudLlc tunction scorelCreateTeamRequest Srequestreateleam Screateleam,InviteUserToTeamAction SinviteUserToTeamAction): void {|/** @var User SteamCreator */SteamUreator = Srequest->usero*sdata = Srequest->allo:steam = ScreateTeam->handle Steamcreator. Sdata. Srequest->aetlomainoosinvitelserToTeamAct.ion->executeUserinvitationDT0:: Forowner Sreauest} catch (\Exception $exception) {Loa: errord messade: "An error occurred whille creatind team'.'e messagel => Sexcention->aetMessadeol.i'e codel => Sexcention->aetCode0..throw Sexception;DulT lonilv1/kiockloraanizationelftoaml. fkinck oraanizatione oditf47 Cpublic function edit(Toam C+oamEditTeamRequest SrequestEditTeam SeditTeam): JsonResponse {...}Ask anvthina (&4-L)SWF.16lled (4 minutes aao)=custom.log4 SF [jiminny@localhost]& console (STAGINGIA HS_local [jiminny@localhost]A console [PROD]© TestPipedriveOfficialSdkCommand.php X © Kernel.phpcancalle=use Jiminny models redmuse Pipedrive verszons vz Ap1 ACCIviclesAp1use Pipedrive\versions\v2\Api ActivityFieldsApi:use Pipedrave verszons vz Ap1 Ueaurielasap1use Pipedrive\versions\v2 \Api\DealsApi:use Pipearive versions vz Ap1 Personrlelasapluse Pipedrive verszons vc Ap1 PersonsAD1.use Pipedrive versions vz contzquration.|1 usagel22 024026 @32 6Tprotected Ssignature = "11m1nnv:test-p1pedrive-officral-sok teamid-'*protected Sdescnintion = 'Test official Pinednive SDK (oinednive/ninednive) with exiorivate arrav Sresults = 13lusageprivate EncryptedTokenManager $tokenManager:no usagespublic function __construct(EncryptedTokenManager $tokenManager)parent:: construct?).sthls->cokennanager = Scokenmanager;public function handled: intf...}1 usageprivate function runTests(int SteamId): void{...}1 usageprivate function test0AuthInitialization(SocialAccount SsocialAccount): voidf...?1 usageorivate function testBasicCrudOperations(SocialAccount SsocialAccount: void$this->info( string: 'Test 2: Basic CRUD Operations');tny-Il Get the naw token from datahaseSnawhhToken = SsocialAccount->ae+ProviderilserToken0•.strlen(SrawDbToken)."")•Trial Owner Role SelecNot Shown when editingModal used for botn create/editOwner gets selected role + AdminAlways gets Admin + RecorderReplace Opportunity Sync Period locationCurrently at lines 71-84Part of Create TeamHandled in SditTeamModalImplementation PlanFrontend Changes1. EditTeamModal.vue• Add role selection tield below Owner email (after line 39Onlv show when creatina team ( Iflaas. teamGreated )•Move Opportunity Sync Period field to 3rd row, 1st column (after CRM field)• Add role options: Recorder, Recorder & Voice, Analyst• Add owner role to form state1. CreateTeamRequest.oho• Add validation rule for ouner role field• Allowed values: recorder, recorder and voice, analyst• Onlv required when creatina (not editina)2. UserinvitationDTO::forOwner()• Accept owner_role parameter from request• Map role name to role IDAlways add ROLE_ADMIN to the role IDs (as per requirement: "selected role + Admin permissions")• Replace hardcoded ROLE RECORDER with selected role3. EditTeamRequest.php• Ensure ouner role is NOT acceoted when editina (validation should reiect it)Key Files to Modify1. /front-end/src/components/Settings/Kiosk/modals/EditTeamModal/EditTeamModal.vue2. /app/Http/Requests/Settings/Teams/CreateTeamRequest.php3./app/DT0/Inv1tation/UserInv1tat1onDT0.php4. /app/Http/Requests/Settings/Teams/EditTeamRequest.phpTectina Considerationc•Test role assignment for all 3 options (Recorder, Recorder & Voice, Analyst)Verity Admin permission is alwavs addedEnsure field is hidden when editing existing team• Verify Opportunity Sync Period moves to correct location• Test owner sign-in flow with each role option# Daily - Platform • 1 m left100% L2• Mon 18 May 10:04:05AskJiminnyReportActivityServiceTest v+0..Condition: v-ir="!Tlags. teamcreated"Modify UserInvitationDT0:: for0wner() to use selected role + AdminMove Opportunity Sync Period, add role field in its placesame component handles bothCal aWN Windsurf Teamc28-14 UTE.8io 4 spaces...
|
49910
|
NULL
|
NULL
|
NULL
|
|
49913
|
1771
|
67
|
2026-05-18T07:04:07.461265+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087847461_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
-3151030086593068747
|
-8132289082438734906
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comNikolay Yankov (Presenting)FleEdit0 €Selection8 QOLLEGIapiM/settings/organizationsfies to includefront-endfies to excludenode_modules, coverage, *html, storage, *snap, storage/ßogs, vendor119 results in 56 files - exclude settings and ignore fies are disabled (enable) - Open ineao-oapw/v/Jsettings/organczabons//team.value.jo//playbooksW DealRisksModal. vue troet-end/wrc/components/Settioos/OrgSettings/Teams" lapi/w/settings/organizations/3(beam.value.id)/group/$(props.id/dealRisksPermissionsModalwue trgne-end/wcicomoonents/Settings/OrgSattings/Team*/apiv//settings/organizations/9(beam.value.ia/group/S(ergs.id)/scopen Con WoreiewecomoWeeoneWlooemoceWa*/api/v1/settings/organizations/.companyid/themes/import",w/3(this.company.id)/themes,fmport"napus wornreroure comconst endpo = */apivilnа*ОRGФ:0{1 deal-example.json(1 deal-insights-filters json18tvalue.jd)/deal-insights"t/3(wwam.value.ic)/desl-insightspeouyiseteng wordantcrunseamuю hpayoooks tree*Japi/v1/settings/organizaurzoosoruco( tools-list.json1) tools-listjson (Working Tree)docs mão ) explorer) 0 expionAnceacote chanttneiecontente Widthadevice-width, 1nitial-scale-1.0 /»«title-Jininy MCP - Tools Explorer</title>box-sizing: border-box;padding: 0:font-fanily: -apple-systen, BlinkMacSystenfont, "Segoe VT", sans-serif;background: Cersrsta:color: mnls:header (OkcAtrOw DTTborder-botton: 1px solid rese7eb;padding: 14px 24px;display: flex;auignoatess contereader Mi (font-size: 15pK;Yont-wetohtt 70color: Mn11:font-size: 12px:weow Dontowtten-tools-list-design-2Pro-Jiminy explorer s node penerate.jstools.ndCountung co ctat ((12/22), 1.0 кIвMacBook-Pro-Jiainey explorer & git push|-Macbook-Pro-Jiminny explorer.s 0l10:04 AM | Daily - PlatformDaily - Platform • 1 m left100% C8• Mon 18 May 10:04:07AA3Q 8+ Mon 18 May 10:049 ta Ф0Ao 25.° 201 2914E xINikolay Yankov2sh - expiorerLukas Kovalik• 17:41|...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49914
|
1771
|
68
|
2026-05-18T07:04:11.238291+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087851238_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"3","depth":4,"on_screen":true,"role_description":"text"}]...
|
5978453182737298168
|
-8132297809814377534
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comNikolay Yankov (Presenting)SalectionD €OSLEGIapiV/settings/organizationsfies to includefront-endfies to excludenode_modules, coverage, *html, storage, *snap, storage/ßogs, vendor119 results in 56 files - exclude settings and ignore files are disabled (enable) - Open ineaor-ap:/v//settings/organizabons/fteam.value.jo//playbooksDealRisksModal.wue ffront-end/wrc/components/Settings/OrgSettings/Teamns*lapi/wi/settings/organizations/9(beam.value.id)/group/$(props.is/deaiRisksV PermissionsModalwue front*/api/v//settings/organizations/5(beam.value.ia)/group/S(args.id)/scope"const endpoint = "fapilViisetD Con Woreiewecoins/.companyid/themes/import",*lapiwl/settings/organizaV UploadCi vue front-enreturn */apiM/settings/organian spus wornereconst endpoint = */apiViises.company.ld)themes, fmportПКОRФФ:0(1 desl-example.json1) deal-insights-filters json18n.value.id)/deal-insights*.*apiwN/settings/organizations/(team.value.ic)/desi-insights*,Peouy vseteno mordanzacontnpanormaamuo npley oooks tree*Japi/vN/settings/organizatieJyz0oso-nko-lo() tools-list.json1) tools-listjson (Working Tree)docs mop explorer) 0 expiocechomi».wtecherteeiecontentewidth.device-width, 1nitial-scale.1.0 /›«title-Jiajnny MCP - Tools Explorer«/title›box-sizing: border-box;padding: e;font-fanilyt -apple-systen, BlinkMacSystenfont, "Segoe UT", sans-serif;background: Crrsrsta:color: mnls:header (OKAtrOw DTTborder-botton: 1px solid Crese7eb;padding: 14px 24pk;display: flex;augneatess ceterseader Mi &font-size: 15pkgTont-wetohtt 7ecolor: Mn11:header span (font-gize: 12pa0weouDenowatten-tools-List-design-2Pro-Jiminny explorer & node penerate.jstools.ndMacBook-Pro-Jiminey explorer & git push23, 1.0 кгв&4Ra0/SMactook-Pro-Jiminny explorer. &.П10:04 AM | Daily - PlatformDaily - Platform • 1 m left100% (478• Mon 18 May 10:04:10|AA3Q 8• Mon 18 May 10:049 t Ф0Ao 28.° 10129Nikolay Yankovash - expiorerLukas Kovalik• 17:45....
|
49913
|
NULL
|
NULL
|
NULL
|
|
49917
|
1771
|
71
|
2026-05-18T07:04:20.308442+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087860308_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.02013889,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.025555555},"on_screen":false,"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.0,"top":0.0,"width":0.014583333,"height":0.025555555},"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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}]...
|
6266791753600426303
|
34631148349319828
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49918
|
1771
|
72
|
2026-05-18T07:04:26.396373+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087866396_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
159902063232581519
|
-8204417045388611642
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comNikolay Yankov (Presenting)EditDJsLS0legiM/settings/organizationsfies to includeTies to exclude119 results in 56 files - exclude settings and ignore fles ace disabied (enable) - Open i»"/woiMt/settings/organizations/9(team.value.id)/notificationsconst teamDomainsResource = */ioiW/settings/organizations/3(beam.ich/domheiM/pettingsforganizationg/Siteam value id)hetention-polieycousarnoles wore*Ikp/MVsettngstorgВIОRGФ:023a18n-recording(0 toots-lstjson /Wicrking Tree)Y CreateEditfeamModatvue 1 Xconst ( countriesArray, tinezonesArray, initTinezones, tinezonesfieady ) -ahatiteseelit (args.10) €titleText,value - "Esit. Tean";asyne function subeitfors)tet updateResponse:af (args.ua) &updateRespense • avnit spdstelPattes.so 0oe.281/0r000579targ5.20%) etre ‹nethed: "sost",nges sshasfcature.valael "SIDLKIOK SETTINSconst alatochesalt = avalt svat,firei‹is dasabled"-tosls-ILst-des.Ign-2MacBook-Pro-Jininty explorer & git, push. 1.0 кin11.43 NiB/s.conplctto wathe toct co ss-MacBook-Pro-Jininay exglorer 3П10:04 AM /Daily - PlatformDaily - Platform • 1 m left100% <78 • Mon 18 May 10:04:25=AA3A 2.° 20118* Mon 18 May 10:0414z xINikolay Yankov82h - шро+-Lukas Kovalik• 18:00...
|
49917
|
NULL
|
NULL
|
NULL
|
|
49919
|
1771
|
73
|
2026-05-18T07:04:29.408579+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087869408_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
6060535724068135257
|
-8636771062079050362
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comNikolay Yankov (Presenting)D €OStESlapi/M/settings/organizationsfies to includefies to excludenode_modules, coverage, *html, storage, *snap, storage/fogs, vendor119 results in 56 files - exclude settings and ignore files are disabled (enable) - Open in*Iwoi/vt/settings/organizations/9(team.value.id)/notificationsconst teamDomainsResource = */hpiVl/settings/organizations/S(beam.ich/dom/wp/w1/settings/organizations/S(team.value.id)/retention-policyizationid/retention-policy*lapi/vi/settings/organizad18B0S 10L() tools-listjson (Working Tree)|VCreateEditTeamModatvue 1 Xа*ОSФО:0() deal-examplejson(1 desl-insights-filters.json234Proo Cu18Settings/Sidelick( countriesArray, tinezonesArray, InitTinezooes, tinezonesReady ) •ahatuarereelit (args.1a) €titleText.value • "Edit Tean";asyne function subeitfore))tet updateResponse:1f (args.18) €)updateResponse • avait updatelssttesn.watwe:191/9roup5/918rg5.10%) else ‹1034/V4X4 3/010804281200912 800m1000800menethod: "post",anges 56hasfeature.valuel"SIDEKICK-SETTINGS"is disaoledSonarOube Oicp-tools-List-design-2MacBook-Pro-Jininy explorer & git push|(02/22), 1.0 ків11.43 MiB/s.(fron e)completed with 6 local ebjects.-MacBook-Pro-Jininny explorer. N.П10:04 AM /Daily - PlatformDaily - Platform • 1 m left100% <78• Mon 18 May 10:04:28AA38• Mon 18 May 10:04+ 00Ao 2.° 20r1|44E xINikolay Yankov3ash- epiore +-Lukas Kovalik18:03111...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49920
|
1771
|
74
|
2026-05-18T07:04:35.476597+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087875476_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
8681765016529791095
|
-8348540754415211066
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
FirefoxFilelEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comNikolay Yankov (Presenting)Tớt57 ISRO-X mn0 Attent83 МСР-( Schee© Curso|[URL_WITH_CREDENTIALS] YankovLukas Kovalik18:09...
|
49919
|
NULL
|
NULL
|
NULL
|
|
49921
|
1771
|
75
|
2026-05-18T07:04:38.504326+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087878504_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
159902063232581519
|
-8204417045388611642
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
FirefoxFilelEditViewHistoryBookmarksProfilesToolsWindowHelp> 0meet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comNikolay Yankov (Presenting)1857 (SRO-3 Altent83 МCP-( ScherCurso* C[URL_WITH_CREDENTIALS] Kovalik18:12...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49922
|
1772
|
32
|
2026-05-18T07:04:39.877917+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087879877_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.05618351,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
-5144026249968099006
|
1739586043254377858
|
idle
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
PhpStormViewINavicareCodeLaravelFV faVsco.js?° pipedrive-sdk-pocProiect v@ OrganizationLicensesController.phpOrganizationMembersController.php(C) OraanizationRetentionPolicvControlleCConvertLeadActivities.ong9 PurgeLookupCache.php© SyncToPlanhat.php© OrganizationRolesController.php© OrganizationSyncController.php0 DartnerController.php© PhoneNumberController.php© PlaybackController.php© PlaylistController.php© ScimController.phpSidekickController.php© SoftphoneController.phpc) ssocontroller.onoc) suoscripuioncontroller.ono© TeamAiAutomationController.phpC) TeamAiContextController.ohvTeamController.phpC)Teaminsiahtscontroller.ohoc)TranscriotionControlller.onoc)Translationcontrolller.ono© UserController.php@ VocabularvController.ohnMAuth> M CustomerAoi•M Internalv D Kiosk> M Teame© ActivityController.php@ AutomatedReportsController.php© DashboardController.php©ImpersonationController.php© MediaPipelineController.php© OrganizationsController.phpPartnersController.php© ProfileController.php© SearchController.phpv @ Settings> D Coachina> D Profile© CreatePlaybookCreatedEvent.php© UserAutomatedReportsController.ph" TeamController.php© IntearationApp/Service.php(C) CreateCommentedEvent.phpC) CreateSmsSentEvent.pho© PlanhatActivityListener.php© AutomatedReportsRepositorv.phpC) RequestGenerateReport.Job.ohd(C)AutomatedReportResult.ohv4) CreateTeamPequest.nhn© UserinvitationDTO.phpfinal class TeamControllen extends Controllen24 (U929POST /api/v1/settings/tions (kiosk.organizations.storelpublic function store(CreateTeamRequest SrequestCreateTeam ScreateTeamInviteUserToTeamAction SinviteUserToTeamAction): void {/** @var User SteamCreator */SteamCreator = Srequest->userO:$data = Srequest->al10:Steam = ScreateTeam->handle(SteamCreator, Sdata. Srequest->getDomainO)SinvitelserToTeamAction->execute(UserInvitationDT0::for0wner(Srequest} catch (\Exception Sexcention) {Log: :error( message:'An error occurred while creating team', ['e messagel => Sexcention->aetMessadeori'e codel => Sexcention->aetCode0.v D Teams> M Billine>MUtils8 Integration Controller oho@ InvitationController.ohp@ OrganizationSettinasController.ohr. nhlsthrow Sexception;DUT lonilv1/kiocklorannizatione/ftoaml fkinck orannizatione oditllC) TeamActivitvController.oho(C) TeamCoachinaSettinasController.r zoYc) TeamController nhopublic function edit(Team SteamEditTeamRequest Srequest.EditTeam SeditTeam): JsonResponse {...}(C) TeamDealinsiahtcSettinaController co(C) TeamDomainsController nhn=custom.logA SF [jiminny@localhost]& console (STAGINGIA HS_local [jiminny@localhost]A console [PROD]© TestPipedriveOfficialSdkCommand.php X © Kernel.phpcancalle=use Jiminny models redmuse Pipedrive verszons vz Ap1 ACCIviclesAp1use Pipedrive\versions\v2\Api ActivityFieldsApi:use Pipedrave verszons vz Ap1 Ueaurielasap1use Pipedrive\versions\v2 \Api\DealsApi:use Pipedrive versions vz Ap1 Personrlelasap1use Pipedrive versions v Ap1 Personsap1%use Pipedrive versions vz contzquration.11 usage22024 @32 61protected Ssignature = "11m1nnv:test-p1pedrive-officral-sok teamid-'*protected Sdescnintion = 'Test official Pinednive SDK (oinednive/ninednive) with exiorivate arrav Sresults =1lusageprivate EncryptedTokenManager $tokenManager:no usagespublic function __construct(EncryptedTokenManager $tokenManager)parent:: construct?).sthls->cokennanager = scokenmanager;public function handle@: intf...}1 usageprivate function runTests(int SteamId): void{...}1 usageprivate function test0AuthInitialization(SocialAccount SsocialAccount): voidf...?1 usageorivate function testBasicCrudOperations(SocialAccount SsocialAccount: void$this->info( string: 'Test 2: Basic CRUD Operations'):tny-Il Get the naw token from datahaseSnawhhToken = SsocialAccount->ae+ProviderilsenToken0-.strlen(SrawDbToken)."")•Ask anvthina (&4-L)SWF.16led (5 minutes aaollTrial Owner Role SelecNot Shown when editingModal used for botn create/editOwner gets selected role + AdminAlways gets Admin + RecorderReplace Opportunity Sync Period locationCurrently at lines 71-84Part of Create TeamHandled in SditTeamModalImplementation PlanFrontend Changes1. EditTeamModal.vue• Add role selection tield below Owner email (after line 39Onlv show when creatina team ( Iflaas. teamGreated )• Move Opportunity Sync Period field to 3rd row, 1st column (after CRM field)• Add role options: Recorder, Recorder & Voice, Analyst• Add owner role to form state1. CreateTeamRequest.oho• Add validation rule for ouner role field• Allowed values: recorder, recorder and voice, analyst• Onlv required when creatina (not editina)2. UserinvitationDTO::forOwner()• Accept owner_role parameter from request• Map role name to role IDAlways add ROLE_ADMIN to the role IDs (as per requirement: "selected role + Admin permissions")• Replace hardcoded ROLE RECORDER with selected role3. EditTeamRequest.php• Ensure ouner role is NOT acceoted when editina (validation should reiect it)Key Files to Modify1. /front-end/src/components/Settings/Kiosk/modals/EditTeamModal/EditTeamModal.vue2. /app/Http/Requests/Settings/Teams/CreateTeamRequest.php3./app/DT0/Inv1tation/UserInv1tat1onDT0.php4. /app/Http/Requests/Settings/Teams/EditTeamRequest.phpTectina Considerationc•Test role assignment for all 3 options (Recorder, Recorder & Voice, Analyst)Verity Admin permission is alwavs addedEnsure field is hidden when editing existing team• Verify Opportunity Sync Period moves to correct location• Test owner sign-in flow with each role option# Daily - Platform • 1 m left100% Lz• Mon 18 May 10:04:39AskJiminnyReportActivityServiceTest v+0..Condition: v-ir="!Tlags. teamcreated"Modify UserInvitationDT0:: for0wner() to use selected role + AdminMove Opportunity Sync Period, add role field in its placesame component handles bothCal aWN Windsurf Teams26.55UTE.RPo 4 spaces...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49923
|
1771
|
76
|
2026-05-18T07:04:41.540391+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087881540_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
7962651264686056251
|
-7483856360197085818
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
FirefoxFilelEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comNikolay Yankov (Presenting)1857 (SRO-3 Altent83 МCP-( ScherCurso* C[URL_WITH_CREDENTIALS] Kovalik18:15...
|
49921
|
NULL
|
NULL
|
NULL
|
|
49924
|
1771
|
77
|
2026-05-18T07:04:45.184796+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087885184_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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:...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
-7604902774419856561
|
-8132297809814508602
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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:
FirefoxFilelEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comNikolay Yankov (Presenting)18Edit57 (SRO-1X Jimir3 Altent83 МCP-( ScherCurso* C[URL_WITH_CREDENTIALS] Kovalik18:19...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49925
|
1771
|
78
|
2026-05-18T07:04:48.246063+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087888246_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
-5144026249968099006
|
1739586043254377858
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
FirefoxFilelEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comNikolay Yankov (Presenting)1857 (SRO-1X Jimir3 Altent83 МCP-( ScherCurso* C[URL_WITH_CREDENTIALS] Kovalik18:22...
|
49924
|
NULL
|
NULL
|
NULL
|
|
49926
|
1771
|
79
|
2026-05-18T07:04:51.234689+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087891234_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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}]...
|
8842634753363399705
|
-8992542723600598576
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49927
|
1771
|
80
|
2026-05-18T07:04:54.287520+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087894287_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
159902063232581519
|
-8204417045388611642
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comNikolay Yankov (Presenting)18Platform Team %.Q Search boardNotify the user if adeieted but is used in AJ…..AJREPORTSBacklogR JY-206763 a000 =Notify the user if a SS isoc ei0d outls useoinAdNewetAJREPORTSBacklogД JY-206151%000Upgrade BE Ibraries - MayMAINTENANCEKacwaE JY-19958suggestionsAUTO-DETEGTED ACTIVITY TYРОDockoeP JY-204702 •900=•.G057 (SRO-X Jmir3 Altent83 МCP-( ScherCurso* ClaudeCostleJmin0 МСР T.3 Poel• C[URL_WITH_CREDENTIALS] Kovalik18:28...
|
49926
|
NULL
|
NULL
|
NULL
|
|
49928
|
1771
|
81
|
2026-05-18T07:05:00.352591+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087900352_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.02013889,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.025555555},"on_screen":false,"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.0,"top":0.0,"width":0.014583333,"height":0.025555555},"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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}]...
|
6266791753600426303
|
34631148349319828
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49929
|
1771
|
82
|
2026-05-18T07:05:03.387872+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087903387_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
-3151030086593068747
|
-8132289082438734906
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelpPreparation for Refi... in 4 h 55 ml100% <28• Mon 18 May 10:05:03)meet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comNikolay Yankov (Presenting)AAPlatform Team %.Q Search boardKAOTTOKONotify the user if anotat0omedeleted but is used in AJ…..AJREPORTSBacklogP Jy-206763 +000=deleted but is used in AJnewertAJREPORTSBacklogД JY-206151%000Upgrade BE Ibraries - MayMAINTENANCEE JY-19958suggestionsAUTO-OETEGTED ACTIVITY TYPОDeckoeP JY-204702 •000=52 ISRO-3 Altent83 МСР-( ScherCurso* Claudenny.atlassian.net/jra/software/c/projects/JJY/boards/37?selectedissue=JY-2061323 SSHE Datadogs00P JI-12SS11 JT-201SAllow owner's role to be selected when setting up a trial~ DescriptionStoyan is seeing more cases where the Owner doesn't want to connect their calendar and email to Jiminny. This isbecause they don't want to be a recorder. Currently when a trial is created we glve the Owner a Recorder role by default.In most cases he really needs to be a recorder.• allow Implementations to select the role of the owner when setting up a trialput the field bellow the Owner emall field( Ask Rovo• Ihis option shouldnt appear when editing an organisationSubtasksAoSwoesKLinked work itemsAod linkec work ibennood comieenSuggest a replyStatus update...Thanks...•.G08Jmin0 МСР T3 Ppelr• Calenc*xInsignts & Coachn.C DevIn Dev vI Improve Story~ DetailsAssignee@ Lukas KovalikAssign to me& Gasya DimitrovaQuick start developmentUink this work item to your codeby including keys when creatinga branch, commit, or pull requestbelow. Learn moreDeveio omenOpen with VS CodeI Create branch4 Create commitComponentsPlatformSub-ProductlAdd optionsMon 18 May 10:06AwemereGroup: QueriesAJ Panorama for CallScoring m ouAUTOMATED AI SCORINGJy-20301 05[Deadline 25 May) Migratedepricated Gemini 3.1 FlashDeployedД л-20880 1 П1 ***=Setup test coverage forProphet in Sonarsepricated Gemini modeisUoeyoЕ3 Jy-20272Sidekick SMS issueDeployedCЕ PY-20091n •=@Nikolay Yankov10:05 AM | Daily - PlatformLukas Kovalik18:37111...
|
49928
|
NULL
|
NULL
|
NULL
|
|
49930
|
NULL
|
0
|
2026-05-18T07:05:06.406695+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087906406_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.02013889,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.025555555},"on_screen":false,"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.0,"top":0.0,"width":0.014583333,"height":0.025555555},"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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}]...
|
6266791753600426303
|
34631148349319828
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49931
|
NULL
|
0
|
2026-05-18T07:05:13.463597+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087913463_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.05618351,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.3480718,"top":0.29848364,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.35771278,"top":0.29688746,"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.3650266,"top":0.29688746,"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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"bounds":{"left":0.15658244,"top":0.17877094,"width":0.24335106,"height":0.82122904},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.009640957,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"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.27027926,"top":1.0,"width":0.006981383,"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"bounds":{"left":0.39394948,"top":0.0,"width":0.35605052,"height":1.0},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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,"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}]...
|
6266791753600426303
|
34631148349319828
|
idle
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
49922
|
NULL
|
NULL
|
NULL
|
|
49932
|
1773
|
0
|
2026-05-18T07:05:18.484335+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087918484_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
3740816030388009784
|
-8636489586330588030
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelpPreparation for Refi... in 4 h 55 mmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comNikolay Yankov (Presenting)100% <28• Mon 18 May 10:05:18AA3+E1KioskAulomuked Keoottsoulle verwionS$182a Puacto57 (SRO-183 JminrE3 Promo3 Altent83 МСР-Cursohttps://app.jiminny.com/kiosk/onboard-lstEal DatadogSetup Account|General|[EMAIL] OPPORTUNITIES SYNC, PER:COwamuhsCALINONE *• OfficeGoogleOTrHONSminny VoiceTiers & Add-onsO Tlers osolainedCaptureSidekicko ScaleSelectAsk Jiminny on Deal Dealinsights Deal Risks live CoschingCoxching Framework Topics in Deals Activity Stats• Themes and Topics Cosching Focus O AJ CRM Filling• Al Activity Type Al Call ScoringatownSelectAutomated Recorts Ad Jiminay on Anthine Ask Fminay Reoortsl* Add Ons|Key Words Scoring feminny Voice SCIM® O Call Translationlistener RoleD Explicit Recording Consent ©9MOP TJ croec.Preserve los*Disable cache Oftinel60,000 ma80, 500 mSmine• CalencAppcabos• Group by trameO Screenshots027 A2 m2540.000 m560,000 m0• Big request rows2 Overview40,000 mO crganizations© ПРатропка!.О Патропка!....2 metricsw tra-ponka© Ратропка!.* (features: (*SIDEKIOK,SETTINGS*], ACCR,101 *[CREDIT_CARD]-a5S6-ed481ce89123°, nanes "CelumnS",-)• features: (*SIDEKIOK_SETTENGS")tier._16: *eSf6668)-6478-4366-83e5-65009585863c*Nikolay Yankov10:05 AM | Daily - PlatformLukas Kovalik18:52Lộ3...
|
49930
|
NULL
|
NULL
|
NULL
|
|
49933
|
1773
|
1
|
2026-05-18T07:05:21.495379+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087921495_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.02013889,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.025555555},"on_screen":false,"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.0,"top":0.0,"width":0.014583333,"height":0.025555555},"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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}]...
|
6266791753600426303
|
34631148349319828
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49934
|
1773
|
2
|
2026-05-18T07:05:27.561016+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087927561_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.02013889,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.025555555},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
2779473605090049119
|
-8992542585992827964
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error...
|
49933
|
NULL
|
NULL
|
NULL
|
|
49935
|
1773
|
3
|
2026-05-18T07:05:30.587917+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087930587_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.02013889,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.025555555},"on_screen":false,"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.0,"top":0.0,"width":0.014583333,"height":0.025555555},"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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}]...
|
6266791753600426303
|
34631148349319828
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49936
|
1773
|
4
|
2026-05-18T07:05:33.616526+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087933616_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.02013889,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.025555555},"on_screen":false,"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.0,"top":0.0,"width":0.014583333,"height":0.025555555},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-346309332793405595
|
-8992544922590303292
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error...
|
49935
|
NULL
|
NULL
|
NULL
|
|
49937
|
1773
|
5
|
2026-05-18T07:05:36.632786+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087936632_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.02013889,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.025555555},"on_screen":false,"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.0,"top":0.0,"width":0.014583333,"height":0.025555555},"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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}]...
|
6266791753600426303
|
34631148349319828
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49938
|
1774
|
0
|
2026-05-18T07:05:43.911858+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087943911_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.05618351,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.3480718,"top":0.29848364,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.35771278,"top":0.29688746,"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.3650266,"top":0.29688746,"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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"bounds":{"left":0.15658244,"top":0.17877094,"width":0.24335106,"height":0.82122904},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.009640957,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"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.27027926,"top":1.0,"width":0.006981383,"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"bounds":{"left":0.39394948,"top":0.0,"width":0.35605052,"height":1.0},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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,"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}]...
|
6266791753600426303
|
34631148349319828
|
idle
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49939
|
1773
|
6
|
2026-05-18T07:06:03.858582+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087963858_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
FirefoxFileEditViewHistoryBookmarks→Nikolay Yankov FirefoxFileEditViewHistoryBookmarks→Nikolay Yankov (Presenting)ProfilesToolsWindowHelpPreparation for Refi... in 4 h 54 ml100% L28• Mon 18 May 10:06:03meet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comAA+EdtKioskAulomatco Kedortsmootle versconProfiesPlaco57 (SRO-1https://app.jiminny.com/kloskC ProjectsE3 SSHOWNER +Stoyan Tanew•S**183 Altent83 МСР-CursoJmini• Home | SalestorceDatadog* Claudecrокс!Edit OrganizationGeneralCOMPANY NAMEШМРОКТ ОСИОАНОЛТЕ ВЕМСНЕКООJminry Voice|BAUNGUINEureser LonoonlTiers & Add-onsCapture© Sidekick• ScaleJiminnyCRMuserCALENCAR *© Office |Google|United KingdonBILUING CITYLondon|Euivo 2SWIP 1WG© Tisca coalainedSelectAsk Jiminny on Deal Deallnights DealRisks live CoschingCoxhine Framework• Topics in Deals @ |@ Activity StatsThemes and Topics@ Cosching Focus0 AI CRMFilling• AI Activity Type©@ Al Call ScoringGrowSele.• MOР TY FiterBig request rous2 OvervienName0) calendars03 crm-servicesc) tersw teataresoo parther0) users6) Патропкав.8• Mon 18 May 10:06C DevL Al Bookmarks030 42 B2E Preserve log12 Disable cacheCroup by trameO Screenshots4000 FHA000 FSHeaders Payloas_ Previemweh atindpereonporaal a placone- production6-013+[CREDIT_CARD]-664408249824003240a0-cdie- 4axe-0049-5137c13051bdc816086a-633a-861e-9085-3516592a6601ORNTORONikolay YankovLukas Kovalik10:06 AM | Daily - Platform...19:38...
|
NULL
|
8679144759806198271
|
NULL
|
visual_change
|
ocr
|
NULL
|
FirefoxFileEditViewHistoryBookmarks→Nikolay Yankov FirefoxFileEditViewHistoryBookmarks→Nikolay Yankov (Presenting)ProfilesToolsWindowHelpPreparation for Refi... in 4 h 54 ml100% L28• Mon 18 May 10:06:03meet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.comAA+EdtKioskAulomatco Kedortsmootle versconProfiesPlaco57 (SRO-1https://app.jiminny.com/kloskC ProjectsE3 SSHOWNER +Stoyan Tanew•S**183 Altent83 МСР-CursoJmini• Home | SalestorceDatadog* Claudecrокс!Edit OrganizationGeneralCOMPANY NAMEШМРОКТ ОСИОАНОЛТЕ ВЕМСНЕКООJminry Voice|BAUNGUINEureser LonoonlTiers & Add-onsCapture© Sidekick• ScaleJiminnyCRMuserCALENCAR *© Office |Google|United KingdonBILUING CITYLondon|Euivo 2SWIP 1WG© Tisca coalainedSelectAsk Jiminny on Deal Deallnights DealRisks live CoschingCoxhine Framework• Topics in Deals @ |@ Activity StatsThemes and Topics@ Cosching Focus0 AI CRMFilling• AI Activity Type©@ Al Call ScoringGrowSele.• MOР TY FiterBig request rous2 OvervienName0) calendars03 crm-servicesc) tersw teataresoo parther0) users6) Патропкав.8• Mon 18 May 10:06C DevL Al Bookmarks030 42 B2E Preserve log12 Disable cacheCroup by trameO Screenshots4000 FHA000 FSHeaders Payloas_ Previemweh atindpereonporaal a placone- production6-013+[CREDIT_CARD]-664408249824003240a0-cdie- 4axe-0049-5137c13051bdc816086a-633a-861e-9085-3516592a6601ORNTORONikolay YankovLukas Kovalik10:06 AM | Daily - Platform...19:38...
|
49937
|
NULL
|
NULL
|
NULL
|
|
49940
|
1773
|
7
|
2026-05-18T07:06:06.875785+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087966875_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere...
|
[{"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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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}]...
|
8681765016529791095
|
-8348540754415211066
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
FirefoxFileEditViewHistoryBookmarks→Nikolay Yankov (Presenting)FieVew2 PartoC2 CERD-Profies23 ЯлінTabhttps://wpo.jiminny.com/kiosk- shrC Projects25 35H*10:06 AM | Daily - PlatformProfilesToolsWindowHelpPreparation for Refi... in 4 h 54 mlmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.com8• Mon 18 May 10:06:06AAE MCP[ SchelCusoCiaude• Cot|C home lSaessorce09EDatawog oe* CoudeО СиснаEdit OrganizationGeneralCOMPANT NANEАРОККОРИАБОМЕО ЬЛКЛОСООwhorsJiminy VoiceS Howich PIGreater LondanTiers & Add-onsCaptureSidekicka ScaleJminny CRMuser4 OlficeUnted KrudoonBLNCOTLondanSWIP IWG|© IlncsseelzinndSelectAsk Junineny on Deal Deallesights E Desl Risks Uve Cosching@ Coaching Framework Topics in Deals @® Activity Stats© Theres and Topics Coaching FocusO AICRM FillIne@ Al Activity Type@ Al Call Scoring5 GrowSeie.GRG9Mon 18 May 10:00Q мсРT|Э РовL tasкa insignts & Coachin...т. 9E Preserve 1000 DevNetaon"Ditacie cache No meottingL Al BouRmsares030 A2 m2FetchpolR Des CaS|Js(] Big regoest roms2 OverviemMedta Manteit Socket Waum OtherCroup ty trame|O ScreenshotsNameto calencars(5 crm-sarvices0 tersX Hesders Payosd Previemwehotin feredoen6-[CREDIT_CARD]-9630-0614b024982403324080-cdie -4ase-2842-5137c1305100Ce partners)4D users12 Пагроаг.+47608t3-0133-065e-9086-3515592a6601CENTDeLNikolay Yankov...Lukas Kovalik• 19:41111...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49941
|
1773
|
8
|
2026-05-18T07:06:09.888616+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087969888_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.02013889,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.025555555},"on_screen":false,"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.0,"top":0.0,"width":0.014583333,"height":0.025555555},"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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}]...
|
6266791753600426303
|
34631148349319828
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
49940
|
NULL
|
NULL
|
NULL
|
|
49942
|
1774
|
1
|
2026-05-18T07:06:14.333270+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779087974333_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.05618351,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.3480718,"top":0.29848364,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.35771278,"top":0.29688746,"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.3650266,"top":0.29688746,"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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"bounds":{"left":0.15658244,"top":0.17877094,"width":0.24335106,"height":0.82122904},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.009640957,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"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.27027926,"top":1.0,"width":0.006981383,"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"bounds":{"left":0.39394948,"top":0.0,"width":0.35605052,"height":1.0},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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,"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}]...
|
6266791753600426303
|
34631148349319828
|
idle
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
49938
|
NULL
|
NULL
|
NULL
|
|
49943
|
1773
|
9
|
2026-05-18T07:06:40.108864+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779088000108_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.02013889,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.025555555},"on_screen":false,"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.0,"top":0.0,"width":0.014583333,"height":0.025555555},"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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}]...
|
6266791753600426303
|
34631148349319828
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
49944
|
1774
|
2
|
2026-05-18T07:06:44.768197+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779088004768_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.05618351,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.3480718,"top":0.29848364,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.35771278,"top":0.29688746,"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.3650266,"top":0.29688746,"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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"bounds":{"left":0.15658244,"top":0.17877094,"width":0.24335106,"height":0.82122904},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.009640957,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"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.27027926,"top":1.0,"width":0.006981383,"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"bounds":{"left":0.39394948,"top":0.0,"width":0.35605052,"height":1.0},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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,"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}]...
|
6266791753600426303
|
34631148349319828
|
idle
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
49938
|
NULL
|
NULL
|
NULL
|
|
49945
|
1773
|
10
|
2026-05-18T07:07:13.329229+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779088033329_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.02013889,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.025555555},"on_screen":false,"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.0,"top":0.0,"width":0.014583333,"height":0.025555555},"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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}]...
|
6266791753600426303
|
34631148349319828
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
49943
|
NULL
|
NULL
|
NULL
|
|
49946
|
1774
|
3
|
2026-05-18T07:07:15.214019+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779088035214_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
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":"pipedrive-sdk-poc, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.05618351,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","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":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.3480718,"top":0.29848364,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.35771278,"top":0.29688746,"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.3650266,"top":0.29688746,"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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"bounds":{"left":0.15658244,"top":0.17877094,"width":0.24335106,"height":0.82122904},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"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":"1","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"51","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.009640957,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"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.27027926,"top":1.0,"width":0.006981383,"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\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\n }\n}","depth":4,"bounds":{"left":0.39394948,"top":0.0,"width":0.35605052,"height":1.0},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Console\\Commands\\Crm;\n\nuse Carbon\\Carbon;\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Jiminny\\Component\\Encryption\\EncryptedTokenManager;\nuse Jiminny\\Models\\SocialAccount;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Pipedrive\\versions\\v2\\Api\\ActivitiesApi;\nuse Pipedrive\\versions\\v2\\Api\\ActivityFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\DealsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonFieldsApi;\nuse Pipedrive\\versions\\v2\\Api\\PersonsApi;\nuse Pipedrive\\versions\\v2\\Configuration;\n\nclass TestPipedriveOfficialSdkCommand extends Command\n{\n protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';\n\n protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';\n\n private array $results = [];\n\n private EncryptedTokenManager $tokenManager;\n\n public function __construct(EncryptedTokenManager $tokenManager)\n {\n parent::__construct();\n $this->tokenManager = $tokenManager;\n }\n\n public function handle(): int\n {\n $teamId = (int) $this->argument('teamId');\n\n $this->info(\"Starting Pipedrive Official SDK POC for Team ID: {$teamId}\");\n $this->newLine();\n\n try {\n $this->runTests($teamId);\n } catch (Exception $e) {\n $this->error(\"POC failed with error: {$e->getMessage()}\");\n $this->error($e->getTraceAsString());\n\n return 1;\n }\n\n $this->displayResults();\n\n return 0;\n }\n\n private function runTests(int $teamId): void\n {\n $team = Team::find($teamId);\n if (! $team) {\n throw new Exception(\"Team with ID {$teamId} not found\");\n }\n\n $socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)\n ->whereHas('sociable', function ($query) use ($team) {\n $query->where('team_id', $team->id);\n })\n ->orderByDesc('expires') // Get the most recently expiring token\n ->first();\n\n if (! $socialAccount) {\n throw new Exception(\"No Pipedrive social account found for team {$teamId}\");\n }\n\n $this->info(\"Found Pipedrive account for team: {$team->name}\");\n $this->newLine();\n\n // Test 1: OAuth Initialization\n $this->testOAuthInitialization($socialAccount);\n\n // Test 2: Basic CRUD Operations\n $this->testBasicCrudOperations($socialAccount);\n\n // Test 3: Field Metadata\n $this->testFieldMetadata($socialAccount);\n\n // Test 4: v2 API Support\n $this->testV2ApiSupport($socialAccount);\n\n // Test 5: Error Handling\n $this->testErrorHandling($socialAccount);\n }\n\n private function testOAuthInitialization(SocialAccount $socialAccount): void\n {\n $this->info('Test 1: OAuth Initialization');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $client = new DealsApi(null, $config);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', true, \"Client initialized successfully in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);\n }\n\n $this->newLine();\n }\n\n private function testBasicCrudOperations(SocialAccount $socialAccount): void\n {\n $this->info('Test 2: Basic CRUD Operations');\n\n try {\n // Get the raw token from database\n $rawDbToken = $socialAccount->getProviderUserToken();\n $this->info(\"DB token (length: \" . strlen($rawDbToken) . \")\");\n $this->info(\"DB token preview: \" . substr($rawDbToken, 0, 20) . \"...\");\n\n // Check token expiry\n $expires = $socialAccount->expires;\n $this->info(\"Token expires at: \" . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));\n $this->info(\"Token is expired: \" . ($expires && $expires < time() ? 'YES' : 'NO'));\n\n // Test with the DB token directly\n $this->info(\"\\n--- Testing with DB token ---\");\n $config = new Configuration();\n $config->setAccessToken($rawDbToken);\n\n // Test 2a: Get Deals Summary\n $this->testGetDeals($config);\n\n // Test 2b: Get Persons\n $this->testGetPersons($config);\n\n // Test 2c: Get Activities\n $this->testGetActivities($config);\n } catch (Exception $e) {\n $this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testCurrentSystemApproach(SocialAccount $socialAccount): void\n {\n $startTime = microtime(true);\n\n try {\n // Simulate how current system makes requests\n $token = $socialAccount->getProviderUserToken();\n $url = 'https://api.pipedrive.com/api/v2/deals';\n\n $headers = [\n 'Authorization' => 'Bearer ' . $token,\n 'Accept' => 'application/json',\n ];\n\n $client = new \\GuzzleHttp\\Client();\n $response = $client->get($url, [\n 'headers' => $headers,\n 'timeout' => 30,\n ]);\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $statusCode = $response->getStatusCode();\n $this->recordResult('Current System v2 API', $statusCode === 200, \"Status: {$statusCode} in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetDeals(Configuration $config): void\n {\n $this->info('Test 2a: Get Deals');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealsApi(null, $config);\n // v2 SDK might have different method names\n // Try common v2 method names\n try {\n $result = $apiInstance->getDeals(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', true, \"Retrieved deals in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method\n $result = $apiInstance->getDealsSummary();\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals Summary', true, \"Retrieved deals summary in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersons(Configuration $config): void\n {\n $this->info('Test 2b: Get Persons');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonsApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllPersons(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', true, \"Retrieved persons in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivities(Configuration $config): void\n {\n $this->info('Test 2c: Get Activities');\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivitiesApi(null, $config);\n // v2 SDK might have different method names\n try {\n $result = $apiInstance->getActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n // Try alternative method names\n try {\n $result = $apiInstance->getAllActivities(['limit' => 10]);\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', true, \"Retrieved activities in {$elapsed}ms\", $elapsed);\n } catch (Exception $e2) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, \"Method not found: {$e->getMessage()}\", $elapsed);\n }\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testFieldMetadata(SocialAccount $socialAccount): void\n {\n $this->info('Test 3: Field Metadata');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n // Test 3a: Get Deal Fields\n $this->testGetDealFields($config);\n\n // Test 3b: Get Person Fields\n $this->testGetPersonFields($config);\n\n // Test 3c: Get Activity Fields\n $this->testGetActivityFields($config);\n } catch (Exception $e) {\n $this->recordResult('Field Metadata', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testGetDealFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new DealFieldsApi(null, $config);\n $result = $apiInstance->getDealFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Deal Fields', true, \"Retrieved {$count} deal fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetPersonFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new PersonFieldsApi(null, $config);\n $result = $apiInstance->getPersonFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Person Fields', true, \"Retrieved {$count} person fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testGetActivityFields(Configuration $config): void\n {\n $startTime = microtime(true);\n\n try {\n $apiInstance = new ActivityFieldsApi(null, $config);\n $result = $apiInstance->getActivityFields();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $count = $result->getData() ? count($result->getData()) : 0;\n $this->recordResult('Get Activity Fields', true, \"Retrieved {$count} activity fields in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function testV2ApiSupport(SocialAccount $socialAccount): void\n {\n $this->info('Test 4: v2 API Support (Cursor-based Pagination)');\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n\n $startTime = microtime(true);\n\n // Test v2 deals endpoint with cursor pagination\n // Note: The official SDK may or may not have v2 API support\n // This test will determine if v2 is available\n try {\n $apiInstance = new DealsApi(null, $config);\n $updatedSince = Carbon::now()->subDays(30)->toRfc3339String();\n $result = $apiInstance->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n\n // Check if response has cursor information (v2 indicator)\n // The response object doesn't have getAdditionalData method\n // Just test if the call works - v2 API support is limited in official SDK v1\n $this->recordResult('v2 API Support', false, \"v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);\n }\n } catch (Exception $e) {\n $this->recordResult('v2 API Support', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testErrorHandling(SocialAccount $socialAccount): void\n {\n $this->info('Test 5: Error Handling');\n\n try {\n // Test 5a: Invalid Token\n $this->testInvalidToken();\n\n // Test 5b: Non-existent Resource\n $this->testNonExistentResource($socialAccount);\n } catch (Exception $e) {\n $this->recordResult('Error Handling', false, $e->getMessage(), 0);\n }\n\n $this->newLine();\n }\n\n private function testInvalidToken(): void\n {\n $this->info('Test 5a: Invalid Token');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken('invalid_token');\n $client = new DealsApi(null, $config);\n\n $client->getDealsSummary();\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Invalid Token Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n }\n\n private function testNonExistentResource(SocialAccount $socialAccount): void\n {\n $this->info('Test 5b: Non-existent Resource');\n $startTime = microtime(true);\n\n try {\n $config = new Configuration();\n $config->setAccessToken($socialAccount->provider_user_token);\n $client = new DealsApi(null, $config);\n\n // Try to get a deal with a very high ID that likely doesn't exist\n // Official SDK has getDealsSummary which works without specific ID\n // Instead, let's test with an invalid field ID\n try {\n $fieldClient = new DealFieldsApi(null, $config);\n $fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist\n\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, \"Expected error but request succeeded in {$elapsed}ms\", $elapsed);\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', true, \"Correctly threw exception: {$e->getMessage()} in {$elapsed}ms\", $elapsed);\n }\n } catch (Exception $e) {\n $elapsed = round((microtime(true) - $startTime) * 1000, 2);\n $this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);\n }\n }\n\n private function recordResult(string $testName, bool $success, string $message, float $elapsed): void\n {\n $this->results[] = [\n 'test' => $testName,\n 'success' => $success,\n 'message' => $message,\n 'elapsed' => $elapsed,\n ];\n\n $status = $success ? '✅ PASS' : '❌ FAIL';\n $this->line(\" {$status} - {$testName}: {$message}\");\n }\n\n private function displayResults(): void\n {\n $this->newLine();\n $this->info('=== POC Test Results Summary ===');\n $this->newLine();\n\n $total = count($this->results);\n $passed = count(array_filter($this->results, fn ($r) => $r['success']));\n $failed = $total - $passed;\n\n $this->line(\"Total Tests: {$total}\");\n $this->line(\"Passed: {$passed}\");\n $this->line(\"Failed: {$failed}\");\n $this->newLine();\n\n $totalTime = array_sum(array_column($this->results, 'elapsed'));\n $this->line(\"Total Execution Time: {$totalTime}ms\");\n $this->newLine();\n\n if ($failed > 0) {\n $this->warn('Failed Tests:');\n foreach ($this->results as $result) {\n if (! $result['success']) {\n $this->line(\" - {$result['test']}: {$result['message']}\");\n }\n }\n $this->newLine();\n }\n\n $this->info('=== Detailed Results ===');\n foreach ($this->results as $result) {\n $status = $result['success'] ? '✅' : '❌';\n $this->line(\"{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}\");\n }\n\n $this->newLine();\n $this->info('=== Recommendations ===');\n\n if ($passed === $total) {\n $this->info('✅ All tests passed! The official SDK is viable for migration.');\n $this->info('Next steps: Proceed with full migration planning.');\n } else {\n $this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');\n $this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');\n }\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,"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}]...
|
6266791753600426303
|
34631148349319828
|
idle
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, 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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Code changed:
Hide
Sync Changes
Hide This Notification
1
51
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands\Crm;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Jiminny\Component\Encryption\EncryptedTokenManager;
use Jiminny\Models\SocialAccount;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Pipedrive\versions\v2\Api\ActivitiesApi;
use Pipedrive\versions\v2\Api\ActivityFieldsApi;
use Pipedrive\versions\v2\Api\DealFieldsApi;
use Pipedrive\versions\v2\Api\DealsApi;
use Pipedrive\versions\v2\Api\PersonFieldsApi;
use Pipedrive\versions\v2\Api\PersonsApi;
use Pipedrive\versions\v2\Configuration;
class TestPipedriveOfficialSdkCommand extends Command
{
protected $signature = 'jiminny:test-pipedrive-official-sdk {teamId}';
protected $description = 'Test official Pipedrive SDK (pipedrive/pipedrive) with existing OAuth tokens';
private array $results = [];
private EncryptedTokenManager $tokenManager;
public function __construct(EncryptedTokenManager $tokenManager)
{
parent::__construct();
$this->tokenManager = $tokenManager;
}
public function handle(): int
{
$teamId = (int) $this->argument('teamId');
$this->info("Starting Pipedrive Official SDK POC for Team ID: {$teamId}");
$this->newLine();
try {
$this->runTests($teamId);
} catch (Exception $e) {
$this->error("POC failed with error: {$e->getMessage()}");
$this->error($e->getTraceAsString());
return 1;
}
$this->displayResults();
return 0;
}
private function runTests(int $teamId): void
{
$team = Team::find($teamId);
if (! $team) {
throw new Exception("Team with ID {$teamId} not found");
}
$socialAccount = SocialAccount::where('provider', SocialAccount::PROVIDER_PIPEDRIVE)
->whereHas('sociable', function ($query) use ($team) {
$query->where('team_id', $team->id);
})
->orderByDesc('expires') // Get the most recently expiring token
->first();
if (! $socialAccount) {
throw new Exception("No Pipedrive social account found for team {$teamId}");
}
$this->info("Found Pipedrive account for team: {$team->name}");
$this->newLine();
// Test 1: OAuth Initialization
$this->testOAuthInitialization($socialAccount);
// Test 2: Basic CRUD Operations
$this->testBasicCrudOperations($socialAccount);
// Test 3: Field Metadata
$this->testFieldMetadata($socialAccount);
// Test 4: v2 API Support
$this->testV2ApiSupport($socialAccount);
// Test 5: Error Handling
$this->testErrorHandling($socialAccount);
}
private function testOAuthInitialization(SocialAccount $socialAccount): void
{
$this->info('Test 1: OAuth Initialization');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', true, "Client initialized successfully in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('OAuth Initialization', false, $e->getMessage(), $elapsed);
}
$this->newLine();
}
private function testBasicCrudOperations(SocialAccount $socialAccount): void
{
$this->info('Test 2: Basic CRUD Operations');
try {
// Get the raw token from database
$rawDbToken = $socialAccount->getProviderUserToken();
$this->info("DB token (length: " . strlen($rawDbToken) . ")");
$this->info("DB token preview: " . substr($rawDbToken, 0, 20) . "...");
// Check token expiry
$expires = $socialAccount->expires;
$this->info("Token expires at: " . ($expires ? Carbon::createFromTimestamp($expires)->toDateTimeString() : 'null'));
$this->info("Token is expired: " . ($expires && $expires < time() ? 'YES' : 'NO'));
// Test with the DB token directly
$this->info("\n--- Testing with DB token ---");
$config = new Configuration();
$config->setAccessToken($rawDbToken);
// Test 2a: Get Deals Summary
$this->testGetDeals($config);
// Test 2b: Get Persons
$this->testGetPersons($config);
// Test 2c: Get Activities
$this->testGetActivities($config);
} catch (Exception $e) {
$this->recordResult('Basic CRUD Operations', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testCurrentSystemApproach(SocialAccount $socialAccount): void
{
$startTime = microtime(true);
try {
// Simulate how current system makes requests
$token = $socialAccount->getProviderUserToken();
$url = 'https://api.pipedrive.com/api/v2/deals';
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$client = new \GuzzleHttp\Client();
$response = $client->get($url, [
'headers' => $headers,
'timeout' => 30,
]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$statusCode = $response->getStatusCode();
$this->recordResult('Current System v2 API', $statusCode === 200, "Status: {$statusCode} in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Current System v2 API', false, $e->getMessage(), $elapsed);
}
}
private function testGetDeals(Configuration $config): void
{
$this->info('Test 2a: Get Deals');
$startTime = microtime(true);
try {
$apiInstance = new DealsApi(null, $config);
// v2 SDK might have different method names
// Try common v2 method names
try {
$result = $apiInstance->getDeals(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', true, "Retrieved deals in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals Summary', true, "Retrieved deals summary in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deals', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersons(Configuration $config): void
{
$this->info('Test 2b: Get Persons');
$startTime = microtime(true);
try {
$apiInstance = new PersonsApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllPersons(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', true, "Retrieved persons in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Persons', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivities(Configuration $config): void
{
$this->info('Test 2c: Get Activities');
$startTime = microtime(true);
try {
$apiInstance = new ActivitiesApi(null, $config);
// v2 SDK might have different method names
try {
$result = $apiInstance->getActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
// Try alternative method names
try {
$result = $apiInstance->getAllActivities(['limit' => 10]);
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', true, "Retrieved activities in {$elapsed}ms", $elapsed);
} catch (Exception $e2) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, "Method not found: {$e->getMessage()}", $elapsed);
}
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activities', false, $e->getMessage(), $elapsed);
}
}
private function testFieldMetadata(SocialAccount $socialAccount): void
{
$this->info('Test 3: Field Metadata');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
// Test 3a: Get Deal Fields
$this->testGetDealFields($config);
// Test 3b: Get Person Fields
$this->testGetPersonFields($config);
// Test 3c: Get Activity Fields
$this->testGetActivityFields($config);
} catch (Exception $e) {
$this->recordResult('Field Metadata', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testGetDealFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new DealFieldsApi(null, $config);
$result = $apiInstance->getDealFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Deal Fields', true, "Retrieved {$count} deal fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Deal Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetPersonFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new PersonFieldsApi(null, $config);
$result = $apiInstance->getPersonFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Person Fields', true, "Retrieved {$count} person fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Person Fields', false, $e->getMessage(), $elapsed);
}
}
private function testGetActivityFields(Configuration $config): void
{
$startTime = microtime(true);
try {
$apiInstance = new ActivityFieldsApi(null, $config);
$result = $apiInstance->getActivityFields();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$count = $result->getData() ? count($result->getData()) : 0;
$this->recordResult('Get Activity Fields', true, "Retrieved {$count} activity fields in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Get Activity Fields', false, $e->getMessage(), $elapsed);
}
}
private function testV2ApiSupport(SocialAccount $socialAccount): void
{
$this->info('Test 4: v2 API Support (Cursor-based Pagination)');
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$startTime = microtime(true);
// Test v2 deals endpoint with cursor pagination
// Note: The official SDK may or may not have v2 API support
// This test will determine if v2 is available
try {
$apiInstance = new DealsApi(null, $config);
$updatedSince = Carbon::now()->subDays(30)->toRfc3339String();
$result = $apiInstance->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
// Check if response has cursor information (v2 indicator)
// The response object doesn't have getAdditionalData method
// Just test if the call works - v2 API support is limited in official SDK v1
$this->recordResult('v2 API Support', false, "v1 API works but v2 cursor pagination not available in official SDK v1. Retrieved summary in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('v2 API Support', false, $e->getMessage(), $elapsed);
}
} catch (Exception $e) {
$this->recordResult('v2 API Support', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testErrorHandling(SocialAccount $socialAccount): void
{
$this->info('Test 5: Error Handling');
try {
// Test 5a: Invalid Token
$this->testInvalidToken();
// Test 5b: Non-existent Resource
$this->testNonExistentResource($socialAccount);
} catch (Exception $e) {
$this->recordResult('Error Handling', false, $e->getMessage(), 0);
}
$this->newLine();
}
private function testInvalidToken(): void
{
$this->info('Test 5a: Invalid Token');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken('invalid_token');
$client = new DealsApi(null, $config);
$client->getDealsSummary();
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Invalid Token Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
}
private function testNonExistentResource(SocialAccount $socialAccount): void
{
$this->info('Test 5b: Non-existent Resource');
$startTime = microtime(true);
try {
$config = new Configuration();
$config->setAccessToken($socialAccount->provider_user_token);
$client = new DealsApi(null, $config);
// Try to get a deal with a very high ID that likely doesn't exist
// Official SDK has getDealsSummary which works without specific ID
// Instead, let's test with an invalid field ID
try {
$fieldClient = new DealFieldsApi(null, $config);
$fieldClient->getDealField(999999999); // Very high ID that likely doesn't exist
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, "Expected error but request succeeded in {$elapsed}ms", $elapsed);
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', true, "Correctly threw exception: {$e->getMessage()} in {$elapsed}ms", $elapsed);
}
} catch (Exception $e) {
$elapsed = round((microtime(true) - $startTime) * 1000, 2);
$this->recordResult('Non-existent Resource Error', false, $e->getMessage(), $elapsed);
}
}
private function recordResult(string $testName, bool $success, string $message, float $elapsed): void
{
$this->results[] = [
'test' => $testName,
'success' => $success,
'message' => $message,
'elapsed' => $elapsed,
];
$status = $success ? '✅ PASS' : '❌ FAIL';
$this->line(" {$status} - {$testName}: {$message}");
}
private function displayResults(): void
{
$this->newLine();
$this->info('=== POC Test Results Summary ===');
$this->newLine();
$total = count($this->results);
$passed = count(array_filter($this->results, fn ($r) => $r['success']));
$failed = $total - $passed;
$this->line("Total Tests: {$total}");
$this->line("Passed: {$passed}");
$this->line("Failed: {$failed}");
$this->newLine();
$totalTime = array_sum(array_column($this->results, 'elapsed'));
$this->line("Total Execution Time: {$totalTime}ms");
$this->newLine();
if ($failed > 0) {
$this->warn('Failed Tests:');
foreach ($this->results as $result) {
if (! $result['success']) {
$this->line(" - {$result['test']}: {$result['message']}");
}
}
$this->newLine();
}
$this->info('=== Detailed Results ===');
foreach ($this->results as $result) {
$status = $result['success'] ? '✅' : '❌';
$this->line("{$status} {$result['test']} ({$result['elapsed']}ms): {$result['message']}");
}
$this->newLine();
$this->info('=== Recommendations ===');
if ($passed === $total) {
$this->info('✅ All tests passed! The official SDK is viable for migration.');
$this->info('Next steps: Proceed with full migration planning.');
} else {
$this->warn('⚠️ Some tests failed. Review the failures above before proceeding.');
$this->warn('Consider hybrid approach or investigate alternatives if critical operations fail.');
}
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
49938
|
NULL
|
NULL
|
NULL
|
|
51155
|
1799
|
61
|
2026-05-18T08:18:12.989116+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092292989_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
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
Sync Changes
Hide This Notification
Code changed:
Hide
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}
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":"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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\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":"6","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"17","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\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\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}]...
|
6714245380515899525
|
-8757710301784092983
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
51153
|
NULL
|
NULL
|
NULL
|
|
51156
|
1800
|
65
|
2026-05-18T08:18:12.887428+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092292887_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}
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":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.3480718,"top":0.22426178,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.35771278,"top":0.22266561,"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.3650266,"top":0.22266561,"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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"bounds":{"left":0.15658244,"top":0.10454908,"width":0.24335106,"height":0.87789303},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\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":"6","depth":4,"bounds":{"left":0.5880984,"top":0.10055866,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"17","depth":4,"bounds":{"left":0.5980718,"top":0.10055866,"width":0.00930851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.6090425,"top":0.09896249,"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.6163564,"top":0.09896249,"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\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\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,"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}]...
|
6714245380515899525
|
-8757710301784092983
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
51154
|
NULL
|
NULL
|
NULL
|
|
51157
|
1799
|
62
|
2026-05-18T08:18:15.643784+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092295643_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
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
Sync Changes
Hide This Notification
Code changed:
Hide
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}...
|
[{"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":"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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false}]...
|
-6381525115353700546
|
-8992544785176520239
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
51158
|
1800
|
66
|
2026-05-18T08:18:15.675626+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092295675_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
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...
|
[{"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}]...
|
-5794999150126922245
|
-8204417045355058234
|
click
|
hybrid
|
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
PhostormroledeyVIewINavicarecodeLaravelKeractorFV faVsco.js?9 master v=custom.logA SF [jiminny@localhost]A console [STAGING]© OrganizationLicensesController.phpOrganizationMembersController.php© OrganizationRetentionPolicyController© OrganizationRolesController.php© OrganizationSyncController.php4 PartnerController.php© PhoneNumberController.php€ PlaybackController.php© PlaylistController.php© ScimController.phr) Sidekickcontroller.onpSoftphoneController.phpc) ssocontroller.onoc) suoscripuioncontroller.ono© TeamAiAutomationController.phpconvertLeadActivitles.ongPurgelookupcache.onp© SyncToPlanhat.phpA HS_local [jiminny@localhost]* console [PRoDJfii users (PROD]© Kernel.php X A console [EU]class kernel excenas consolekernelRestoretrackscommand:•cllass.A6.17AVC) TeamAiContextController.ohvTeamController.phpC)Teaminsiahtscontroller.ohoc)Transcriotioncontrolller.onoc)Translationcontrolller.ono© UserController.phpC) VocabularvController.ohvM Auth> M CustomerAoi•M Internalv D Kiosk> M Teame©) ActivitvController.oneC AutomatedReportsController.php© DashboardController.php© ImpersonationController.php(c) MediaPioelineController.onp© OrganizationsController.phpPartnersController.php© ProfileController.phpc) Searchcontroller.phpv @ Settings> D Coachina>0 Profilev D Teams> M Billina.>MUtilsg IntegrationController.oho© CreatePlaybookCreatedEvent.php©) salestorce/service.php" TeamController.php© AutomatedReportResult.php X ©AutomatedReport.phppnp api.phoVEditTeamModal.vueCreateTeamRequest.phpC) UserinvitationDTO.phom A3 AVrnal class Teamcontroller extends controllen24347 10S(©) InvitationController.oho@ OrganizationSettinasController.ohr 51(C) TeamActivitvController.oho© TeamCoachingSettingsController.r 59@ TeamConferenceSettinasControlleYc) TeamController nho(C) TeamDealinciahtcSettinaController(C) TeamDomainsController nhn8 TeamMemherController nhn* Create a new tem. subscriotion and invitationPOST laoi/v1/settinas/oraanizations.fkiosk.oroanizations.store]lpublic function storelCreateTeamRequest Srequest,CnpateTeam ScnpateTeam1367370InviteUserToTeamAction $inviteUserToTeamAction): void {/** @var User $teamCreator */$teamCreator = Srequest->userO:try{saara = srecuest-aller375 01suean = screacelean- nanole sceamcreacor, suara, srecuest-›cecuomalneSinviteUserToTeamAction->execute(UserInvitationDTO:: for0wner(Srequestcatch Exception SexceptionLoq: :error( message:"An error occurred while creating team'.'e message' =› sexcention-›qetressadeo'e code' => Sexcention->qetCode@.T410415throw Sexception;nublic function edi+(lTeam $team,EditTeamRequest Srequest.EditTeam SeditTeaml): JsonResponse {...}509HubspotWebhookServiceCommand::class,ProcessMerged0bjectsCommand::class,HubspotJournalPolLingconnand..class,SetupJournalDealWebhookSubscriptionsCommand::class,LiscsournaLweonookoudscripczonsconmand..ctdss,kenovebnoscrarctcrpantscommand..classAUcodececcALAccIVIty ypecommand..class.commanos crm nacchupporcunicyacclviclescomnand..classPurgevelecedupporcunlclestommand::classCLeanbupLicarerzelavaracommand:: class,kecryProspeccsummarycommand:: classProcesshubspocubnectssyncbacches::classsyncupporcun1t1esn1ss1ngr1elavatacommand::classkestorevealassocrarzonscommand::class.orivate Schedule Sschedule:6 usagesorivate strind Soutout.protected function schedule(Schedule $schedule): voidt...}1 usageprotected function scheduleEveryMinute: voidt...}Tusageprotected function scheduleEveryTwoMinutes): void{...}Iusageprotected function scheduleEveryFiveMinutes: void{...}1 usageprotected function scheduleEveryTenMinutes: void{...}protected function scheduleEveryFifteenMinutes@: void{...}l1 usageprotected function scheduleEveryThirtyMinutesO: voidf...}1 usageorotected function scheduletourvo: voldk....1 usageorotected function schedulelatlvo: void..?• Preparation Tor Kell... In 3h 42 m100% 5• Mon 18 May 11:18:15+0 ..CascadeMigrating to Pipedrive• V Invalid Token Error handlingNon-existent Resource Error handlingGet Activity Fields - field type validation error (documThe command is production-ready for testina official SDK v2 with proper social account authorization.+24add description of the ticket for POC" PiPEdrIVE V2_MIGRATION_ tickETS.mdlAdded POC & Validation ticket to PIPEDRIVE V2 MIGRATION TICKETS.md. The ticket documents the comoleted workfied known issues (activity fields validation error)Status: COMPLETEDal .Ask anvthina (4LSWF.16WN Windsurf Teams26.52UTF.8io 4 spaces...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
51159
|
1799
|
63
|
2026-05-18T08:18:16.731386+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092296731_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
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
Sync Changes
Hide This Notification
Code changed:
Hide
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}
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":"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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\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":"6","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"17","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\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\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}]...
|
6714245380515899525
|
-8757710301784092983
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
51157
|
NULL
|
NULL
|
NULL
|
|
51160
|
1800
|
67
|
2026-05-18T08:18:18.624074+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092298624_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}
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":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.3480718,"top":0.19952115,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.35771278,"top":0.19792499,"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.3650266,"top":0.19792499,"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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"bounds":{"left":0.15658244,"top":0.101356745,"width":0.24335106,"height":0.87789303},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\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":"6","depth":4,"bounds":{"left":0.5880984,"top":0.10055866,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"17","depth":4,"bounds":{"left":0.5980718,"top":0.10055866,"width":0.00930851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.6090425,"top":0.09896249,"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.6163564,"top":0.09896249,"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\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\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,"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}]...
|
6714245380515899525
|
-8757710301784092983
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
51158
|
NULL
|
NULL
|
NULL
|
|
51161
|
1799
|
64
|
2026-05-18T08:18:21.654308+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092301654_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
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
Sync Changes
Hide This Notification
Code changed:
Hide
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
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":"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":"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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\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}]...
|
5346603899788056558
|
-8979033986302797359
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Sync Changes...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
51162
|
1800
|
68
|
2026-05-18T08:18:21.620131+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092301620_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}...
|
[{"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":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.3480718,"top":0.19952115,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.35771278,"top":0.19792499,"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.3650266,"top":0.19792499,"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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"bounds":{"left":0.15658244,"top":0.101356745,"width":0.24335106,"height":0.87789303},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-6381525115353700546
|
-8992544785176520239
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
51163
|
1800
|
69
|
2026-05-18T08:18:23.361828+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092303361_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}
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":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.3480718,"top":0.10055866,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.35771278,"top":0.09896249,"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.3650266,"top":0.09896249,"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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"bounds":{"left":0.15658244,"top":0.09736632,"width":0.24335106,"height":0.8818835},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\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":"6","depth":4,"bounds":{"left":0.5880984,"top":0.10055866,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"17","depth":4,"bounds":{"left":0.5980718,"top":0.10055866,"width":0.00930851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.6090425,"top":0.09896249,"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.6163564,"top":0.09896249,"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\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\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,"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}]...
|
6714245380515899525
|
-8757710301784092983
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
51162
|
NULL
|
NULL
|
NULL
|
|
51164
|
1799
|
65
|
2026-05-18T08:18:23.777310+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092303777_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
iTerm2ShellEditViewSessionScriptsProfilesWindowHel iTerm2ShellEditViewSessionScriptsProfilesWindowHelpPreparation for Refi…. in 3h 42 m100% <78• Mon 18 May 11:18:23APP (-zsh)181DOCKER₴81DEV (docker)₴2APP (-zsh)screenpipe*₴4remote: Counting objects: 100% (832/832),done.remote: Compressing objects: 100% (298/298),done.remote: Total 1047 (delta 634), reused 596 (delta 534), pack-reused 215 (from 3)Receiving objects: 100% (1047/1047), 353.16 KiB | 1.56 MiB/s, done.Resolving deltas: 100% (687/687), completed with 107 local objects.From github.com:jiminny/app907c54896c..34656c53edpipedrive-sdk-poc-› origin/pipedrive-sdk-poc03325ec50f..4e7078fd8bJY-18091-upgrade-to-php-8-5APP-> origin/JY-18091-upgrade-to-php-8-5e7d231e163..bc6a3fceбbJY-20725-handle-HS-search-rate-limit-› origin/JY-20725-handle-HS-search-rate-limit* [new branch]JY-20749-user-can-view-recorded-meetings-> origin/JY-20749-user-can-view-recorded-meetings98ca281a04..e0351be069JY-20808-low-priority-indexing-queue-> origin/JY-20808-low-priority-indexing-queue569abb5149..3906a9238aJY-20835-mcp-enable-users-to-get-a-list-of-deals-and-their-details -> origin/JY-20835-mcp-enable-users-to-get-a-list-of-deals-and-their-detailsad6c2a86e8..50eb6afba9* [new branch]JY-20846-mcp-enable-the-ai-to-know-details-about-the-user-> origin/JY-20846-mcp-enable-the-ai-to-know-details-about-the-userJY-20893-chunk-control-per-update-target-> origin/JY-20893-chunk-control-per-update-target31c62924a5..cb4ebf0c36master-> origin/masterUpdating 907c54896c..34656c53edFast-forwardPIPEDRIVE_V2_MIGRATION_TICKETS.md |52+++++++file changed, 52 insertions(+)lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (pipedrive-sdk-poc) $ co master.env.localconfig/logging.phpSwitched to branch"master'Your branch is behind 'origin/master' by 31 commits, and can be fast-forwarded.(use "git pull" to update your local branch)lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ git pullUpdating 31c62924a5..cb4ebf0c36Fast-forwardapp/Component/ES/Processor/Traits/SelectEntityListTrait.phpapp/Services/Calendar/CalendarActivityService.phpapp/Services/Calendar/Command/MapActivityData.phpdocs/mcp/explorer/explorer.htmldocs/mcp/explorer/explorer.template.htmldocs/mcp/tools-list.jsondocs/mcp/tools.mdtests/Unit/Component/ES/AsyncUpdateElasticSearchTest.phptests/Unit/Component/ES/Listeners/UpdateMultipleTargetsListenerTest.phptests/Unit/Component/ES/Listeners/UpdateSingleTargetListenerTest.phptests/Unit/Component/ES/Processor/TargetEntitiesSelectorTest.phptests/Unit/Component/ES/Processor/Traits/SelectEntityListTraitTest.phptests/Unit/Component/ES/UpdateProcessManagerTest.phptests/Unit/Services/Calendar/CalendarActivityServiceTest.phptests/Unit/Services/Calendar/Command/MapActivityDataTest.php2046106104| 10213731171610691521507815 files changed, 832 insertions(+), 322 deletions(-)lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ |...
|
NULL
|
8750783968281244530
|
NULL
|
click
|
ocr
|
NULL
|
iTerm2ShellEditViewSessionScriptsProfilesWindowHel iTerm2ShellEditViewSessionScriptsProfilesWindowHelpPreparation for Refi…. in 3h 42 m100% <78• Mon 18 May 11:18:23APP (-zsh)181DOCKER₴81DEV (docker)₴2APP (-zsh)screenpipe*₴4remote: Counting objects: 100% (832/832),done.remote: Compressing objects: 100% (298/298),done.remote: Total 1047 (delta 634), reused 596 (delta 534), pack-reused 215 (from 3)Receiving objects: 100% (1047/1047), 353.16 KiB | 1.56 MiB/s, done.Resolving deltas: 100% (687/687), completed with 107 local objects.From github.com:jiminny/app907c54896c..34656c53edpipedrive-sdk-poc-› origin/pipedrive-sdk-poc03325ec50f..4e7078fd8bJY-18091-upgrade-to-php-8-5APP-> origin/JY-18091-upgrade-to-php-8-5e7d231e163..bc6a3fceбbJY-20725-handle-HS-search-rate-limit-› origin/JY-20725-handle-HS-search-rate-limit* [new branch]JY-20749-user-can-view-recorded-meetings-> origin/JY-20749-user-can-view-recorded-meetings98ca281a04..e0351be069JY-20808-low-priority-indexing-queue-> origin/JY-20808-low-priority-indexing-queue569abb5149..3906a9238aJY-20835-mcp-enable-users-to-get-a-list-of-deals-and-their-details -> origin/JY-20835-mcp-enable-users-to-get-a-list-of-deals-and-their-detailsad6c2a86e8..50eb6afba9* [new branch]JY-20846-mcp-enable-the-ai-to-know-details-about-the-user-> origin/JY-20846-mcp-enable-the-ai-to-know-details-about-the-userJY-20893-chunk-control-per-update-target-> origin/JY-20893-chunk-control-per-update-target31c62924a5..cb4ebf0c36master-> origin/masterUpdating 907c54896c..34656c53edFast-forwardPIPEDRIVE_V2_MIGRATION_TICKETS.md |52+++++++file changed, 52 insertions(+)lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (pipedrive-sdk-poc) $ co master.env.localconfig/logging.phpSwitched to branch"master'Your branch is behind 'origin/master' by 31 commits, and can be fast-forwarded.(use "git pull" to update your local branch)lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ git pullUpdating 31c62924a5..cb4ebf0c36Fast-forwardapp/Component/ES/Processor/Traits/SelectEntityListTrait.phpapp/Services/Calendar/CalendarActivityService.phpapp/Services/Calendar/Command/MapActivityData.phpdocs/mcp/explorer/explorer.htmldocs/mcp/explorer/explorer.template.htmldocs/mcp/tools-list.jsondocs/mcp/tools.mdtests/Unit/Component/ES/AsyncUpdateElasticSearchTest.phptests/Unit/Component/ES/Listeners/UpdateMultipleTargetsListenerTest.phptests/Unit/Component/ES/Listeners/UpdateSingleTargetListenerTest.phptests/Unit/Component/ES/Processor/TargetEntitiesSelectorTest.phptests/Unit/Component/ES/Processor/Traits/SelectEntityListTraitTest.phptests/Unit/Component/ES/UpdateProcessManagerTest.phptests/Unit/Services/Calendar/CalendarActivityServiceTest.phptests/Unit/Services/Calendar/Command/MapActivityDataTest.php2046106104| 10213731171610691521507815 files changed, 832 insertions(+), 322 deletions(-)lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ |...
|
51161
|
NULL
|
NULL
|
NULL
|
|
51165
|
1799
|
66
|
2026-05-18T08:18:25.614290+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092305614_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
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
Sync Changes
Hide This Notification
Code changed:
Hide
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}...
|
[{"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":"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":"3","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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false}]...
|
-6381525115353700546
|
-8992544785176520239
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
51166
|
1800
|
70
|
2026-05-18T08:18:25.614266+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092305614_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}...
|
[{"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":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.3480718,"top":0.10055866,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.35771278,"top":0.09896249,"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.3650266,"top":0.09896249,"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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"bounds":{"left":0.15658244,"top":0.09736632,"width":0.24335106,"height":0.8818835},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false}]...
|
-6381525115353700546
|
-8992544785176520239
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
51167
|
1800
|
71
|
2026-05-18T08:18:26.405183+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092306405_m2.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}
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":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.3480718,"top":0.10055866,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.35771278,"top":0.09896249,"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.3650266,"top":0.09896249,"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\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\n }\n}","depth":4,"bounds":{"left":0.15658244,"top":0.09736632,"width":0.24335106,"height":0.8818835},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\Settings\\Teams;\n\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Support\\Facades\\Log;\nuse Jiminny\\Actions\\InviteUserToTeamAction;\nuse Jiminny\\Interactions\\Settings\\Teams\\CreateTeam;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\EditTeamRequest;\nuse Jiminny\\Interactions\\Settings\\Teams\\EditTeam;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\n\nfinal class TeamController extends Controller\n{\n /**\n * Create a new team, subscription and invitation.\n */\n public function store(\n CreateTeamRequest $request,\n CreateTeam $createTeam,\n InviteUserToTeamAction $inviteUserToTeamAction,\n ): void {\n /** @var User $teamCreator */\n $teamCreator = $request->user();\n\n try {\n $data = $request->all();\n $team = $createTeam->handle($teamCreator, $data, $request->getDomain());\n\n $inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));\n } catch (\\Exception $exception) {\n Log::error('An error occurred while creating team', [\n 'e_message' => $exception->getMessage(),\n 'e_code' => $exception->getCode(),\n ]);\n\n throw $exception;\n }\n }\n\n public function edit(\n Team $team,\n EditTeamRequest $request,\n EditTeam $editTeam,\n ): JsonResponse {\n /** @var User $teamEditor */\n $teamEditor = $request->user();\n $editTeam->handle($team, $teamEditor, $request->all(), $request);\n\n return response()->json([], JsonResponse::HTTP_OK);\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":"6","depth":4,"bounds":{"left":0.5880984,"top":0.10055866,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"17","depth":4,"bounds":{"left":0.5980718,"top":0.10055866,"width":0.00930851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.6090425,"top":0.09896249,"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.6163564,"top":0.09896249,"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\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\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,"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.08843085,"top":0.05027933,"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":"Expand Selected","depth":4,"bounds":{"left":0.09940159,"top":0.05027933,"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":"Collapse All","depth":4,"bounds":{"left":0.10804521,"top":0.05027933,"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":"Options","depth":4,"bounds":{"left":0.11668883,"top":0.05027933,"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":"Hide","depth":4,"bounds":{"left":0.12533244,"top":0.05027933,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
6714245380515899525
|
-8757710301784092983
|
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
3
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\Settings\Teams;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Jiminny\Actions\InviteUserToTeamAction;
use Jiminny\Interactions\Settings\Teams\CreateTeam;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Requests\Settings\Teams\EditTeamRequest;
use Jiminny\Interactions\Settings\Teams\EditTeam;
use Jiminny\Models\Team;
use Jiminny\Models\User;
final class TeamController extends Controller
{
/**
* Create a new team, subscription and invitation.
*/
public function store(
CreateTeamRequest $request,
CreateTeam $createTeam,
InviteUserToTeamAction $inviteUserToTeamAction,
): void {
/** @var User $teamCreator */
$teamCreator = $request->user();
try {
$data = $request->all();
$team = $createTeam->handle($teamCreator, $data, $request->getDomain());
$inviteUserToTeamAction->execute(UserInvitationDTO::forOwner($request, $team));
} catch (\Exception $exception) {
Log::error('An error occurred while creating team', [
'e_message' => $exception->getMessage(),
'e_code' => $exception->getCode(),
]);
throw $exception;
}
}
public function edit(
Team $team,
EditTeamRequest $request,
EditTeam $editTeam,
): JsonResponse {
/** @var User $teamEditor */
$teamEditor = $request->user();
$editTeam->handle($team, $teamEditor, $request->all(), $request);
return response()->json([], JsonResponse::HTTP_OK);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
51166
|
NULL
|
NULL
|
NULL
|
|
51168
|
1799
|
67
|
2026-05-18T08:18:26.764090+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779092306764_m1.jpg...
|
PhpStorm
|
faVsco.js – TeamController.php
|
1
|
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...
|
[{"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}]...
|
-3088599111841370244
|
-8636775528843997756
|
click
|
hybrid
|
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
iTerm2ShellEditViewSessionScriptsProfilesWindowHelpPreparation for Refi…. in 3h 42 m100%8• Mon 18 May 11:18:26APP (-zsh)181DOCKERO ₴1DEV (docker)₴2remote: Counting objects: 100% (832/832),done.remote: Compressing objects: 100% (298/298),done.remote: Total 1047 (delta 634), reused 596 (delta 534), pack-reused 215 (from 3)Receiving objects: 100% (1047/1047), 353.16 KiB | 1.56 MiB/s, done.Resolving deltas: 100% (687/687), completed with 107 local objects.From github.com:jiminny/app907c54896c..34656c53ed03325ec50f..4e7078fd8be7d231e163..bc6a3fceбb* [new branch]98ca281a04..e0351be069569abb5149..3906a9238aad6c2a86e8..50eb6afba9* [new branch]31c62924a5..cb4ebf0c36Updating 907c54896c..34656c53edFast-forwardPIPEDRIVE_V2_MIGRATION_TICKETS.md |52++file changed, 52 insertions(+)lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (pipedrive-sdk-poc) $ co master.env.localconfig/logging.phpSwitched to branch"master'Your branch is behind 'origin/master' by 31 commits, and can be fast-forwarded.(use "git pull" to update your local branch)lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ git pullUpdating 31c62924a5..cb4ebf0c36Fast-forwardapp/Component/ES/Processor/Traits/SelectEntityListTrait.phpapp/Services/Calendar/CalendarActivityService.phpapp/Services/Calendar/Command/MapActivityData.phpdocs/mcp/explorer/explorer.htmldocs/mcp/explorer/explorer.template.htmldocs/mcp/tools-list.jsondocs/mcp/tools.mdtests/Unit/Component/ES/AsyncUpdateElasticSearchTest.phptests/Unit/Component/ES/Listeners/UpdateMultipleTargetsListenerTest.phptests/Unit/Component/ES/Listeners/UpdateSingleTargetListenerTest.phptests/Unit/Component/ES/Processor/TargetEntitiesSelectorTest.phptests/Unit/Component/ES/Processor/Traits/SelectEntityListTraitTest.phptests/Unit/Component/ES/UpdateProcessManagerTest.phptests/Unit/Services/Calendar/CalendarActivityServiceTest.phptests/Unit/Services/Calendar/Command/MapActivityDataTest.php2046106104| 10213731171610691521507815 files changed, 832 insertions(+), 322 deletions(-)lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ |APP (-zsh)screenpipe*₴4APPpipedrive-sdk-poc-› origin/pipedrive-sdk-pocJY-18091-upgrade-to-php-8-5-> origin/JY-18091-upgrade-to-php-8-5JY-20725-handle-HS-search-rate-limit-› origin/JY-20725-handle-HS-search-rate-limitJY-20749-user-can-view-recorded-meetings-> origin/JY-20749-user-can-view-recorded-meetingsJY-20808-low-priority-indexing-queue-> origin/JY-20808-low-priority-indexing-queueJY-20835-mcp-enable-users-to-get-a-list-of-deals-and-their-details -> origin/JY-20835-mcp-enable-users-to-get-a-list-of-deals-and-their-detailsJY-20846-mcp-enable-the-ai-to-know-details-about-the-user-> origin/JY-20846-mcp-enable-the-ai-to-know-details-about-the-userJY-20893-chunk-control-per-update-target-> origin/JY-20893-chunk-control-per-update-targetmaster-> origin/master+++++...
|
51165
|
NULL
|
NULL
|
NULL
|