@talkpilot/core-db 1.1.8 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +21 -24
- package/dist/connection.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/municipal/cities/cities.getters.d.ts +2 -2
- package/dist/municipal/cities/cities.getters.d.ts.map +1 -1
- package/dist/municipal/cities/cities.getters.js +8 -4
- package/dist/municipal/cities/cities.getters.js.map +1 -1
- package/dist/municipal/cities/cities.types.d.ts +1 -1
- package/dist/municipal/cities/index.d.ts +2 -2
- package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.d.ts +3 -3
- package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.d.ts.map +1 -1
- package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.js +30 -22
- package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.js.map +1 -1
- package/dist/municipal/departmentsSubjects/departmentsSubjects.types.d.ts +4 -4
- package/dist/municipal/departmentsSubjects/departmentsSubjects.types.d.ts.map +1 -1
- package/dist/municipal/departmentsSubjects/index.d.ts +2 -2
- package/dist/municipal/index.d.ts +8 -8
- package/dist/municipal/index.d.ts.map +1 -1
- package/dist/municipal/index.js +1 -1
- package/dist/municipal/mongodb-client.d.ts +1 -1
- package/dist/municipal/mongodb-client.d.ts.map +1 -1
- package/dist/municipal/mongodb-client.js +7 -7
- package/dist/municipal/mongodb-client.js.map +1 -1
- package/dist/municipal/streets/index.d.ts +2 -2
- package/dist/municipal/streets/streets.getters.d.ts +3 -3
- package/dist/municipal/streets/streets.getters.d.ts.map +1 -1
- package/dist/municipal/streets/streets.getters.js +19 -9
- package/dist/municipal/streets/streets.getters.js.map +1 -1
- package/dist/municipal/streets/streets.types.d.ts +1 -1
- package/dist/municipal/systemInstructions/index.d.ts +3 -3
- package/dist/municipal/systemInstructions/index.d.ts.map +1 -1
- package/dist/municipal/systemInstructions/instructions.getters.d.ts +3 -3
- package/dist/municipal/systemInstructions/instructions.getters.d.ts.map +1 -1
- package/dist/municipal/systemInstructions/instructions.getters.js +10 -4
- package/dist/municipal/systemInstructions/instructions.getters.js.map +1 -1
- package/dist/municipal/systemInstructions/instructions.setters.d.ts +2 -2
- package/dist/municipal/systemInstructions/instructions.setters.d.ts.map +1 -1
- package/dist/municipal/systemInstructions/instructions.setters.js +13 -8
- package/dist/municipal/systemInstructions/instructions.setters.js.map +1 -1
- package/dist/municipal/systemInstructions/instructions.types.d.ts +3 -3
- package/dist/municipal/systemInstructions/instructions.types.d.ts.map +1 -1
- package/dist/municipal/systemInstructions/instructions.types.js +6 -6
- package/dist/municipal/tickets/index.d.ts +2 -2
- package/dist/municipal/tickets/tickets.getters.d.ts +3 -3
- package/dist/municipal/tickets/tickets.getters.d.ts.map +1 -1
- package/dist/municipal/tickets/tickets.getters.js +50 -29
- package/dist/municipal/tickets/tickets.getters.js.map +1 -1
- package/dist/municipal/tickets/tickets.types.d.ts +1 -1
- package/dist/municipal/tickets/tickets.types.d.ts.map +1 -1
- package/dist/municipal/utils/types.d.ts +1 -1
- package/dist/municipal/utils/types.d.ts.map +1 -1
- package/dist/talkpilot/agents/agents.getters.d.ts +1 -1
- package/dist/talkpilot/agents/agents.getters.js +2 -2
- package/dist/talkpilot/agents/agents.types.d.ts +2 -2
- package/dist/talkpilot/agents/index.d.ts +2 -2
- package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.d.ts +2 -2
- package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.d.ts.map +1 -1
- package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.js +1 -1
- package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.js.map +1 -1
- package/dist/talkpilot/backgroundToolResults/backgroundToolResults.types.d.ts +2 -2
- package/dist/talkpilot/backgroundToolResults/index.d.ts +2 -2
- package/dist/talkpilot/calls/calls.getters.d.ts +4 -3
- package/dist/talkpilot/calls/calls.getters.d.ts.map +1 -1
- package/dist/talkpilot/calls/calls.getters.js +24 -16
- package/dist/talkpilot/calls/calls.getters.js.map +1 -1
- package/dist/talkpilot/calls/calls.types.d.ts +26 -3
- package/dist/talkpilot/calls/calls.types.d.ts.map +1 -1
- package/dist/talkpilot/calls/calls.types.js +2 -2
- package/dist/talkpilot/calls/index.d.ts +2 -2
- package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.d.ts +2 -2
- package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.d.ts.map +1 -1
- package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.js +2 -2
- package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.js.map +1 -1
- package/dist/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.d.ts +2 -2
- package/dist/talkpilot/clientAudioBuffers/index.d.ts +2 -2
- package/dist/talkpilot/clients/clients.getters.d.ts +2 -2
- package/dist/talkpilot/clients/clients.getters.d.ts.map +1 -1
- package/dist/talkpilot/clients/clients.getters.js +5 -2
- package/dist/talkpilot/clients/clients.getters.js.map +1 -1
- package/dist/talkpilot/clients/clients.types.d.ts +1 -1
- package/dist/talkpilot/clients/index.d.ts +2 -2
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts +2 -2
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.js +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.js.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts +3 -3
- package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/index.d.ts +2 -2
- package/dist/talkpilot/flows/flows.getter.d.ts +2 -2
- package/dist/talkpilot/flows/flows.getter.d.ts.map +1 -1
- package/dist/talkpilot/flows/flows.getter.js +1 -1
- package/dist/talkpilot/flows/flows.getter.js.map +1 -1
- package/dist/talkpilot/flows/flows.schema.d.ts +0 -3
- package/dist/talkpilot/flows/flows.schema.d.ts.map +1 -1
- package/dist/talkpilot/flows/flows.schema.js +87 -80
- package/dist/talkpilot/flows/flows.schema.js.map +1 -1
- package/dist/talkpilot/flows/flows.types.d.ts +16 -17
- package/dist/talkpilot/flows/flows.types.d.ts.map +1 -1
- package/dist/talkpilot/flows/index.d.ts +2 -2
- package/dist/talkpilot/groups/groups.getters.d.ts +2 -2
- package/dist/talkpilot/groups/groups.getters.d.ts.map +1 -1
- package/dist/talkpilot/groups/groups.getters.js +2 -2
- package/dist/talkpilot/groups/groups.getters.js.map +1 -1
- package/dist/talkpilot/groups/groups.types.d.ts +1 -1
- package/dist/talkpilot/groups/index.d.ts +3 -3
- package/dist/talkpilot/groups/phone.utils.d.ts +1 -1
- package/dist/talkpilot/groups/phone.utils.d.ts.map +1 -1
- package/dist/talkpilot/groups/phone.utils.js +2 -2
- package/dist/talkpilot/groups/phone.utils.js.map +1 -1
- package/dist/talkpilot/index.d.ts +16 -16
- package/dist/talkpilot/index.js +1 -1
- package/dist/talkpilot/leads/index.d.ts +2 -2
- package/dist/talkpilot/leads/leads.getter.d.ts +2 -2
- package/dist/talkpilot/leads/leads.getter.d.ts.map +1 -1
- package/dist/talkpilot/leads/leads.getter.js +1 -1
- package/dist/talkpilot/leads/leads.getter.js.map +1 -1
- package/dist/talkpilot/leads/leads.schema.js +16 -16
- package/dist/talkpilot/leads/leads.types.d.ts +1 -1
- package/dist/talkpilot/mongodb-client.d.ts +1 -1
- package/dist/talkpilot/mongodb-client.js +8 -9
- package/dist/talkpilot/mongodb-client.js.map +1 -1
- package/dist/talkpilot/phone_numbers/index.d.ts +1 -1
- package/dist/talkpilot/phone_numbers/index.d.ts.map +1 -1
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts +5 -2
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts.map +1 -1
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.js +66 -12
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.js.map +1 -1
- package/dist/talkpilot/phone_numbers/phone_numbers.schema.d.ts +11 -2
- package/dist/talkpilot/phone_numbers/phone_numbers.schema.d.ts.map +1 -1
- package/dist/talkpilot/phone_numbers/phone_numbers.schema.js +5 -2
- package/dist/talkpilot/phone_numbers/phone_numbers.schema.js.map +1 -1
- package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts +16 -3
- package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts.map +1 -1
- package/dist/talkpilot/plans/index.d.ts +2 -2
- package/dist/talkpilot/plans/plans.getters.d.ts +2 -2
- package/dist/talkpilot/plans/plans.getters.d.ts.map +1 -1
- package/dist/talkpilot/plans/plans.getters.js +3 -3
- package/dist/talkpilot/plans/plans.getters.js.map +1 -1
- package/dist/talkpilot/plans/plans.types.d.ts +4 -4
- package/dist/talkpilot/plans/plans.types.d.ts.map +1 -1
- package/dist/talkpilot/plans/plans.types.js +19 -19
- package/dist/talkpilot/results/index.d.ts +2 -2
- package/dist/talkpilot/results/index.d.ts.map +1 -1
- package/dist/talkpilot/results/index.js.map +1 -1
- package/dist/talkpilot/results/results.getter.d.ts +3 -3
- package/dist/talkpilot/results/results.getter.d.ts.map +1 -1
- package/dist/talkpilot/results/results.getter.js +4 -4
- package/dist/talkpilot/results/results.getter.js.map +1 -1
- package/dist/talkpilot/results/results.schema.js +18 -18
- package/dist/talkpilot/results/results.types.d.ts +1 -1
- package/dist/talkpilot/sessions/index.d.ts +2 -2
- package/dist/talkpilot/sessions/sessions.getter.d.ts +3 -3
- package/dist/talkpilot/sessions/sessions.getter.d.ts.map +1 -1
- package/dist/talkpilot/sessions/sessions.getter.js +13 -10
- package/dist/talkpilot/sessions/sessions.getter.js.map +1 -1
- package/dist/talkpilot/sessions/sessions.schema.js +17 -17
- package/dist/talkpilot/sessions/sessions.types.d.ts +2 -2
- package/dist/talkpilot/subscriptions/index.d.ts +3 -3
- package/dist/talkpilot/subscriptions/subscriptions.getters.d.ts +2 -2
- package/dist/talkpilot/subscriptions/subscriptions.getters.d.ts.map +1 -1
- package/dist/talkpilot/subscriptions/subscriptions.getters.js +11 -11
- package/dist/talkpilot/subscriptions/subscriptions.getters.js.map +1 -1
- package/dist/talkpilot/subscriptions/subscriptions.getters.utils.d.ts +2 -2
- package/dist/talkpilot/subscriptions/subscriptions.getters.utils.d.ts.map +1 -1
- package/dist/talkpilot/subscriptions/subscriptions.getters.utils.js.map +1 -1
- package/dist/talkpilot/subscriptions/subscriptions.types.d.ts +2 -2
- package/dist/talkpilot/subscriptions/subscriptions.types.d.ts.map +1 -1
- package/dist/talkpilot/subscriptions/subscriptions.types.js +7 -7
- package/dist/talkpilot/utils/query.utils.d.ts +1 -1
- package/dist/test-utils/db-utils.d.ts +1 -1
- package/dist/test-utils/db-utils.js +2 -2
- package/dist/test-utils/factories/index.d.ts +12 -12
- package/dist/test-utils/factories/municipal/cities.d.ts +2 -2
- package/dist/test-utils/factories/municipal/cities.d.ts.map +1 -1
- package/dist/test-utils/factories/municipal/cities.js +1 -1
- package/dist/test-utils/factories/municipal/departmentsSubjects.d.ts +2 -2
- package/dist/test-utils/factories/municipal/departmentsSubjects.d.ts.map +1 -1
- package/dist/test-utils/factories/municipal/departmentsSubjects.js +7 -1
- package/dist/test-utils/factories/municipal/departmentsSubjects.js.map +1 -1
- package/dist/test-utils/factories/municipal/streets.d.ts +2 -2
- package/dist/test-utils/factories/municipal/streets.d.ts.map +1 -1
- package/dist/test-utils/factories/municipal/streets.js +6 -1
- package/dist/test-utils/factories/municipal/streets.js.map +1 -1
- package/dist/test-utils/factories/municipal/tickets.d.ts +2 -2
- package/dist/test-utils/factories/municipal/tickets.d.ts.map +1 -1
- package/dist/test-utils/factories/municipal/tickets.js +7 -1
- package/dist/test-utils/factories/municipal/tickets.js.map +1 -1
- package/dist/test-utils/factories/talkpilot/agents.d.ts +2 -2
- package/dist/test-utils/factories/talkpilot/agents.d.ts.map +1 -1
- package/dist/test-utils/factories/talkpilot/agents.js +4 -4
- package/dist/test-utils/factories/talkpilot/calls.d.ts +2 -2
- package/dist/test-utils/factories/talkpilot/calls.d.ts.map +1 -1
- package/dist/test-utils/factories/talkpilot/calls.js +1 -1
- package/dist/test-utils/factories/talkpilot/clientAudioBuffers.d.ts +2 -2
- package/dist/test-utils/factories/talkpilot/clientAudioBuffers.d.ts.map +1 -1
- package/dist/test-utils/factories/talkpilot/clientAudioBuffers.js +1 -1
- package/dist/test-utils/factories/talkpilot/clientAudioBuffers.js.map +1 -1
- package/dist/test-utils/factories/talkpilot/clientsConfig.d.ts +2 -2
- package/dist/test-utils/factories/talkpilot/clientsConfig.d.ts.map +1 -1
- package/dist/test-utils/factories/talkpilot/clientsConfig.js.map +1 -1
- package/dist/test-utils/factories/talkpilot/flows.d.ts +3 -3
- package/dist/test-utils/factories/talkpilot/flows.d.ts.map +1 -1
- package/dist/test-utils/factories/talkpilot/flows.js.map +1 -1
- package/dist/test-utils/factories/talkpilot/groups.d.ts +2 -2
- package/dist/test-utils/factories/talkpilot/groups.d.ts.map +1 -1
- package/dist/test-utils/factories/talkpilot/groups.js +9 -9
- package/dist/test-utils/factories/talkpilot/groups.js.map +1 -1
- package/dist/test-utils/factories/talkpilot/phone_numbers.d.ts +3 -3
- package/dist/test-utils/factories/talkpilot/phone_numbers.d.ts.map +1 -1
- package/dist/test-utils/factories/talkpilot/phone_numbers.js.map +1 -1
- package/dist/test-utils/factories/talkpilot/sessions.d.ts +2 -2
- package/dist/test-utils/factories/talkpilot/sessions.d.ts.map +1 -1
- package/dist/test-utils/factories/talkpilot/sessions.js +1 -1
- package/dist/utils/validation.js +2 -2
- package/dist/utils/validation.js.map +1 -1
- package/package.json +3 -1
- package/src/__tests__/setup.ts +3 -3
- package/src/connection.ts +27 -25
- package/src/index.ts +9 -9
- package/src/municipal/__tests__/validation.spec.ts +35 -23
- package/src/municipal/cities/cities.getters.ts +16 -10
- package/src/municipal/cities/cities.types.ts +1 -1
- package/src/municipal/cities/index.ts +2 -2
- package/src/municipal/departmentsSubjects/departmentsSubjects.getters.ts +53 -44
- package/src/municipal/departmentsSubjects/departmentsSubjects.types.ts +5 -5
- package/src/municipal/departmentsSubjects/index.ts +2 -3
- package/src/municipal/index.ts +10 -10
- package/src/municipal/mongodb-client.ts +13 -10
- package/src/municipal/streets/index.ts +2 -2
- package/src/municipal/streets/streets.getters.ts +43 -23
- package/src/municipal/streets/streets.types.ts +1 -1
- package/src/municipal/systemInstructions/__tests__/getters.spec.ts +67 -52
- package/src/municipal/systemInstructions/__tests__/setters.spec.ts +271 -238
- package/src/municipal/systemInstructions/index.ts +7 -3
- package/src/municipal/systemInstructions/instructions.getters.ts +30 -18
- package/src/municipal/systemInstructions/instructions.setters.ts +43 -19
- package/src/municipal/systemInstructions/instructions.types.ts +10 -10
- package/src/municipal/tickets/__tests__/tickets.getters.spec.ts +12 -12
- package/src/municipal/tickets/index.ts +2 -2
- package/src/municipal/tickets/tickets.getters.ts +69 -42
- package/src/municipal/tickets/tickets.types.ts +2 -2
- package/src/municipal/utils/types.ts +8 -3
- package/src/talkpilot/__tests__/db.spec.ts +12 -12
- package/src/talkpilot/__tests__/mongodb-client.spec.ts +7 -8
- package/src/talkpilot/__tests__/validation.spec.ts +30 -24
- package/src/talkpilot/agents/__tests__/agents.getters.spec.ts +10 -10
- package/src/talkpilot/agents/agents.getters.ts +3 -3
- package/src/talkpilot/agents/agents.types.ts +2 -2
- package/src/talkpilot/agents/index.ts +2 -2
- package/src/talkpilot/backgroundToolResults/__tests__/backgroundToolResults.getters.spec.ts +42 -31
- package/src/talkpilot/backgroundToolResults/backgroundToolResults.getters.ts +11 -11
- package/src/talkpilot/backgroundToolResults/backgroundToolResults.types.ts +2 -3
- package/src/talkpilot/backgroundToolResults/index.ts +2 -2
- package/src/talkpilot/calls/__tests__/callStats.utils.spec.ts +27 -27
- package/src/talkpilot/calls/__tests__/calls.spec.ts +178 -40
- package/src/talkpilot/calls/calls.getters.ts +57 -27
- package/src/talkpilot/calls/calls.types.ts +39 -16
- package/src/talkpilot/calls/index.ts +2 -2
- package/src/talkpilot/clientAudioBuffers/__tests__/clientAudioBuffer.getters.spec.ts +73 -39
- package/src/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.ts +18 -11
- package/src/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.ts +2 -2
- package/src/talkpilot/clientAudioBuffers/index.ts +2 -2
- package/src/talkpilot/clients/clients.getters.ts +10 -5
- package/src/talkpilot/clients/clients.types.ts +1 -1
- package/src/talkpilot/clients/index.ts +2 -2
- package/src/talkpilot/clientsConfig/__tests__/clientsConfig.spec.ts +21 -18
- package/src/talkpilot/clientsConfig/clientsConfig.getters.ts +6 -4
- package/src/talkpilot/clientsConfig/clientsConfig.types.ts +10 -8
- package/src/talkpilot/clientsConfig/index.ts +2 -2
- package/src/talkpilot/flows/__tests__/flows.schema.spec.ts +38 -37
- package/src/talkpilot/flows/flows.getter.ts +8 -5
- package/src/talkpilot/flows/flows.schema.ts +87 -80
- package/src/talkpilot/flows/flows.types.ts +23 -24
- package/src/talkpilot/flows/index.ts +2 -2
- package/src/talkpilot/groups/__tests__/groups.spec.ts +34 -27
- package/src/talkpilot/groups/__tests__/phone.utils.spec.ts +20 -20
- package/src/talkpilot/groups/groups.getters.ts +8 -5
- package/src/talkpilot/groups/groups.types.ts +1 -1
- package/src/talkpilot/groups/index.ts +3 -3
- package/src/talkpilot/groups/phone.utils.ts +12 -6
- package/src/talkpilot/index.ts +17 -17
- package/src/talkpilot/leads/index.ts +2 -2
- package/src/talkpilot/leads/leads.getter.ts +5 -4
- package/src/talkpilot/leads/leads.schema.ts +16 -16
- package/src/talkpilot/leads/leads.types.ts +1 -1
- package/src/talkpilot/mongodb-client.ts +12 -12
- package/src/talkpilot/phone_numbers/__tests__/phone_numbers.spec.ts +162 -33
- package/src/talkpilot/phone_numbers/index.ts +1 -1
- package/src/talkpilot/phone_numbers/phone_numbers.getter.ts +94 -18
- package/src/talkpilot/phone_numbers/phone_numbers.schema.ts +5 -2
- package/src/talkpilot/phone_numbers/phone_numbers.types.ts +18 -3
- package/src/talkpilot/plans/__tests__/plans.spec.ts +30 -26
- package/src/talkpilot/plans/index.ts +2 -2
- package/src/talkpilot/plans/plans.getters.ts +25 -18
- package/src/talkpilot/plans/plans.types.ts +27 -23
- package/src/talkpilot/results/index.ts +5 -2
- package/src/talkpilot/results/results.getter.ts +9 -8
- package/src/talkpilot/results/results.schema.ts +18 -18
- package/src/talkpilot/results/results.types.ts +1 -1
- package/src/talkpilot/sessions/__tests__/sessions.spec.ts +65 -41
- package/src/talkpilot/sessions/index.ts +2 -2
- package/src/talkpilot/sessions/sessions.getter.ts +21 -16
- package/src/talkpilot/sessions/sessions.schema.ts +17 -17
- package/src/talkpilot/sessions/sessions.types.ts +2 -2
- package/src/talkpilot/subscriptions/__tests__/subscriptions.getters.utils.spec.ts +18 -15
- package/src/talkpilot/subscriptions/index.ts +3 -3
- package/src/talkpilot/subscriptions/subscriptions.getters.ts +36 -33
- package/src/talkpilot/subscriptions/subscriptions.getters.utils.ts +10 -3
- package/src/talkpilot/subscriptions/subscriptions.types.ts +9 -9
- package/src/talkpilot/utils/__tests__/query.utils.spec.ts +8 -8
- package/src/talkpilot/utils/query.utils.ts +2 -2
- package/src/test-utils/db-utils.ts +5 -5
- package/src/test-utils/factories/index.ts +12 -12
- package/src/test-utils/factories/municipal/cities.ts +5 -5
- package/src/test-utils/factories/municipal/departmentsSubjects.ts +32 -25
- package/src/test-utils/factories/municipal/streets.ts +10 -5
- package/src/test-utils/factories/municipal/tickets.ts +12 -6
- package/src/test-utils/factories/talkpilot/agents.ts +8 -8
- package/src/test-utils/factories/talkpilot/calls.ts +5 -5
- package/src/test-utils/factories/talkpilot/clientAudioBuffers.ts +14 -12
- package/src/test-utils/factories/talkpilot/clientsConfig.ts +7 -8
- package/src/test-utils/factories/talkpilot/flows.ts +7 -5
- package/src/test-utils/factories/talkpilot/groups.ts +13 -13
- package/src/test-utils/factories/talkpilot/phone_numbers.ts +8 -6
- package/src/test-utils/factories/talkpilot/sessions.ts +5 -5
- package/src/utils/validation.ts +4 -4
|
@@ -8,12 +8,14 @@ import {
|
|
|
8
8
|
countCalls,
|
|
9
9
|
getCallsByClientAndDateRange,
|
|
10
10
|
getCallsCollection,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
pushToolExecution,
|
|
12
|
+
} from "../calls.getters";
|
|
13
|
+
import type { ToolExecution } from '../calls.types';
|
|
14
|
+
import { ObjectId } from "mongodb";
|
|
15
|
+
import { createOutGoingCallDoc } from "../../../test-utils/factories";
|
|
16
|
+
|
|
17
|
+
describe("db.calls", () => {
|
|
18
|
+
it("should return calls by flow", async () => {
|
|
17
19
|
const flowId = new ObjectId();
|
|
18
20
|
const call1 = createOutGoingCallDoc({ flowId });
|
|
19
21
|
const call2 = createOutGoingCallDoc({ flowId });
|
|
@@ -26,11 +28,11 @@ describe('db.calls', () => {
|
|
|
26
28
|
expect(result.length).toBe(2);
|
|
27
29
|
expect(result).toMatchObject([
|
|
28
30
|
{ callSid: call1.callSid },
|
|
29
|
-
{ callSid: call2.callSid }
|
|
31
|
+
{ callSid: call2.callSid },
|
|
30
32
|
]);
|
|
31
33
|
});
|
|
32
34
|
|
|
33
|
-
it(
|
|
35
|
+
it("should get call by callSid", async () => {
|
|
34
36
|
const call = createOutGoingCallDoc();
|
|
35
37
|
await createCallDoc(call);
|
|
36
38
|
|
|
@@ -40,39 +42,54 @@ describe('db.calls', () => {
|
|
|
40
42
|
expect(result?.callSid).toBe(call.callSid);
|
|
41
43
|
});
|
|
42
44
|
|
|
43
|
-
it(
|
|
45
|
+
it("should get calls by client", async () => {
|
|
44
46
|
const call = createOutGoingCallDoc();
|
|
45
47
|
await createCallDoc(call);
|
|
46
48
|
|
|
47
49
|
const result = await getCallsByClient(call.clientId);
|
|
48
50
|
|
|
49
|
-
expect(result.some(c => c.callSid === call.callSid)).toBe(true);
|
|
51
|
+
expect(result.some((c) => c.callSid === call.callSid)).toBe(true);
|
|
50
52
|
});
|
|
51
53
|
|
|
52
|
-
it(
|
|
54
|
+
it("should get calls by phone number", async () => {
|
|
53
55
|
const call = createOutGoingCallDoc();
|
|
54
56
|
await createCallDoc(call);
|
|
55
57
|
|
|
56
58
|
const result = await getCallsByPhoneNumber(call.customerPhoneNumber);
|
|
57
59
|
|
|
58
|
-
expect(result.some(c => c.callSid === call.callSid)).toBe(true);
|
|
60
|
+
expect(result.some((c) => c.callSid === call.callSid)).toBe(true);
|
|
59
61
|
});
|
|
60
62
|
|
|
61
|
-
describe(
|
|
62
|
-
it(
|
|
63
|
-
const clientId =
|
|
64
|
-
const call1 = createOutGoingCallDoc({ clientId, status:
|
|
65
|
-
const call2 = createOutGoingCallDoc({ clientId, status:
|
|
66
|
-
const call3 = createOutGoingCallDoc({ clientId, status:
|
|
63
|
+
describe("findCallsByQuery()", () => {
|
|
64
|
+
it("should find calls by status with limit and sort", async () => {
|
|
65
|
+
const clientId = "client123";
|
|
66
|
+
const call1 = createOutGoingCallDoc({ clientId, status: "completed" });
|
|
67
|
+
const call2 = createOutGoingCallDoc({ clientId, status: "completed" });
|
|
68
|
+
const call3 = createOutGoingCallDoc({ clientId, status: "busy" });
|
|
67
69
|
|
|
68
70
|
// We need to control createdAt to test sort. We'll insert directly.
|
|
69
|
-
await getCallsCollection().insertOne({
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
await getCallsCollection().insertOne({
|
|
72
|
+
...call1,
|
|
73
|
+
createdAt: new Date("2023-01-01"),
|
|
74
|
+
updatedAt: new Date(),
|
|
75
|
+
env: "test",
|
|
76
|
+
});
|
|
77
|
+
await getCallsCollection().insertOne({
|
|
78
|
+
...call2,
|
|
79
|
+
createdAt: new Date("2023-01-02"),
|
|
80
|
+
updatedAt: new Date(),
|
|
81
|
+
env: "test",
|
|
82
|
+
});
|
|
83
|
+
await getCallsCollection().insertOne({
|
|
84
|
+
...call3,
|
|
85
|
+
createdAt: new Date(),
|
|
86
|
+
updatedAt: new Date(),
|
|
87
|
+
env: "test",
|
|
88
|
+
});
|
|
72
89
|
|
|
73
90
|
const result = await findCallsByQuery(
|
|
74
|
-
{ clientId, status:
|
|
75
|
-
{ sort: { createdAt: -1 }, limit: 1 }
|
|
91
|
+
{ clientId, status: "completed" },
|
|
92
|
+
{ sort: { createdAt: -1 }, limit: 1 },
|
|
76
93
|
);
|
|
77
94
|
|
|
78
95
|
expect(result.length).toBe(1);
|
|
@@ -80,33 +97,154 @@ describe('db.calls', () => {
|
|
|
80
97
|
});
|
|
81
98
|
});
|
|
82
99
|
|
|
83
|
-
describe(
|
|
84
|
-
it(
|
|
85
|
-
const clientId =
|
|
86
|
-
await createCallDoc(
|
|
87
|
-
|
|
88
|
-
|
|
100
|
+
describe("countCalls()", () => {
|
|
101
|
+
it("should count calls matching query", async () => {
|
|
102
|
+
const clientId = "countClient";
|
|
103
|
+
await createCallDoc(
|
|
104
|
+
createOutGoingCallDoc({ clientId, status: "completed" }),
|
|
105
|
+
);
|
|
106
|
+
await createCallDoc(
|
|
107
|
+
createOutGoingCallDoc({ clientId, status: "completed" }),
|
|
108
|
+
);
|
|
109
|
+
await createCallDoc(
|
|
110
|
+
createOutGoingCallDoc({ clientId, status: "failed" }),
|
|
111
|
+
);
|
|
89
112
|
|
|
90
|
-
const count = await countCalls({ clientId, status:
|
|
113
|
+
const count = await countCalls({ clientId, status: "completed" });
|
|
91
114
|
expect(count).toBe(2);
|
|
92
115
|
});
|
|
93
116
|
});
|
|
94
117
|
|
|
95
|
-
describe('
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
118
|
+
describe('pushToolExecution()', () => {
|
|
119
|
+
let callSid: string;
|
|
120
|
+
|
|
121
|
+
beforeEach(async () => {
|
|
122
|
+
const call = createOutGoingCallDoc();
|
|
123
|
+
await createCallDoc(call);
|
|
124
|
+
callSid = call.callSid;
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const makeHttpExecution = (overrides?: Partial<ToolExecution>): ToolExecution => ({
|
|
128
|
+
toolName: 'sendSms',
|
|
129
|
+
executedAt: new Date(),
|
|
130
|
+
durationMs: 120,
|
|
131
|
+
args: { to: '+1234567890', message: 'hello' },
|
|
132
|
+
meta: { kind: 'http', url: 'https://api.example.com/sms', method: 'POST' },
|
|
133
|
+
status: 'success',
|
|
134
|
+
httpStatus: 200,
|
|
135
|
+
...overrides,
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('should append an execution to a call with none', async () => {
|
|
139
|
+
const execution = makeHttpExecution();
|
|
140
|
+
await pushToolExecution(callSid, execution);
|
|
141
|
+
|
|
142
|
+
const result = await getCallByCallSid(callSid);
|
|
143
|
+
expect(result?.toolExecutions).toHaveLength(1);
|
|
144
|
+
expect(result?.toolExecutions?.[0]).toMatchObject({
|
|
145
|
+
toolName: 'sendSms',
|
|
146
|
+
status: 'success',
|
|
147
|
+
httpStatus: 200,
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('should maintain insertion order across multiple pushes', async () => {
|
|
152
|
+
const first = makeHttpExecution({ toolName: 'first' });
|
|
153
|
+
const second = makeHttpExecution({ toolName: 'second' });
|
|
154
|
+
const third = makeHttpExecution({ toolName: 'third' });
|
|
155
|
+
|
|
156
|
+
await pushToolExecution(callSid, first);
|
|
157
|
+
await pushToolExecution(callSid, second);
|
|
158
|
+
await pushToolExecution(callSid, third);
|
|
159
|
+
|
|
160
|
+
const result = await getCallByCallSid(callSid);
|
|
161
|
+
expect(result?.toolExecutions?.map(e => e.toolName)).toEqual(['first', 'second', 'third']);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('should store an internal tool execution', async () => {
|
|
165
|
+
const execution: ToolExecution = {
|
|
166
|
+
toolName: 'endFlow',
|
|
167
|
+
executedAt: new Date(),
|
|
168
|
+
durationMs: 5,
|
|
169
|
+
args: {},
|
|
170
|
+
meta: { kind: 'internal' },
|
|
171
|
+
status: 'success',
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
await pushToolExecution(callSid, execution);
|
|
175
|
+
|
|
176
|
+
const result = await getCallByCallSid(callSid);
|
|
177
|
+
expect(result?.toolExecutions?.[0]).toMatchObject({
|
|
178
|
+
toolName: 'endFlow',
|
|
179
|
+
meta: { kind: 'internal' },
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('should store redacted args for sensitive tools', async () => {
|
|
184
|
+
const execution = makeHttpExecution({ args: { _redacted: true } });
|
|
185
|
+
await pushToolExecution(callSid, execution);
|
|
186
|
+
|
|
187
|
+
const result = await getCallByCallSid(callSid);
|
|
188
|
+
expect(result?.toolExecutions?.[0].args).toEqual({ _redacted: true });
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('should store an error execution', async () => {
|
|
192
|
+
const execution = makeHttpExecution({ status: 'error', httpStatus: 500 });
|
|
193
|
+
await pushToolExecution(callSid, execution);
|
|
194
|
+
|
|
195
|
+
const result = await getCallByCallSid(callSid);
|
|
196
|
+
expect(result?.toolExecutions?.[0]).toMatchObject({ status: 'error', httpStatus: 500 });
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('should be a no-op for an unknown callSid', async () => {
|
|
200
|
+
await expect(pushToolExecution('nonexistent-sid', makeHttpExecution())).resolves.not.toThrow();
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it('should store the response body', async () => {
|
|
204
|
+
const execution = makeHttpExecution({
|
|
205
|
+
response: { userId: '123', status: 'sent' },
|
|
206
|
+
});
|
|
207
|
+
await pushToolExecution(callSid, execution);
|
|
208
|
+
|
|
209
|
+
const result = await getCallByCallSid(callSid);
|
|
210
|
+
expect(result?.toolExecutions?.[0].response).toEqual({ userId: '123', status: 'sent' });
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
describe("getCallsByClientAndDateRange()", () => {
|
|
215
|
+
it("should return calls within date range", async () => {
|
|
216
|
+
const clientId = "dateRangeClient";
|
|
217
|
+
const startDate = new Date("2023-05-01");
|
|
218
|
+
const endDate = new Date("2023-05-31");
|
|
100
219
|
|
|
101
220
|
const callInside = createOutGoingCallDoc({ clientId });
|
|
102
221
|
const callBefore = createOutGoingCallDoc({ clientId });
|
|
103
222
|
const callAfter = createOutGoingCallDoc({ clientId });
|
|
104
223
|
|
|
105
|
-
await getCallsCollection().insertOne({
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
224
|
+
await getCallsCollection().insertOne({
|
|
225
|
+
...callInside,
|
|
226
|
+
createdAt: new Date("2023-05-15"),
|
|
227
|
+
updatedAt: new Date(),
|
|
228
|
+
env: "test",
|
|
229
|
+
});
|
|
230
|
+
await getCallsCollection().insertOne({
|
|
231
|
+
...callBefore,
|
|
232
|
+
createdAt: new Date("2023-04-30"),
|
|
233
|
+
updatedAt: new Date(),
|
|
234
|
+
env: "test",
|
|
235
|
+
});
|
|
236
|
+
await getCallsCollection().insertOne({
|
|
237
|
+
...callAfter,
|
|
238
|
+
createdAt: new Date("2023-06-01"),
|
|
239
|
+
updatedAt: new Date(),
|
|
240
|
+
env: "test",
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
const result = await getCallsByClientAndDateRange(
|
|
244
|
+
clientId,
|
|
245
|
+
startDate,
|
|
246
|
+
endDate,
|
|
247
|
+
);
|
|
110
248
|
expect(result.length).toBe(1);
|
|
111
249
|
expect(result[0].callSid).toBe(callInside.callSid);
|
|
112
250
|
});
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
Call,
|
|
3
|
+
CallDoc,
|
|
4
|
+
CallQueryOptions,
|
|
5
|
+
CallUpdateParams,
|
|
6
|
+
getDb,
|
|
7
|
+
} from "../index";
|
|
8
|
+
import type { CallsByHour, CountOpts, DateRange, ToolExecution } from "./calls.types";
|
|
9
|
+
import { Filter, ObjectId } from "mongodb";
|
|
10
|
+
import * as process from "node:process";
|
|
11
|
+
import { applyQueryOptions } from "../utils/query.utils";
|
|
6
12
|
|
|
7
13
|
export const getCallsCollection = () => {
|
|
8
|
-
return getDb().collection<Call>(
|
|
14
|
+
return getDb().collection<Call>("calls");
|
|
9
15
|
};
|
|
10
16
|
|
|
11
17
|
export const getCallByCallSid = (callSid: string) => {
|
|
@@ -13,7 +19,9 @@ export const getCallByCallSid = (callSid: string) => {
|
|
|
13
19
|
};
|
|
14
20
|
|
|
15
21
|
export const getCallsByPhoneNumber = (phoneNumber: string) => {
|
|
16
|
-
return getCallsCollection()
|
|
22
|
+
return getCallsCollection()
|
|
23
|
+
.find({ customerPhoneNumber: phoneNumber })
|
|
24
|
+
.toArray();
|
|
17
25
|
};
|
|
18
26
|
|
|
19
27
|
export const getCallsByClient = (clientId: string) => {
|
|
@@ -24,20 +32,22 @@ export const getCallsByFlow = (flowId: ObjectId) => {
|
|
|
24
32
|
return getCallsCollection().find({ flowId }).toArray();
|
|
25
33
|
};
|
|
26
34
|
|
|
27
|
-
export const createCallDoc = (
|
|
35
|
+
export const createCallDoc = (
|
|
36
|
+
call: Omit<Call, "createdAt" | "updatedAt" | "env">,
|
|
37
|
+
) => {
|
|
28
38
|
return getCallsCollection().insertOne({
|
|
29
39
|
...call,
|
|
30
40
|
createdAt: new Date(),
|
|
31
41
|
updatedAt: new Date(),
|
|
32
|
-
env: process.env.ENV ??
|
|
42
|
+
env: process.env.ENV ?? "unknown",
|
|
33
43
|
});
|
|
34
44
|
};
|
|
35
45
|
|
|
36
46
|
export const updateCallByCallSid = async (
|
|
37
47
|
callSid: string,
|
|
38
|
-
updates: CallUpdateParams
|
|
48
|
+
updates: CallUpdateParams,
|
|
39
49
|
): Promise<CallDoc | null> => {
|
|
40
|
-
|
|
50
|
+
return await getCallsCollection().findOneAndUpdate(
|
|
41
51
|
{ callSid: callSid },
|
|
42
52
|
{
|
|
43
53
|
$set: {
|
|
@@ -45,15 +55,27 @@ export const updateCallByCallSid = async (
|
|
|
45
55
|
updatedAt: new Date(),
|
|
46
56
|
},
|
|
47
57
|
},
|
|
48
|
-
{ returnDocument:
|
|
58
|
+
{ returnDocument: "after" },
|
|
49
59
|
);
|
|
60
|
+
};
|
|
50
61
|
|
|
51
|
-
|
|
62
|
+
export const pushToolExecution = async (
|
|
63
|
+
callSid: string,
|
|
64
|
+
execution: ToolExecution
|
|
65
|
+
): Promise<void> => {
|
|
66
|
+
await getCallsCollection().updateOne(
|
|
67
|
+
{ callSid },
|
|
68
|
+
{ $push: { toolExecutions: execution } }
|
|
69
|
+
);
|
|
52
70
|
};
|
|
53
71
|
|
|
54
72
|
// get calls by client and date range
|
|
55
73
|
//client here is the user id
|
|
56
|
-
export const getCallsByClientAndDateRange = (
|
|
74
|
+
export const getCallsByClientAndDateRange = (
|
|
75
|
+
clientId: string,
|
|
76
|
+
startDate: Date,
|
|
77
|
+
endDate: Date,
|
|
78
|
+
) => {
|
|
57
79
|
return getCallsCollection()
|
|
58
80
|
.find({
|
|
59
81
|
clientId,
|
|
@@ -67,7 +89,7 @@ export const getCallsByClientAndDateRange = (clientId: string, startDate: Date,
|
|
|
67
89
|
|
|
68
90
|
export const findCallsByQuery = async (
|
|
69
91
|
query: Filter<Call>,
|
|
70
|
-
options?: CallQueryOptions
|
|
92
|
+
options?: CallQueryOptions,
|
|
71
93
|
): Promise<CallDoc[]> => {
|
|
72
94
|
const cursor = getCallsCollection().find(query);
|
|
73
95
|
return await applyQueryOptions(cursor, options).toArray();
|
|
@@ -124,7 +146,7 @@ export const range = {
|
|
|
124
146
|
|
|
125
147
|
export function startOfDay(d: Date = new Date()): Date {
|
|
126
148
|
const x = new Date(d);
|
|
127
|
-
x.
|
|
149
|
+
x.setUTCHours(0, 0, 0, 0);
|
|
128
150
|
return x;
|
|
129
151
|
}
|
|
130
152
|
|
|
@@ -142,21 +164,29 @@ export async function getCallsStatsForDateRange(
|
|
|
142
164
|
clientId: string,
|
|
143
165
|
startStr: string,
|
|
144
166
|
endStr: string,
|
|
145
|
-
timezone: string
|
|
167
|
+
timezone: string,
|
|
146
168
|
): Promise<{ count: number; totalLen: number; completed: number }> {
|
|
147
169
|
const coll = getCallsCollection();
|
|
148
170
|
const out = await coll
|
|
149
|
-
.aggregate<{
|
|
171
|
+
.aggregate<{
|
|
172
|
+
_id: null;
|
|
173
|
+
count: number;
|
|
174
|
+
totalLen: number;
|
|
175
|
+
completed: number;
|
|
176
|
+
}>([
|
|
150
177
|
// 1. Restrict to the given client
|
|
151
178
|
{ $match: { clientId } },
|
|
152
179
|
// 2. Derive dateLocal (createdAt as YYYY-MM-DD in timezone) and isCompleted (agentHungUp or status='completed')
|
|
153
180
|
{
|
|
154
181
|
$addFields: {
|
|
155
182
|
dateLocal: {
|
|
156
|
-
$dateToString: { format:
|
|
183
|
+
$dateToString: { format: "%Y-%m-%d", date: "$createdAt", timezone },
|
|
157
184
|
},
|
|
158
185
|
isCompleted: {
|
|
159
|
-
$or: [
|
|
186
|
+
$or: [
|
|
187
|
+
{ $eq: ["$agentHungUp", true] },
|
|
188
|
+
{ $eq: ["$status", "completed"] },
|
|
189
|
+
],
|
|
160
190
|
},
|
|
161
191
|
},
|
|
162
192
|
},
|
|
@@ -167,8 +197,8 @@ export async function getCallsStatsForDateRange(
|
|
|
167
197
|
$group: {
|
|
168
198
|
_id: null,
|
|
169
199
|
count: { $sum: 1 },
|
|
170
|
-
totalLen: { $sum:
|
|
171
|
-
completed: { $sum: { $cond: [
|
|
200
|
+
totalLen: { $sum: "$callLength" },
|
|
201
|
+
completed: { $sum: { $cond: ["$isCompleted", 1, 0] } },
|
|
172
202
|
},
|
|
173
203
|
},
|
|
174
204
|
])
|
|
@@ -186,7 +216,7 @@ export async function getCallsStatsForDateRange(
|
|
|
186
216
|
export async function getCallsHourlyAggregation(
|
|
187
217
|
clientId: string,
|
|
188
218
|
dateStr: string,
|
|
189
|
-
timezone: string
|
|
219
|
+
timezone: string,
|
|
190
220
|
): Promise<CallsByHour[]> {
|
|
191
221
|
const coll = getCallsCollection();
|
|
192
222
|
const rows = await coll
|
|
@@ -197,22 +227,22 @@ export async function getCallsHourlyAggregation(
|
|
|
197
227
|
{
|
|
198
228
|
$addFields: {
|
|
199
229
|
dateLocal: {
|
|
200
|
-
$dateToString: { format:
|
|
230
|
+
$dateToString: { format: "%Y-%m-%d", date: "$createdAt", timezone },
|
|
201
231
|
},
|
|
202
|
-
hour: { $hour: { date:
|
|
232
|
+
hour: { $hour: { date: "$createdAt", timezone } },
|
|
203
233
|
},
|
|
204
234
|
},
|
|
205
235
|
// 3. Keep only the requested date
|
|
206
236
|
{ $match: { dateLocal: dateStr } },
|
|
207
237
|
// 4. Group by hour, sum calls per hour
|
|
208
|
-
{ $group: { _id:
|
|
238
|
+
{ $group: { _id: "$hour", calls: { $sum: 1 } } },
|
|
209
239
|
// 5. Order by hour ascending (0..23)
|
|
210
240
|
{ $sort: { _id: 1 } },
|
|
211
241
|
])
|
|
212
242
|
.toArray();
|
|
213
243
|
|
|
214
244
|
return rows.map((r: any) => ({
|
|
215
|
-
hour: `${String(r._id).padStart(2,
|
|
245
|
+
hour: `${String(r._id).padStart(2, "0")}:00`,
|
|
216
246
|
calls: r.calls,
|
|
217
247
|
}));
|
|
218
248
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ObjectId, Sort, WithId } from
|
|
2
|
-
import { TranscriptionSegment } from
|
|
1
|
+
import { ObjectId, Sort, WithId } from "mongodb";
|
|
2
|
+
import { TranscriptionSegment } from "../results";
|
|
3
3
|
|
|
4
|
-
export const CONFERENCE_ROLE_CUSTOMER =
|
|
5
|
-
export const CONFERENCE_ROLE_SUPERVISOR =
|
|
4
|
+
export const CONFERENCE_ROLE_CUSTOMER = "customer" as const;
|
|
5
|
+
export const CONFERENCE_ROLE_SUPERVISOR = "supervisor" as const;
|
|
6
6
|
|
|
7
7
|
export type ConferenceRole =
|
|
8
8
|
| typeof CONFERENCE_ROLE_CUSTOMER
|
|
@@ -38,8 +38,31 @@ export type Call = {
|
|
|
38
38
|
isConferenceCall?: boolean;
|
|
39
39
|
conferenceRole?: ConferenceRole;
|
|
40
40
|
redirectedCall?: boolean;
|
|
41
|
+
toolExecutions?: ToolExecution[];
|
|
41
42
|
};
|
|
42
43
|
|
|
44
|
+
export type ToolExecution = {
|
|
45
|
+
toolName: string;
|
|
46
|
+
executedAt: Date;
|
|
47
|
+
durationMs: number;
|
|
48
|
+
args: Record<string, unknown> | { _redacted: true };
|
|
49
|
+
meta: ToolExecutionMeta;
|
|
50
|
+
status: 'success' | 'error';
|
|
51
|
+
httpStatus?: number;
|
|
52
|
+
response?: Record<string, unknown>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type ToolExecutionMeta =
|
|
56
|
+
| {
|
|
57
|
+
kind: 'http';
|
|
58
|
+
url: string;
|
|
59
|
+
method: string;
|
|
60
|
+
flowToolId?: string;
|
|
61
|
+
runInBackground?: boolean;
|
|
62
|
+
sensitive?: boolean;
|
|
63
|
+
}
|
|
64
|
+
| { kind: 'internal' };
|
|
65
|
+
|
|
43
66
|
export type CallQueryOptions = {
|
|
44
67
|
sort?: Sort;
|
|
45
68
|
skip?: number;
|
|
@@ -62,18 +85,18 @@ export type CallsFilterParams = {
|
|
|
62
85
|
};
|
|
63
86
|
|
|
64
87
|
export type ImmutableCallFields =
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
88
|
+
| "customerPhoneNumber"
|
|
89
|
+
| "agentPhoneNumber"
|
|
90
|
+
| "isIncomingCall"
|
|
91
|
+
| "isOutgoingCall"
|
|
92
|
+
| "sessionId"
|
|
93
|
+
| "callSid"
|
|
94
|
+
| "flowId"
|
|
95
|
+
| "clientId"
|
|
96
|
+
| "runId"
|
|
97
|
+
| "resultId"
|
|
98
|
+
| "env"
|
|
99
|
+
| "createdAt";
|
|
77
100
|
|
|
78
101
|
export type CallUpdateParams = Partial<Omit<Call, ImmutableCallFields>>;
|
|
79
102
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./calls.types";
|
|
2
|
+
export * from "./calls.getters";
|