@talkpilot/core-db 1.1.6 → 1.1.8
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/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +24 -21
- 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 +4 -8
- 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 +22 -30
- 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 +25 -13
- 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 +9 -19
- 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 +4 -10
- 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 +8 -13
- 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 +29 -50
- 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 +3 -3
- package/dist/talkpilot/calls/calls.getters.d.ts.map +1 -1
- package/dist/talkpilot/calls/calls.getters.js +15 -19
- package/dist/talkpilot/calls/calls.getters.js.map +1 -1
- package/dist/talkpilot/calls/calls.types.d.ts +3 -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 +2 -5
- 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 +3 -0
- package/dist/talkpilot/flows/flows.schema.d.ts.map +1 -1
- package/dist/talkpilot/flows/flows.schema.js +80 -87
- package/dist/talkpilot/flows/flows.schema.js.map +1 -1
- package/dist/talkpilot/flows/flows.types.d.ts +17 -16
- 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.d.ts.map +1 -1
- package/dist/talkpilot/mongodb-client.js +29 -16
- package/dist/talkpilot/mongodb-client.js.map +1 -1
- package/dist/talkpilot/phone_numbers/index.d.ts +2 -2
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts +3 -3
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts.map +1 -1
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.js +13 -28
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.js.map +1 -1
- package/dist/talkpilot/phone_numbers/phone_numbers.schema.js +9 -9
- package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts +1 -1
- 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 +10 -13
- 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 +1 -7
- 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 +1 -6
- 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 +1 -7
- 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 +1 -3
- package/src/__tests__/setup.ts +3 -3
- package/src/connection.ts +25 -27
- package/src/index.ts +9 -9
- package/src/municipal/__tests__/validation.spec.ts +23 -35
- package/src/municipal/cities/cities.getters.ts +10 -16
- package/src/municipal/cities/cities.types.ts +1 -1
- package/src/municipal/cities/index.ts +2 -2
- package/src/municipal/departmentsSubjects/departmentsSubjects.getters.ts +44 -53
- package/src/municipal/departmentsSubjects/departmentsSubjects.types.ts +5 -5
- package/src/municipal/departmentsSubjects/index.ts +3 -2
- package/src/municipal/index.ts +10 -10
- package/src/municipal/mongodb-client.ts +26 -19
- package/src/municipal/streets/index.ts +2 -2
- package/src/municipal/streets/streets.getters.ts +23 -43
- package/src/municipal/streets/streets.types.ts +1 -1
- package/src/municipal/systemInstructions/__tests__/getters.spec.ts +52 -67
- package/src/municipal/systemInstructions/__tests__/setters.spec.ts +238 -271
- package/src/municipal/systemInstructions/index.ts +3 -7
- package/src/municipal/systemInstructions/instructions.getters.ts +18 -30
- package/src/municipal/systemInstructions/instructions.setters.ts +19 -43
- 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 +42 -69
- package/src/municipal/tickets/tickets.types.ts +2 -2
- package/src/municipal/utils/types.ts +3 -8
- package/src/talkpilot/__tests__/db.spec.ts +12 -12
- package/src/talkpilot/__tests__/mongodb-client.spec.ts +8 -7
- package/src/talkpilot/__tests__/validation.spec.ts +24 -30
- 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 +31 -42
- package/src/talkpilot/backgroundToolResults/backgroundToolResults.getters.ts +11 -11
- package/src/talkpilot/backgroundToolResults/backgroundToolResults.types.ts +3 -2
- 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 +39 -79
- package/src/talkpilot/calls/calls.getters.ts +28 -48
- package/src/talkpilot/calls/calls.types.ts +16 -16
- package/src/talkpilot/calls/index.ts +2 -2
- package/src/talkpilot/clientAudioBuffers/__tests__/clientAudioBuffer.getters.spec.ts +39 -73
- package/src/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.ts +11 -18
- package/src/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.ts +2 -2
- package/src/talkpilot/clientAudioBuffers/index.ts +2 -2
- package/src/talkpilot/clients/clients.getters.ts +5 -10
- 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 +18 -21
- package/src/talkpilot/clientsConfig/clientsConfig.getters.ts +4 -6
- package/src/talkpilot/clientsConfig/clientsConfig.types.ts +8 -10
- package/src/talkpilot/clientsConfig/index.ts +2 -2
- package/src/talkpilot/flows/__tests__/flows.schema.spec.ts +37 -38
- package/src/talkpilot/flows/flows.getter.ts +5 -8
- package/src/talkpilot/flows/flows.schema.ts +80 -87
- package/src/talkpilot/flows/flows.types.ts +24 -23
- package/src/talkpilot/flows/index.ts +2 -2
- package/src/talkpilot/groups/__tests__/groups.spec.ts +27 -34
- package/src/talkpilot/groups/__tests__/phone.utils.spec.ts +20 -20
- package/src/talkpilot/groups/groups.getters.ts +5 -8
- package/src/talkpilot/groups/groups.types.ts +1 -1
- package/src/talkpilot/groups/index.ts +3 -3
- package/src/talkpilot/groups/phone.utils.ts +6 -12
- package/src/talkpilot/index.ts +17 -17
- package/src/talkpilot/leads/index.ts +2 -2
- package/src/talkpilot/leads/leads.getter.ts +4 -5
- package/src/talkpilot/leads/leads.schema.ts +16 -16
- package/src/talkpilot/leads/leads.types.ts +1 -1
- package/src/talkpilot/mongodb-client.ts +33 -23
- package/src/talkpilot/phone_numbers/__tests__/phone_numbers.spec.ts +44 -84
- package/src/talkpilot/phone_numbers/index.ts +2 -2
- package/src/talkpilot/phone_numbers/phone_numbers.getter.ts +22 -44
- package/src/talkpilot/phone_numbers/phone_numbers.schema.ts +9 -9
- package/src/talkpilot/phone_numbers/phone_numbers.types.ts +1 -1
- package/src/talkpilot/plans/__tests__/plans.spec.ts +26 -30
- package/src/talkpilot/plans/index.ts +2 -2
- package/src/talkpilot/plans/plans.getters.ts +18 -25
- package/src/talkpilot/plans/plans.types.ts +23 -27
- package/src/talkpilot/results/index.ts +2 -5
- package/src/talkpilot/results/results.getter.ts +8 -9
- 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 +41 -65
- package/src/talkpilot/sessions/index.ts +2 -2
- package/src/talkpilot/sessions/sessions.getter.ts +16 -21
- 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 +15 -18
- package/src/talkpilot/subscriptions/index.ts +3 -3
- package/src/talkpilot/subscriptions/subscriptions.getters.ts +33 -36
- package/src/talkpilot/subscriptions/subscriptions.getters.utils.ts +3 -10
- 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 +25 -32
- package/src/test-utils/factories/municipal/streets.ts +5 -10
- package/src/test-utils/factories/municipal/tickets.ts +6 -12
- 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 +12 -14
- package/src/test-utils/factories/talkpilot/clientsConfig.ts +8 -7
- package/src/test-utils/factories/talkpilot/flows.ts +5 -7
- package/src/test-utils/factories/talkpilot/groups.ts +13 -13
- package/src/test-utils/factories/talkpilot/phone_numbers.ts +6 -8
- package/src/test-utils/factories/talkpilot/sessions.ts +5 -5
- package/src/utils/validation.ts +4 -4
- package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts +0 -4
- package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts.map +0 -1
- package/dist/talkpilot/subscriptions/subscriptions.utils.js +0 -20
- package/dist/talkpilot/subscriptions/subscriptions.utils.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WithId } from
|
|
1
|
+
import { WithId } from 'mongodb';
|
|
2
2
|
|
|
3
3
|
export type InitiateCallForShortSlaConfig = {
|
|
4
4
|
active: boolean;
|
|
@@ -35,16 +35,16 @@ export type Products = {
|
|
|
35
35
|
export type ClinicsProduct = {
|
|
36
36
|
api_key_secret_name: string;
|
|
37
37
|
base_api_url: string;
|
|
38
|
-
provider:
|
|
38
|
+
provider: 'clinix' | (string & {});
|
|
39
39
|
description?: string;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
export type ClientLanguageName =
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
43
|
+
| 'Hebrew'
|
|
44
|
+
| 'English'
|
|
45
|
+
| 'Russian'
|
|
46
|
+
| 'French'
|
|
47
|
+
| 'Spanish'
|
|
48
48
|
| (string & {});
|
|
49
49
|
|
|
50
50
|
export type SendGridConfig = {
|
|
@@ -72,6 +72,4 @@ export type ClientConfig<P extends Products = Products> = {
|
|
|
72
72
|
communications?: CommunicationsConfig;
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
export type ClientConfigDoc<P extends Products = Products> = WithId<
|
|
76
|
-
ClientConfig<P>
|
|
77
|
-
>;
|
|
75
|
+
export type ClientConfigDoc<P extends Products = Products> = WithId<ClientConfig<P>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './clientsConfig.types';
|
|
2
|
+
export * from './clientsConfig.getters';
|
|
@@ -1,64 +1,63 @@
|
|
|
1
|
-
import { flowMongoSchema } from
|
|
1
|
+
import { flowMongoSchema } from '../flows.schema';
|
|
2
2
|
|
|
3
|
-
describe(
|
|
4
|
-
it(
|
|
3
|
+
describe('flowMongoSchema', () => {
|
|
4
|
+
it('defines conversationSettings as optional object or null', () => {
|
|
5
5
|
const schema: any = flowMongoSchema;
|
|
6
6
|
|
|
7
|
-
expect(schema.properties).toHaveProperty(
|
|
8
|
-
expect(schema.properties.conversationSettings.bsonType).toEqual([
|
|
9
|
-
|
|
10
|
-
"null",
|
|
11
|
-
]);
|
|
12
|
-
expect(schema.required).not.toContain("conversationSettings");
|
|
7
|
+
expect(schema.properties).toHaveProperty('conversationSettings');
|
|
8
|
+
expect(schema.properties.conversationSettings.bsonType).toEqual(['object', 'null']);
|
|
9
|
+
expect(schema.required).not.toContain('conversationSettings');
|
|
13
10
|
expect(schema.additionalProperties).toBe(false);
|
|
14
11
|
});
|
|
15
12
|
|
|
16
|
-
it(
|
|
13
|
+
it('defines conversationSettings with expected nested properties', () => {
|
|
17
14
|
const schema: any = flowMongoSchema;
|
|
18
15
|
const convSettings = schema.properties.conversationSettings.properties;
|
|
19
16
|
|
|
20
|
-
expect(convSettings).toHaveProperty(
|
|
21
|
-
expect(convSettings.interruptions.bsonType).toEqual([
|
|
17
|
+
expect(convSettings).toHaveProperty('interruptions');
|
|
18
|
+
expect(convSettings.interruptions.bsonType).toEqual(['object', 'null']);
|
|
22
19
|
|
|
23
20
|
const interruptions = convSettings.interruptions.properties;
|
|
24
|
-
expect(interruptions.enableInterruptionDetection.bsonType).toEqual(
|
|
25
|
-
expect(interruptions.interruptionWindowSeconds.bsonType).toEqual(
|
|
26
|
-
expect(interruptions.interruptionThresholdSeconds.bsonType).toEqual(
|
|
27
|
-
|
|
28
|
-
);
|
|
29
|
-
expect(interruptions.interruptionInstruction.bsonType).toEqual("string");
|
|
21
|
+
expect(interruptions.enableInterruptionDetection.bsonType).toEqual('bool');
|
|
22
|
+
expect(interruptions.interruptionWindowSeconds.bsonType).toEqual('number');
|
|
23
|
+
expect(interruptions.interruptionThresholdSeconds.bsonType).toEqual('number');
|
|
24
|
+
expect(interruptions.interruptionInstruction.bsonType).toEqual('string');
|
|
30
25
|
|
|
31
|
-
expect(convSettings).toHaveProperty(
|
|
32
|
-
expect(convSettings.silence.bsonType).toEqual([
|
|
26
|
+
expect(convSettings).toHaveProperty('silence');
|
|
27
|
+
expect(convSettings.silence.bsonType).toEqual(['object', 'null']);
|
|
33
28
|
|
|
34
29
|
const silence = convSettings.silence.properties;
|
|
35
|
-
expect(silence.enableSilenceDetection.bsonType).toEqual(
|
|
36
|
-
expect(silence.firstWarningSilenceSeconds.bsonType).toEqual(
|
|
37
|
-
expect(silence.firstWarningInstruction.bsonType).toEqual(
|
|
38
|
-
expect(silence.secondWarningSilenceSeconds.bsonType).toEqual(
|
|
39
|
-
expect(silence.secondWarningInstruction.bsonType).toEqual(
|
|
40
|
-
expect(silence.disconnectSilenceSeconds.bsonType).toEqual(
|
|
41
|
-
expect(convSettings).toHaveProperty(
|
|
42
|
-
expect(convSettings.liveTimeUpdates.bsonType).toEqual(
|
|
30
|
+
expect(silence.enableSilenceDetection.bsonType).toEqual('bool');
|
|
31
|
+
expect(silence.firstWarningSilenceSeconds.bsonType).toEqual('number');
|
|
32
|
+
expect(silence.firstWarningInstruction.bsonType).toEqual('string');
|
|
33
|
+
expect(silence.secondWarningSilenceSeconds.bsonType).toEqual('number');
|
|
34
|
+
expect(silence.secondWarningInstruction.bsonType).toEqual('string');
|
|
35
|
+
expect(silence.disconnectSilenceSeconds.bsonType).toEqual('number');
|
|
36
|
+
expect(convSettings).toHaveProperty('liveTimeUpdates');
|
|
37
|
+
expect(convSettings.liveTimeUpdates.bsonType).toEqual('bool');
|
|
43
38
|
});
|
|
44
39
|
|
|
45
|
-
it(
|
|
40
|
+
it('should define tools schema and return a backgroundToolType enum with allowed values', () => {
|
|
46
41
|
const schema: any = flowMongoSchema;
|
|
47
42
|
|
|
48
|
-
expect(schema.properties).toHaveProperty(
|
|
49
|
-
expect(schema.properties.tools.bsonType).toEqual([
|
|
43
|
+
expect(schema.properties).toHaveProperty('tools');
|
|
44
|
+
expect(schema.properties.tools.bsonType).toEqual(['array', 'null']);
|
|
50
45
|
|
|
51
46
|
const toolItem = schema.properties.tools.items;
|
|
52
|
-
expect(toolItem.bsonType).toBe(
|
|
47
|
+
expect(toolItem.bsonType).toBe('object');
|
|
53
48
|
|
|
54
|
-
expect(toolItem.properties).toHaveProperty(
|
|
55
|
-
expect(toolItem.properties.runInBackground.bsonType).toBe(
|
|
49
|
+
expect(toolItem.properties).toHaveProperty('runInBackground');
|
|
50
|
+
expect(toolItem.properties.runInBackground.bsonType).toBe('bool');
|
|
56
51
|
|
|
57
|
-
expect(toolItem.properties).toHaveProperty(
|
|
58
|
-
expect(toolItem.properties.backgroundToolType.bsonType).toBe(
|
|
52
|
+
expect(toolItem.properties).toHaveProperty('backgroundToolType');
|
|
53
|
+
expect(toolItem.properties.backgroundToolType.bsonType).toBe('string');
|
|
59
54
|
expect(toolItem.properties.backgroundToolType.enum).toEqual([
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
'backgroundToolAlways',
|
|
56
|
+
'backgroundToolOnce',
|
|
62
57
|
]);
|
|
58
|
+
|
|
59
|
+
expect(toolItem.properties).toHaveProperty('backgroundContinuationInstructions');
|
|
60
|
+
expect(toolItem.properties.backgroundContinuationInstructions.bsonType).toBe('string');
|
|
63
61
|
});
|
|
64
62
|
});
|
|
63
|
+
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import type { Collection, ObjectId, WithId } from
|
|
2
|
-
import { getDb } from
|
|
3
|
-
import type { Flow } from
|
|
1
|
+
import type { Collection, ObjectId, WithId } from 'mongodb';
|
|
2
|
+
import { getDb } from '../index';
|
|
3
|
+
import type { Flow } from './flows.types';
|
|
4
4
|
|
|
5
5
|
export const getFlowsCollection = (): Collection<Flow> => {
|
|
6
|
-
return getDb().collection<Flow>(
|
|
6
|
+
return getDb().collection<Flow>('flows');
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export const findFlowById = (
|
|
10
|
-
flowId: ObjectId,
|
|
11
|
-
clientId: string,
|
|
12
|
-
): Promise<WithId<Flow> | null> => {
|
|
9
|
+
export const findFlowById = (flowId: ObjectId, clientId: string): Promise<WithId<Flow> | null> => {
|
|
13
10
|
return getFlowsCollection().findOne({ _id: flowId, clientId });
|
|
14
11
|
};
|
|
@@ -1,148 +1,141 @@
|
|
|
1
1
|
export const flowMongoSchema = {
|
|
2
|
-
bsonType:
|
|
3
|
-
required: [
|
|
4
|
-
"flowName",
|
|
5
|
-
"systemInstructions",
|
|
6
|
-
"initialSentence",
|
|
7
|
-
"interactions",
|
|
8
|
-
],
|
|
2
|
+
bsonType: 'object',
|
|
3
|
+
required: ['flowName', 'systemInstructions', 'initialSentence', 'interactions'],
|
|
9
4
|
properties: {
|
|
10
|
-
_id: { bsonType:
|
|
11
|
-
flowName: { bsonType:
|
|
12
|
-
clientId: { bsonType:
|
|
13
|
-
systemInstructions: { bsonType:
|
|
14
|
-
initialSentence: { bsonType:
|
|
15
|
-
voice: { bsonType: [
|
|
5
|
+
_id: { bsonType: 'objectId' },
|
|
6
|
+
flowName: { bsonType: 'string' },
|
|
7
|
+
clientId: { bsonType: 'string' },
|
|
8
|
+
systemInstructions: { bsonType: 'string' },
|
|
9
|
+
initialSentence: { bsonType: 'string' },
|
|
10
|
+
voice: { bsonType: ['string', 'null'] },
|
|
16
11
|
conversationSettings: {
|
|
17
|
-
bsonType: [
|
|
12
|
+
bsonType: ['object', 'null'],
|
|
18
13
|
properties: {
|
|
19
14
|
interruptions: {
|
|
20
|
-
bsonType: [
|
|
15
|
+
bsonType: ['object', 'null'],
|
|
21
16
|
properties: {
|
|
22
|
-
enableInterruptionDetection: { bsonType:
|
|
23
|
-
interruptionWindowSeconds: { bsonType:
|
|
24
|
-
interruptionThresholdSeconds: { bsonType:
|
|
25
|
-
interruptionInstruction: { bsonType:
|
|
17
|
+
enableInterruptionDetection: { bsonType: 'bool' },
|
|
18
|
+
interruptionWindowSeconds: { bsonType: 'number' },
|
|
19
|
+
interruptionThresholdSeconds: { bsonType: 'number' },
|
|
20
|
+
interruptionInstruction: { bsonType: 'string' },
|
|
26
21
|
},
|
|
27
22
|
additionalProperties: false,
|
|
28
23
|
},
|
|
29
24
|
silence: {
|
|
30
|
-
bsonType: [
|
|
25
|
+
bsonType: ['object', 'null'],
|
|
31
26
|
properties: {
|
|
32
|
-
enableSilenceDetection: { bsonType:
|
|
33
|
-
firstWarningSilenceSeconds: { bsonType:
|
|
34
|
-
firstWarningInstruction: { bsonType:
|
|
35
|
-
secondWarningSilenceSeconds: { bsonType:
|
|
36
|
-
secondWarningInstruction: { bsonType:
|
|
37
|
-
disconnectSilenceSeconds: { bsonType:
|
|
27
|
+
enableSilenceDetection: { bsonType: 'bool' },
|
|
28
|
+
firstWarningSilenceSeconds: { bsonType: 'number' },
|
|
29
|
+
firstWarningInstruction: { bsonType: 'string' },
|
|
30
|
+
secondWarningSilenceSeconds: { bsonType: 'number' },
|
|
31
|
+
secondWarningInstruction: { bsonType: 'string' },
|
|
32
|
+
disconnectSilenceSeconds: { bsonType: 'number' },
|
|
38
33
|
},
|
|
39
34
|
additionalProperties: false,
|
|
40
35
|
},
|
|
41
|
-
liveTimeUpdates: { bsonType:
|
|
36
|
+
liveTimeUpdates: { bsonType: 'bool' },
|
|
42
37
|
},
|
|
43
38
|
additionalProperties: false,
|
|
44
39
|
},
|
|
45
40
|
interactions: {
|
|
46
|
-
bsonType:
|
|
41
|
+
bsonType: 'array',
|
|
47
42
|
items: {
|
|
48
|
-
bsonType:
|
|
49
|
-
required: [
|
|
43
|
+
bsonType: 'object',
|
|
44
|
+
required: ['id', 'type', 'text', 'position'],
|
|
50
45
|
properties: {
|
|
51
|
-
id: { bsonType:
|
|
52
|
-
type: { bsonType:
|
|
53
|
-
text: { bsonType:
|
|
54
|
-
successStatus: { bsonType: [
|
|
46
|
+
id: { bsonType: 'string' },
|
|
47
|
+
type: { bsonType: 'string' },
|
|
48
|
+
text: { bsonType: 'string' },
|
|
49
|
+
successStatus: { bsonType: ['string', 'null'] },
|
|
55
50
|
conditions: {
|
|
56
|
-
bsonType: [
|
|
51
|
+
bsonType: ['array', 'null'],
|
|
57
52
|
items: {
|
|
58
|
-
bsonType:
|
|
59
|
-
required: [
|
|
53
|
+
bsonType: 'object',
|
|
54
|
+
required: ['conditionString'],
|
|
60
55
|
properties: {
|
|
61
|
-
conditionString: { bsonType:
|
|
62
|
-
nodeType: { bsonType: [
|
|
63
|
-
id: { bsonType: [
|
|
56
|
+
conditionString: { bsonType: 'string' },
|
|
57
|
+
nodeType: { bsonType: ['string', 'null'] },
|
|
58
|
+
id: { bsonType: ['string', 'null'] },
|
|
64
59
|
},
|
|
65
60
|
},
|
|
66
61
|
},
|
|
67
|
-
defaultNodeType: { bsonType: [
|
|
62
|
+
defaultNodeType: { bsonType: ['string', 'null'] },
|
|
68
63
|
defaultChild: {
|
|
69
|
-
bsonType: [
|
|
70
|
-
properties: { id: { bsonType:
|
|
64
|
+
bsonType: ['object', 'null'],
|
|
65
|
+
properties: { id: { bsonType: 'string' } },
|
|
71
66
|
},
|
|
72
67
|
position: {
|
|
73
|
-
bsonType:
|
|
74
|
-
required: [
|
|
68
|
+
bsonType: 'object',
|
|
69
|
+
required: ['x', 'y'],
|
|
75
70
|
properties: {
|
|
76
|
-
x: { bsonType:
|
|
77
|
-
y: { bsonType:
|
|
71
|
+
x: { bsonType: 'number' },
|
|
72
|
+
y: { bsonType: 'number' },
|
|
78
73
|
},
|
|
79
74
|
},
|
|
80
|
-
name: { bsonType: [
|
|
81
|
-
children: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
resultsLabel: { bsonType: ["string", "null"] },
|
|
86
|
-
resultsColor: { bsonType: ["string", "null"] },
|
|
75
|
+
name: { bsonType: ['string', 'null'] },
|
|
76
|
+
children: { bsonType: ['array', 'null'], items: { bsonType: 'string' } },
|
|
77
|
+
resultsLabel: { bsonType: ['string', 'null'] },
|
|
78
|
+
resultsColor: { bsonType: ['string', 'null'] },
|
|
87
79
|
},
|
|
88
80
|
},
|
|
89
81
|
},
|
|
90
82
|
edges: {
|
|
91
|
-
bsonType: [
|
|
83
|
+
bsonType: ['array', 'null'],
|
|
92
84
|
items: {
|
|
93
|
-
bsonType:
|
|
94
|
-
required: [
|
|
85
|
+
bsonType: 'object',
|
|
86
|
+
required: ['id', 'source', 'target'],
|
|
95
87
|
properties: {
|
|
96
|
-
id: { bsonType:
|
|
97
|
-
source: { bsonType:
|
|
98
|
-
target: { bsonType:
|
|
99
|
-
label: { bsonType: [
|
|
88
|
+
id: { bsonType: 'string' },
|
|
89
|
+
source: { bsonType: 'string' },
|
|
90
|
+
target: { bsonType: 'string' },
|
|
91
|
+
label: { bsonType: ['string', 'null'] },
|
|
100
92
|
},
|
|
101
93
|
},
|
|
102
94
|
},
|
|
103
95
|
metaKeys: {
|
|
104
|
-
bsonType: [
|
|
96
|
+
bsonType: ['array', 'null'],
|
|
105
97
|
items: {
|
|
106
|
-
bsonType:
|
|
107
|
-
required: [
|
|
98
|
+
bsonType: 'object',
|
|
99
|
+
required: ['key'],
|
|
108
100
|
properties: {
|
|
109
|
-
key: { bsonType:
|
|
110
|
-
required: { bsonType:
|
|
101
|
+
key: { bsonType: 'string' },
|
|
102
|
+
required: { bsonType: 'bool' },
|
|
111
103
|
},
|
|
112
104
|
},
|
|
113
105
|
},
|
|
114
106
|
userProperties: {
|
|
115
|
-
bsonType: [
|
|
107
|
+
bsonType: ['array', 'null'],
|
|
116
108
|
items: {
|
|
117
|
-
bsonType:
|
|
118
|
-
required: [
|
|
109
|
+
bsonType: 'object',
|
|
110
|
+
required: ['name', 'description'],
|
|
119
111
|
properties: {
|
|
120
|
-
name: { bsonType:
|
|
121
|
-
description: { bsonType:
|
|
112
|
+
name: { bsonType: 'string' },
|
|
113
|
+
description: { bsonType: 'string' },
|
|
122
114
|
},
|
|
123
115
|
},
|
|
124
116
|
},
|
|
125
117
|
tools: {
|
|
126
|
-
bsonType: [
|
|
118
|
+
bsonType: ['array', 'null'],
|
|
127
119
|
items: {
|
|
128
|
-
bsonType:
|
|
129
|
-
required: [
|
|
120
|
+
bsonType: 'object',
|
|
121
|
+
required: ['id', 'name', 'url', 'method', 'parameters'],
|
|
130
122
|
properties: {
|
|
131
|
-
id: { bsonType:
|
|
132
|
-
name: { bsonType:
|
|
133
|
-
description: { bsonType:
|
|
134
|
-
url: { bsonType:
|
|
135
|
-
method: { bsonType:
|
|
136
|
-
headers: { bsonType:
|
|
137
|
-
parameters: { bsonType:
|
|
138
|
-
bodyFormat: { bsonType:
|
|
139
|
-
preventAudioDuringTool: { bsonType:
|
|
140
|
-
sendUserAuthToken: { bsonType:
|
|
141
|
-
runInBackground: { bsonType:
|
|
123
|
+
id: { bsonType: 'string' },
|
|
124
|
+
name: { bsonType: 'string' },
|
|
125
|
+
description: { bsonType: 'string' },
|
|
126
|
+
url: { bsonType: 'string' },
|
|
127
|
+
method: { bsonType: 'string' },
|
|
128
|
+
headers: { bsonType: 'object' },
|
|
129
|
+
parameters: { bsonType: 'object' },
|
|
130
|
+
bodyFormat: { bsonType: 'string', enum: ['json', 'form-data'] },
|
|
131
|
+
preventAudioDuringTool: { bsonType: 'bool' },
|
|
132
|
+
sendUserAuthToken: { bsonType: 'bool' },
|
|
133
|
+
runInBackground: { bsonType: 'bool' },
|
|
142
134
|
backgroundToolType: {
|
|
143
|
-
bsonType:
|
|
144
|
-
enum: [
|
|
135
|
+
bsonType: 'string',
|
|
136
|
+
enum: ['backgroundToolAlways', 'backgroundToolOnce'],
|
|
145
137
|
},
|
|
138
|
+
backgroundContinuationInstructions: { bsonType: 'string' },
|
|
146
139
|
},
|
|
147
140
|
additionalProperties: false,
|
|
148
141
|
},
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ObjectId } from
|
|
1
|
+
import { ObjectId } from 'mongodb';
|
|
2
2
|
|
|
3
3
|
/* ---------- Basic helpers ---------- */
|
|
4
4
|
|
|
5
5
|
export type Position = { x: number; y: number };
|
|
6
|
-
export type HttpMethod =
|
|
6
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
7
7
|
|
|
8
|
-
export type QuestionType =
|
|
9
|
-
export type SelectionType =
|
|
8
|
+
export type QuestionType = 'open' | 'multiple' | 'table';
|
|
9
|
+
export type SelectionType = 'single' | 'multiple';
|
|
10
10
|
|
|
11
11
|
export type Question = {
|
|
12
12
|
id: string;
|
|
@@ -24,14 +24,14 @@ export type Question = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export type NodeKind =
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
27
|
+
| 'start'
|
|
28
|
+
| 'say'
|
|
29
|
+
| 'condition'
|
|
30
|
+
| 'improvise'
|
|
31
|
+
| 'tool'
|
|
32
|
+
| 'sendMessage'
|
|
33
|
+
| 'questionsList'
|
|
34
|
+
| 'end';
|
|
35
35
|
type BaseNode = {
|
|
36
36
|
id: string;
|
|
37
37
|
type: NodeKind;
|
|
@@ -44,12 +44,12 @@ type BaseNode = {
|
|
|
44
44
|
questions?: Question[] | null;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
export type StartNode = BaseNode & { type:
|
|
47
|
+
export type StartNode = BaseNode & { type: 'start' };
|
|
48
48
|
|
|
49
|
-
export type SayNode = BaseNode & { type:
|
|
49
|
+
export type SayNode = BaseNode & { type: 'say' };
|
|
50
50
|
|
|
51
51
|
export type ConditionNode = BaseNode & {
|
|
52
|
-
type:
|
|
52
|
+
type: 'condition';
|
|
53
53
|
conditions: Array<{
|
|
54
54
|
conditionString: string;
|
|
55
55
|
nodeType?: string | null;
|
|
@@ -59,7 +59,7 @@ export type ConditionNode = BaseNode & {
|
|
|
59
59
|
defaultChild?: { id?: string } | null;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
export type ImproviseNode = BaseNode & { type:
|
|
62
|
+
export type ImproviseNode = BaseNode & { type: 'improvise' };
|
|
63
63
|
|
|
64
64
|
export type FlowTool = {
|
|
65
65
|
id: string;
|
|
@@ -69,17 +69,18 @@ export type FlowTool = {
|
|
|
69
69
|
method: HttpMethod;
|
|
70
70
|
headers?: Record<string, string>;
|
|
71
71
|
parameters: Record<string, unknown>;
|
|
72
|
-
bodyFormat?:
|
|
72
|
+
bodyFormat?: 'json' | 'form-data';
|
|
73
73
|
preventAudioDuringTool?: boolean;
|
|
74
74
|
sendUserAuthToken?: boolean;
|
|
75
75
|
runInBackground?: boolean;
|
|
76
|
-
backgroundToolType?:
|
|
76
|
+
backgroundToolType?: 'backgroundToolAlways' | 'backgroundToolOnce';
|
|
77
|
+
backgroundContinuationInstructions?: string;
|
|
77
78
|
};
|
|
78
79
|
|
|
79
|
-
export type SendMethod =
|
|
80
|
+
export type SendMethod = 'sms' | 'whatsapp';
|
|
80
81
|
|
|
81
82
|
export type SendMessageNode = BaseNode & {
|
|
82
|
-
type:
|
|
83
|
+
type: 'sendMessage';
|
|
83
84
|
/** Which channel to use. If omitted, decide at runtime (e.g., default to whatsapp). */
|
|
84
85
|
send_method: SendMethod;
|
|
85
86
|
/** Destination phone (E.164 or templated string like "{{userPhone}}"). */
|
|
@@ -87,17 +88,17 @@ export type SendMessageNode = BaseNode & {
|
|
|
87
88
|
};
|
|
88
89
|
|
|
89
90
|
export type ToolNode = BaseNode & {
|
|
90
|
-
type:
|
|
91
|
+
type: 'tool';
|
|
91
92
|
name: string;
|
|
92
93
|
text: string;
|
|
93
94
|
};
|
|
94
95
|
|
|
95
96
|
export type QuestionsListNode = BaseNode & {
|
|
96
|
-
type:
|
|
97
|
+
type: 'questionsList';
|
|
97
98
|
questions: Question[];
|
|
98
99
|
};
|
|
99
100
|
|
|
100
|
-
export type EndNode = BaseNode & { type:
|
|
101
|
+
export type EndNode = BaseNode & { type: 'end' };
|
|
101
102
|
|
|
102
103
|
export type Interaction =
|
|
103
104
|
| StartNode
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getFlowsCollection, findFlowById } from
|
|
2
|
-
export type * from
|
|
1
|
+
export { getFlowsCollection, findFlowById } from './flows.getter';
|
|
2
|
+
export type * from './flows.types';
|
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
import { ObjectId } from
|
|
2
|
-
import { faker } from
|
|
1
|
+
import { ObjectId } from 'mongodb';
|
|
2
|
+
import { faker } from '@faker-js/faker';
|
|
3
3
|
import {
|
|
4
4
|
getGroupsCollection,
|
|
5
5
|
findGroups,
|
|
6
6
|
createGroup,
|
|
7
7
|
updateGroup,
|
|
8
8
|
removeGroup,
|
|
9
|
-
} from
|
|
10
|
-
import { createGroup as createGroupDoc } from
|
|
9
|
+
} from '../groups.getters';
|
|
10
|
+
import { createGroup as createGroupDoc } from '../../../test-utils/factories';
|
|
11
11
|
|
|
12
|
-
describe(
|
|
13
|
-
describe(
|
|
12
|
+
describe('db.groups', () => {
|
|
13
|
+
describe('getGroupsCollection', () => {
|
|
14
14
|
it('returns the "groups" collection', () => {
|
|
15
|
-
expect(getGroupsCollection().collectionName).toBe(
|
|
15
|
+
expect(getGroupsCollection().collectionName).toBe('groups');
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
describe(
|
|
20
|
-
it(
|
|
19
|
+
describe('findGroups', () => {
|
|
20
|
+
it('returns groups matching the provided filter', async () => {
|
|
21
21
|
const clientId = faker.string.uuid();
|
|
22
|
-
const g1 = createGroupDoc({ clientId, name:
|
|
23
|
-
const g2 = createGroupDoc({ clientId, name:
|
|
24
|
-
const gOther = createGroupDoc({
|
|
25
|
-
clientId: faker.string.uuid(),
|
|
26
|
-
name: "Group C",
|
|
27
|
-
});
|
|
22
|
+
const g1 = createGroupDoc({ clientId, name: 'Group A' });
|
|
23
|
+
const g2 = createGroupDoc({ clientId, name: 'Group B' });
|
|
24
|
+
const gOther = createGroupDoc({ clientId: faker.string.uuid(), name: 'Group C' });
|
|
28
25
|
|
|
29
26
|
await getGroupsCollection().insertMany([g1, g2, gOther]);
|
|
30
27
|
|
|
@@ -32,29 +29,26 @@ describe("db.groups", () => {
|
|
|
32
29
|
const names = result.map((g) => g.name).sort();
|
|
33
30
|
|
|
34
31
|
expect(result).toHaveLength(2);
|
|
35
|
-
expect(names).toEqual([
|
|
32
|
+
expect(names).toEqual(['Group A', 'Group B']);
|
|
36
33
|
});
|
|
37
34
|
});
|
|
38
35
|
|
|
39
|
-
describe(
|
|
40
|
-
it(
|
|
41
|
-
const toInsert = createGroupDoc({ name:
|
|
36
|
+
describe('createGroup', () => {
|
|
37
|
+
it('inserts a group and returns insertedId', async () => {
|
|
38
|
+
const toInsert = createGroupDoc({ name: 'New Group' });
|
|
42
39
|
|
|
43
40
|
const insertedId = await createGroup(toInsert);
|
|
44
41
|
expect(insertedId).toBeInstanceOf(ObjectId);
|
|
45
42
|
|
|
46
43
|
const fromDb = await getGroupsCollection().findOne({ _id: insertedId });
|
|
47
|
-
expect(fromDb?.name).toBe(
|
|
44
|
+
expect(fromDb?.name).toBe('New Group');
|
|
48
45
|
expect(fromDb?.clientId).toBe(toInsert.clientId);
|
|
49
46
|
});
|
|
50
47
|
});
|
|
51
48
|
|
|
52
|
-
describe(
|
|
53
|
-
it(
|
|
54
|
-
const original = createGroupDoc({
|
|
55
|
-
name: "Before",
|
|
56
|
-
description: "Old desc",
|
|
57
|
-
});
|
|
49
|
+
describe('updateGroup', () => {
|
|
50
|
+
it('updates the group and sets updatedAt, returning the updated document', async () => {
|
|
51
|
+
const original = createGroupDoc({ name: 'Before', description: 'Old desc' });
|
|
58
52
|
const { insertedId } = await getGroupsCollection().insertOne(original);
|
|
59
53
|
const before = await getGroupsCollection().findOne({ _id: insertedId });
|
|
60
54
|
|
|
@@ -63,22 +57,21 @@ describe("db.groups", () => {
|
|
|
63
57
|
|
|
64
58
|
const res = await updateGroup(
|
|
65
59
|
{ _id: insertedId },
|
|
66
|
-
{ name:
|
|
60
|
+
{ name: 'After', description: 'New desc' }
|
|
67
61
|
);
|
|
68
62
|
|
|
69
63
|
expect(res?._id).toEqual(insertedId);
|
|
70
|
-
expect(res?.name).toBe(
|
|
71
|
-
expect(res?.description).toBe(
|
|
64
|
+
expect(res?.name).toBe('After');
|
|
65
|
+
expect(res?.description).toBe('New desc');
|
|
72
66
|
expect(new Date(res!.updatedAt).getTime()).toBeGreaterThan(
|
|
73
|
-
new Date(before!.updatedAt).getTime()
|
|
67
|
+
new Date(before!.updatedAt).getTime()
|
|
74
68
|
);
|
|
75
69
|
});
|
|
76
70
|
});
|
|
77
71
|
|
|
78
|
-
describe(
|
|
79
|
-
it(
|
|
80
|
-
const { insertedId } =
|
|
81
|
-
await getGroupsCollection().insertOne(createGroupDoc());
|
|
72
|
+
describe('removeGroup', () => {
|
|
73
|
+
it('removes a group by string id', async () => {
|
|
74
|
+
const { insertedId } = await getGroupsCollection().insertOne(createGroupDoc());
|
|
82
75
|
|
|
83
76
|
const result = await removeGroup(insertedId.toHexString());
|
|
84
77
|
expect(result.deletedCount).toBe(1);
|