@talkpilot/core-db 1.0.1
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/.cursor/rules/development.mdc +65 -0
- package/DEVELOPMENT.md +98 -0
- package/README.md +140 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/municipal/cities/cities.getters.d.ts +9 -0
- package/dist/municipal/cities/cities.getters.d.ts.map +1 -0
- package/dist/municipal/cities/cities.getters.js +38 -0
- package/dist/municipal/cities/cities.getters.js.map +1 -0
- package/dist/municipal/cities/cities.types.d.ts +10 -0
- package/dist/municipal/cities/cities.types.d.ts.map +1 -0
- package/dist/municipal/cities/cities.types.js +3 -0
- package/dist/municipal/cities/cities.types.js.map +1 -0
- package/dist/municipal/cities/index.d.ts +3 -0
- package/dist/municipal/cities/index.d.ts.map +1 -0
- package/dist/municipal/cities/index.js +18 -0
- package/dist/municipal/cities/index.js.map +1 -0
- package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.d.ts +62 -0
- package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.d.ts.map +1 -0
- package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.js +180 -0
- package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.js.map +1 -0
- package/dist/municipal/departmentsSubjects/departmentsSubjects.types.d.ts +69 -0
- package/dist/municipal/departmentsSubjects/departmentsSubjects.types.d.ts.map +1 -0
- package/dist/municipal/departmentsSubjects/departmentsSubjects.types.js +3 -0
- package/dist/municipal/departmentsSubjects/departmentsSubjects.types.js.map +1 -0
- package/dist/municipal/departmentsSubjects/index.d.ts +3 -0
- package/dist/municipal/departmentsSubjects/index.d.ts.map +1 -0
- package/dist/municipal/departmentsSubjects/index.js +18 -0
- package/dist/municipal/departmentsSubjects/index.js.map +1 -0
- package/dist/municipal/index.d.ts +10 -0
- package/dist/municipal/index.d.ts.map +1 -0
- package/dist/municipal/index.js +37 -0
- package/dist/municipal/index.js.map +1 -0
- package/dist/municipal/mongodb-client.d.ts +13 -0
- package/dist/municipal/mongodb-client.d.ts.map +1 -0
- package/dist/municipal/mongodb-client.js +56 -0
- package/dist/municipal/mongodb-client.js.map +1 -0
- package/dist/municipal/streets/index.d.ts +3 -0
- package/dist/municipal/streets/index.d.ts.map +1 -0
- package/dist/municipal/streets/index.js +18 -0
- package/dist/municipal/streets/index.js.map +1 -0
- package/dist/municipal/streets/streets.getters.d.ts +21 -0
- package/dist/municipal/streets/streets.getters.d.ts.map +1 -0
- package/dist/municipal/streets/streets.getters.js +85 -0
- package/dist/municipal/streets/streets.getters.js.map +1 -0
- package/dist/municipal/streets/streets.types.d.ts +16 -0
- package/dist/municipal/streets/streets.types.d.ts.map +1 -0
- package/dist/municipal/streets/streets.types.js +3 -0
- package/dist/municipal/streets/streets.types.js.map +1 -0
- package/dist/municipal/tickets/index.d.ts +3 -0
- package/dist/municipal/tickets/index.d.ts.map +1 -0
- package/dist/municipal/tickets/index.js +18 -0
- package/dist/municipal/tickets/index.js.map +1 -0
- package/dist/municipal/tickets/tickets.getters.d.ts +44 -0
- package/dist/municipal/tickets/tickets.getters.d.ts.map +1 -0
- package/dist/municipal/tickets/tickets.getters.js +199 -0
- package/dist/municipal/tickets/tickets.getters.js.map +1 -0
- package/dist/municipal/tickets/tickets.types.d.ts +35 -0
- package/dist/municipal/tickets/tickets.types.d.ts.map +1 -0
- package/dist/municipal/tickets/tickets.types.js +3 -0
- package/dist/municipal/tickets/tickets.types.js.map +1 -0
- package/dist/talkpilot/agents/agents.getters.d.ts +9 -0
- package/dist/talkpilot/agents/agents.getters.d.ts.map +1 -0
- package/dist/talkpilot/agents/agents.getters.js +34 -0
- package/dist/talkpilot/agents/agents.getters.js.map +1 -0
- package/dist/talkpilot/agents/agents.types.d.ts +13 -0
- package/dist/talkpilot/agents/agents.types.d.ts.map +1 -0
- package/dist/talkpilot/agents/agents.types.js +3 -0
- package/dist/talkpilot/agents/agents.types.js.map +1 -0
- package/dist/talkpilot/agents/index.d.ts +3 -0
- package/dist/talkpilot/agents/index.d.ts.map +1 -0
- package/dist/talkpilot/agents/index.js +19 -0
- package/dist/talkpilot/agents/index.js.map +1 -0
- package/dist/talkpilot/calls/calls.getters.d.ts +24 -0
- package/dist/talkpilot/calls/calls.getters.d.ts.map +1 -0
- package/dist/talkpilot/calls/calls.getters.js +151 -0
- package/dist/talkpilot/calls/calls.getters.js.map +1 -0
- package/dist/talkpilot/calls/calls.types.d.ts +32 -0
- package/dist/talkpilot/calls/calls.types.d.ts.map +1 -0
- package/dist/talkpilot/calls/calls.types.js +3 -0
- package/dist/talkpilot/calls/calls.types.js.map +1 -0
- package/dist/talkpilot/calls/index.d.ts +3 -0
- package/dist/talkpilot/calls/index.d.ts.map +1 -0
- package/dist/talkpilot/calls/index.js +19 -0
- package/dist/talkpilot/calls/index.js.map +1 -0
- package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.d.ts +9 -0
- package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.d.ts.map +1 -0
- package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.js +76 -0
- package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.js.map +1 -0
- package/dist/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.d.ts +23 -0
- package/dist/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.d.ts.map +1 -0
- package/dist/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.js +3 -0
- package/dist/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.js.map +1 -0
- package/dist/talkpilot/clients/clients.getters.d.ts +5 -0
- package/dist/talkpilot/clients/clients.getters.d.ts.map +1 -0
- package/dist/talkpilot/clients/clients.getters.js +14 -0
- package/dist/talkpilot/clients/clients.getters.js.map +1 -0
- package/dist/talkpilot/clients/clients.types.d.ts +12 -0
- package/dist/talkpilot/clients/clients.types.d.ts.map +1 -0
- package/dist/talkpilot/clients/clients.types.js +3 -0
- package/dist/talkpilot/clients/clients.types.js.map +1 -0
- package/dist/talkpilot/clients/index.d.ts +3 -0
- package/dist/talkpilot/clients/index.d.ts.map +1 -0
- package/dist/talkpilot/clients/index.js +18 -0
- package/dist/talkpilot/clients/index.js.map +1 -0
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts +7 -0
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts.map +1 -0
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.js +21 -0
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.js.map +1 -0
- package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts +53 -0
- package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts.map +1 -0
- package/dist/talkpilot/clientsConfig/clientsConfig.types.js +3 -0
- package/dist/talkpilot/clientsConfig/clientsConfig.types.js.map +1 -0
- package/dist/talkpilot/clientsConfig/index.d.ts +3 -0
- package/dist/talkpilot/clientsConfig/index.d.ts.map +1 -0
- package/dist/talkpilot/clientsConfig/index.js +19 -0
- package/dist/talkpilot/clientsConfig/index.js.map +1 -0
- package/dist/talkpilot/flows/flows.getter.d.ts +5 -0
- package/dist/talkpilot/flows/flows.getter.d.ts.map +1 -0
- package/dist/talkpilot/flows/flows.getter.js +13 -0
- package/dist/talkpilot/flows/flows.getter.js.map +1 -0
- package/dist/talkpilot/flows/flows.schema.d.ts +154 -0
- package/dist/talkpilot/flows/flows.schema.d.ts.map +1 -0
- package/dist/talkpilot/flows/flows.schema.js +94 -0
- package/dist/talkpilot/flows/flows.schema.js.map +1 -0
- package/dist/talkpilot/flows/flows.types.d.ts +116 -0
- package/dist/talkpilot/flows/flows.types.d.ts.map +1 -0
- package/dist/talkpilot/flows/flows.types.js +3 -0
- package/dist/talkpilot/flows/flows.types.js.map +1 -0
- package/dist/talkpilot/flows/index.d.ts +3 -0
- package/dist/talkpilot/flows/index.d.ts.map +1 -0
- package/dist/talkpilot/flows/index.js +6 -0
- package/dist/talkpilot/flows/index.js.map +1 -0
- package/dist/talkpilot/groups/groups.getters.d.ts +8 -0
- package/dist/talkpilot/groups/groups.getters.d.ts.map +1 -0
- package/dist/talkpilot/groups/groups.getters.js +26 -0
- package/dist/talkpilot/groups/groups.getters.js.map +1 -0
- package/dist/talkpilot/groups/groups.types.d.ts +26 -0
- package/dist/talkpilot/groups/groups.types.d.ts.map +1 -0
- package/dist/talkpilot/groups/groups.types.js +3 -0
- package/dist/talkpilot/groups/groups.types.js.map +1 -0
- package/dist/talkpilot/groups/index.d.ts +3 -0
- package/dist/talkpilot/groups/index.d.ts.map +1 -0
- package/dist/talkpilot/groups/index.js +19 -0
- package/dist/talkpilot/groups/index.js.map +1 -0
- package/dist/talkpilot/groups/phone.utils.d.ts +4 -0
- package/dist/talkpilot/groups/phone.utils.d.ts.map +1 -0
- package/dist/talkpilot/groups/phone.utils.js +42 -0
- package/dist/talkpilot/groups/phone.utils.js.map +1 -0
- package/dist/talkpilot/index.d.ts +19 -0
- package/dist/talkpilot/index.d.ts.map +1 -0
- package/dist/talkpilot/index.js +46 -0
- package/dist/talkpilot/index.js.map +1 -0
- package/dist/talkpilot/leads/index.d.ts +3 -0
- package/dist/talkpilot/leads/index.d.ts.map +1 -0
- package/dist/talkpilot/leads/index.js +6 -0
- package/dist/talkpilot/leads/index.js.map +1 -0
- package/dist/talkpilot/leads/leads.getter.d.ts +4 -0
- package/dist/talkpilot/leads/leads.getter.d.ts.map +1 -0
- package/dist/talkpilot/leads/leads.getter.js +7 -0
- package/dist/talkpilot/leads/leads.getter.js.map +1 -0
- package/dist/talkpilot/leads/leads.schema.d.ts +50 -0
- package/dist/talkpilot/leads/leads.schema.d.ts.map +1 -0
- package/dist/talkpilot/leads/leads.schema.js +37 -0
- package/dist/talkpilot/leads/leads.schema.js.map +1 -0
- package/dist/talkpilot/leads/leads.types.d.ts +18 -0
- package/dist/talkpilot/leads/leads.types.d.ts.map +1 -0
- package/dist/talkpilot/leads/leads.types.js +3 -0
- package/dist/talkpilot/leads/leads.types.js.map +1 -0
- package/dist/talkpilot/mongodb-client.d.ts +13 -0
- package/dist/talkpilot/mongodb-client.d.ts.map +1 -0
- package/dist/talkpilot/mongodb-client.js +71 -0
- package/dist/talkpilot/mongodb-client.js.map +1 -0
- package/dist/talkpilot/phone_numbers/index.d.ts +3 -0
- package/dist/talkpilot/phone_numbers/index.d.ts.map +1 -0
- package/dist/talkpilot/phone_numbers/index.js +18 -0
- package/dist/talkpilot/phone_numbers/index.js.map +1 -0
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts +8 -0
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts.map +1 -0
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.js +44 -0
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.js.map +1 -0
- package/dist/talkpilot/phone_numbers/phone_numbers.schema.d.ts +29 -0
- package/dist/talkpilot/phone_numbers/phone_numbers.schema.d.ts.map +1 -0
- package/dist/talkpilot/phone_numbers/phone_numbers.schema.js +18 -0
- package/dist/talkpilot/phone_numbers/phone_numbers.schema.js.map +1 -0
- package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts +16 -0
- package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts.map +1 -0
- package/dist/talkpilot/phone_numbers/phone_numbers.types.js +3 -0
- package/dist/talkpilot/phone_numbers/phone_numbers.types.js.map +1 -0
- package/dist/talkpilot/plans/index.d.ts +3 -0
- package/dist/talkpilot/plans/index.d.ts.map +1 -0
- package/dist/talkpilot/plans/index.js +19 -0
- package/dist/talkpilot/plans/index.js.map +1 -0
- package/dist/talkpilot/plans/plans.getters.d.ts +10 -0
- package/dist/talkpilot/plans/plans.getters.d.ts.map +1 -0
- package/dist/talkpilot/plans/plans.getters.js +103 -0
- package/dist/talkpilot/plans/plans.getters.js.map +1 -0
- package/dist/talkpilot/plans/plans.types.d.ts +53 -0
- package/dist/talkpilot/plans/plans.types.d.ts.map +1 -0
- package/dist/talkpilot/plans/plans.types.js +29 -0
- package/dist/talkpilot/plans/plans.types.js.map +1 -0
- package/dist/talkpilot/results/index.d.ts +3 -0
- package/dist/talkpilot/results/index.d.ts.map +1 -0
- package/dist/talkpilot/results/index.js +6 -0
- package/dist/talkpilot/results/index.js.map +1 -0
- package/dist/talkpilot/results/results.getter.d.ts +7 -0
- package/dist/talkpilot/results/results.getter.d.ts.map +1 -0
- package/dist/talkpilot/results/results.getter.js +26 -0
- package/dist/talkpilot/results/results.getter.js.map +1 -0
- package/dist/talkpilot/results/results.schema.d.ts +35 -0
- package/dist/talkpilot/results/results.schema.d.ts.map +1 -0
- package/dist/talkpilot/results/results.schema.js +29 -0
- package/dist/talkpilot/results/results.schema.js.map +1 -0
- package/dist/talkpilot/results/results.types.d.ts +34 -0
- package/dist/talkpilot/results/results.types.d.ts.map +1 -0
- package/dist/talkpilot/results/results.types.js +3 -0
- package/dist/talkpilot/results/results.types.js.map +1 -0
- package/dist/talkpilot/sessions/index.d.ts +3 -0
- package/dist/talkpilot/sessions/index.d.ts.map +1 -0
- package/dist/talkpilot/sessions/index.js +6 -0
- package/dist/talkpilot/sessions/index.js.map +1 -0
- package/dist/talkpilot/sessions/sessions.getter.d.ts +7 -0
- package/dist/talkpilot/sessions/sessions.getter.d.ts.map +1 -0
- package/dist/talkpilot/sessions/sessions.getter.js +26 -0
- package/dist/talkpilot/sessions/sessions.getter.js.map +1 -0
- package/dist/talkpilot/sessions/sessions.schema.d.ts +53 -0
- package/dist/talkpilot/sessions/sessions.schema.d.ts.map +1 -0
- package/dist/talkpilot/sessions/sessions.schema.js +38 -0
- package/dist/talkpilot/sessions/sessions.schema.js.map +1 -0
- package/dist/talkpilot/sessions/sessions.types.d.ts +22 -0
- package/dist/talkpilot/sessions/sessions.types.d.ts.map +1 -0
- package/dist/talkpilot/sessions/sessions.types.js +3 -0
- package/dist/talkpilot/sessions/sessions.types.js.map +1 -0
- package/dist/talkpilot/subscriptions/index.d.ts +4 -0
- package/dist/talkpilot/subscriptions/index.d.ts.map +1 -0
- package/dist/talkpilot/subscriptions/index.js +20 -0
- package/dist/talkpilot/subscriptions/index.js.map +1 -0
- package/dist/talkpilot/subscriptions/subscriptions.getters.d.ts +13 -0
- package/dist/talkpilot/subscriptions/subscriptions.getters.d.ts.map +1 -0
- package/dist/talkpilot/subscriptions/subscriptions.getters.js +105 -0
- package/dist/talkpilot/subscriptions/subscriptions.getters.js.map +1 -0
- package/dist/talkpilot/subscriptions/subscriptions.getters.utils.d.ts +8 -0
- package/dist/talkpilot/subscriptions/subscriptions.getters.utils.d.ts.map +1 -0
- package/dist/talkpilot/subscriptions/subscriptions.getters.utils.js +27 -0
- package/dist/talkpilot/subscriptions/subscriptions.getters.utils.js.map +1 -0
- package/dist/talkpilot/subscriptions/subscriptions.types.d.ts +50 -0
- package/dist/talkpilot/subscriptions/subscriptions.types.d.ts.map +1 -0
- package/dist/talkpilot/subscriptions/subscriptions.types.js +14 -0
- package/dist/talkpilot/subscriptions/subscriptions.types.js.map +1 -0
- package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts +4 -0
- package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts.map +1 -0
- package/dist/talkpilot/subscriptions/subscriptions.utils.js +20 -0
- package/dist/talkpilot/subscriptions/subscriptions.utils.js.map +1 -0
- package/dist/test-utils/db-utils.d.ts +4 -0
- package/dist/test-utils/db-utils.d.ts.map +1 -0
- package/dist/test-utils/db-utils.js +28 -0
- package/dist/test-utils/db-utils.js.map +1 -0
- package/dist/test-utils/factories/index.d.ts +13 -0
- package/dist/test-utils/factories/index.d.ts.map +1 -0
- package/dist/test-utils/factories/index.js +29 -0
- package/dist/test-utils/factories/index.js.map +1 -0
- package/dist/test-utils/factories/municipal/cities.d.ts +5 -0
- package/dist/test-utils/factories/municipal/cities.d.ts.map +1 -0
- package/dist/test-utils/factories/municipal/cities.js +18 -0
- package/dist/test-utils/factories/municipal/cities.js.map +1 -0
- package/dist/test-utils/factories/municipal/departmentsSubjects.d.ts +5 -0
- package/dist/test-utils/factories/municipal/departmentsSubjects.d.ts.map +1 -0
- package/dist/test-utils/factories/municipal/departmentsSubjects.js +27 -0
- package/dist/test-utils/factories/municipal/departmentsSubjects.js.map +1 -0
- package/dist/test-utils/factories/municipal/streets.d.ts +5 -0
- package/dist/test-utils/factories/municipal/streets.d.ts.map +1 -0
- package/dist/test-utils/factories/municipal/streets.js +19 -0
- package/dist/test-utils/factories/municipal/streets.js.map +1 -0
- package/dist/test-utils/factories/municipal/tickets.d.ts +5 -0
- package/dist/test-utils/factories/municipal/tickets.d.ts.map +1 -0
- package/dist/test-utils/factories/municipal/tickets.js +27 -0
- package/dist/test-utils/factories/municipal/tickets.js.map +1 -0
- package/dist/test-utils/factories/talkpilot/agents.d.ts +5 -0
- package/dist/test-utils/factories/talkpilot/agents.d.ts.map +1 -0
- package/dist/test-utils/factories/talkpilot/agents.js +21 -0
- package/dist/test-utils/factories/talkpilot/agents.js.map +1 -0
- package/dist/test-utils/factories/talkpilot/calls.d.ts +6 -0
- package/dist/test-utils/factories/talkpilot/calls.d.ts.map +1 -0
- package/dist/test-utils/factories/talkpilot/calls.js +39 -0
- package/dist/test-utils/factories/talkpilot/calls.js.map +1 -0
- package/dist/test-utils/factories/talkpilot/clientAudioBuffers.d.ts +5 -0
- package/dist/test-utils/factories/talkpilot/clientAudioBuffers.d.ts.map +1 -0
- package/dist/test-utils/factories/talkpilot/clientAudioBuffers.js +18 -0
- package/dist/test-utils/factories/talkpilot/clientAudioBuffers.js.map +1 -0
- package/dist/test-utils/factories/talkpilot/clientsConfig.d.ts +5 -0
- package/dist/test-utils/factories/talkpilot/clientsConfig.d.ts.map +1 -0
- package/dist/test-utils/factories/talkpilot/clientsConfig.js +18 -0
- package/dist/test-utils/factories/talkpilot/clientsConfig.js.map +1 -0
- package/dist/test-utils/factories/talkpilot/flows.d.ts +14 -0
- package/dist/test-utils/factories/talkpilot/flows.d.ts.map +1 -0
- package/dist/test-utils/factories/talkpilot/flows.js +33 -0
- package/dist/test-utils/factories/talkpilot/flows.js.map +1 -0
- package/dist/test-utils/factories/talkpilot/groups.d.ts +6 -0
- package/dist/test-utils/factories/talkpilot/groups.d.ts.map +1 -0
- package/dist/test-utils/factories/talkpilot/groups.js +34 -0
- package/dist/test-utils/factories/talkpilot/groups.js.map +1 -0
- package/dist/test-utils/factories/talkpilot/phone_numbers.d.ts +16 -0
- package/dist/test-utils/factories/talkpilot/phone_numbers.d.ts.map +1 -0
- package/dist/test-utils/factories/talkpilot/phone_numbers.js +20 -0
- package/dist/test-utils/factories/talkpilot/phone_numbers.js.map +1 -0
- package/dist/test-utils/factories/talkpilot/sessions.d.ts +5 -0
- package/dist/test-utils/factories/talkpilot/sessions.d.ts.map +1 -0
- package/dist/test-utils/factories/talkpilot/sessions.js +37 -0
- package/dist/test-utils/factories/talkpilot/sessions.js.map +1 -0
- package/dist/utils/validation.d.ts +7 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +23 -0
- package/dist/utils/validation.js.map +1 -0
- package/jest.config.js +22 -0
- package/package.json +43 -0
- package/src/__tests__/setup.ts +20 -0
- package/src/index.ts +13 -0
- package/src/municipal/__tests__/validation.spec.ts +50 -0
- package/src/municipal/cities/cities.getters.ts +44 -0
- package/src/municipal/cities/cities.types.ts +11 -0
- package/src/municipal/cities/index.ts +2 -0
- package/src/municipal/departmentsSubjects/departmentsSubjects.getters.ts +273 -0
- package/src/municipal/departmentsSubjects/departmentsSubjects.types.ts +76 -0
- package/src/municipal/departmentsSubjects/index.ts +11 -0
- package/src/municipal/index.ts +18 -0
- package/src/municipal/mongodb-client.ts +58 -0
- package/src/municipal/streets/index.ts +2 -0
- package/src/municipal/streets/streets.getters.ts +105 -0
- package/src/municipal/streets/streets.types.ts +18 -0
- package/src/municipal/tickets/__tests__/tickets.getters.spec.ts +30 -0
- package/src/municipal/tickets/index.ts +2 -0
- package/src/municipal/tickets/tickets.getters.ts +234 -0
- package/src/municipal/tickets/tickets.types.ts +39 -0
- package/src/talkpilot/__tests__/db.spec.ts +38 -0
- package/src/talkpilot/__tests__/mongodb-client.spec.ts +19 -0
- package/src/talkpilot/__tests__/validation.spec.ts +62 -0
- package/src/talkpilot/agents/__tests__/agents.getters.spec.ts +29 -0
- package/src/talkpilot/agents/agents.getters.ts +34 -0
- package/src/talkpilot/agents/agents.types.ts +14 -0
- package/src/talkpilot/agents/index.ts +2 -0
- package/src/talkpilot/calls/__tests__/calls.spec.ts +56 -0
- package/src/talkpilot/calls/calls.getters.ts +134 -0
- package/src/talkpilot/calls/calls.types.ts +45 -0
- package/src/talkpilot/calls/index.ts +2 -0
- package/src/talkpilot/clientAudioBuffers/__tests__/clientAudioBuffer.getters.spec.ts +78 -0
- package/src/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.ts +101 -0
- package/src/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.ts +25 -0
- package/src/talkpilot/clients/clients.getters.ts +11 -0
- package/src/talkpilot/clients/clients.types.ts +12 -0
- package/src/talkpilot/clients/index.ts +2 -0
- package/src/talkpilot/clientsConfig/__tests__/clientsConfig.spec.ts +28 -0
- package/src/talkpilot/clientsConfig/clientsConfig.getters.ts +20 -0
- package/src/talkpilot/clientsConfig/clientsConfig.types.ts +55 -0
- package/src/talkpilot/clientsConfig/index.ts +2 -0
- package/src/talkpilot/flows/flows.getter.ts +11 -0
- package/src/talkpilot/flows/flows.schema.ts +90 -0
- package/src/talkpilot/flows/flows.types.ts +151 -0
- package/src/talkpilot/flows/index.ts +2 -0
- package/src/talkpilot/groups/__tests__/groups.spec.ts +83 -0
- package/src/talkpilot/groups/__tests__/phone.utils.spec.ts +32 -0
- package/src/talkpilot/groups/groups.getters.ts +27 -0
- package/src/talkpilot/groups/groups.types.ts +29 -0
- package/src/talkpilot/groups/index.ts +2 -0
- package/src/talkpilot/groups/phone.utils.ts +40 -0
- package/src/talkpilot/index.ts +27 -0
- package/src/talkpilot/leads/index.ts +2 -0
- package/src/talkpilot/leads/leads.getter.ts +5 -0
- package/src/talkpilot/leads/leads.schema.ts +33 -0
- package/src/talkpilot/leads/leads.types.ts +20 -0
- package/src/talkpilot/mongodb-client.ts +78 -0
- package/src/talkpilot/phone_numbers/__tests__/phone_numbers.spec.ts +43 -0
- package/src/talkpilot/phone_numbers/index.ts +2 -0
- package/src/talkpilot/phone_numbers/phone_numbers.getter.ts +47 -0
- package/src/talkpilot/phone_numbers/phone_numbers.schema.ts +14 -0
- package/src/talkpilot/phone_numbers/phone_numbers.types.ts +15 -0
- package/src/talkpilot/plans/index.ts +2 -0
- package/src/talkpilot/plans/plans.getters.ts +121 -0
- package/src/talkpilot/plans/plans.types.ts +84 -0
- package/src/talkpilot/results/index.ts +2 -0
- package/src/talkpilot/results/results.getter.ts +26 -0
- package/src/talkpilot/results/results.schema.ts +25 -0
- package/src/talkpilot/results/results.types.ts +32 -0
- package/src/talkpilot/sessions/__tests__/sessions.spec.ts +43 -0
- package/src/talkpilot/sessions/index.ts +2 -0
- package/src/talkpilot/sessions/sessions.getter.ts +28 -0
- package/src/talkpilot/sessions/sessions.schema.ts +34 -0
- package/src/talkpilot/sessions/sessions.types.ts +28 -0
- package/src/talkpilot/subscriptions/__tests__/subscriptions.getters.utils.spec.ts +42 -0
- package/src/talkpilot/subscriptions/index.ts +3 -0
- package/src/talkpilot/subscriptions/subscriptions.getters.ts +147 -0
- package/src/talkpilot/subscriptions/subscriptions.getters.utils.ts +26 -0
- package/src/talkpilot/subscriptions/subscriptions.types.ts +65 -0
- package/src/test-utils/db-utils.ts +24 -0
- package/src/test-utils/factories/index.ts +12 -0
- package/src/test-utils/factories/municipal/cities.ts +16 -0
- package/src/test-utils/factories/municipal/departmentsSubjects.ts +29 -0
- package/src/test-utils/factories/municipal/streets.ts +17 -0
- package/src/test-utils/factories/municipal/tickets.ts +27 -0
- package/src/test-utils/factories/talkpilot/agents.ts +19 -0
- package/src/test-utils/factories/talkpilot/calls.ts +37 -0
- package/src/test-utils/factories/talkpilot/clientAudioBuffers.ts +18 -0
- package/src/test-utils/factories/talkpilot/clientsConfig.ts +19 -0
- package/src/test-utils/factories/talkpilot/flows.ts +31 -0
- package/src/test-utils/factories/talkpilot/groups.ts +33 -0
- package/src/test-utils/factories/talkpilot/phone_numbers.ts +20 -0
- package/src/test-utils/factories/talkpilot/sessions.ts +35 -0
- package/src/utils/validation.ts +23 -0
- package/tsconfig.json +27 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Development standards and conventions for the core-db package
|
|
3
|
+
globs: src/**/*.ts
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Development Standards
|
|
8
|
+
|
|
9
|
+
This package provides a centralized database layer for multiple domains (TalkPilot and Municipal). Follow these rules to maintain consistency and reliability.
|
|
10
|
+
|
|
11
|
+
## Project Structure
|
|
12
|
+
|
|
13
|
+
- **`src/talkpilot/`**: All database logic, types, and getters related to the TalkPilot domain.
|
|
14
|
+
- **`src/municipal/`**: All database logic, types, and getters related to the Municipal Data domain.
|
|
15
|
+
- **`src/test-utils/`**: Shared testing infrastructure, including factories and database utilities.
|
|
16
|
+
|
|
17
|
+
## Database Connection Pattern
|
|
18
|
+
|
|
19
|
+
Each domain is isolated. They have their own `db` instance and must be connected independently.
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { mongodbClient, municipalDataMongodbClient } from '@talk-pilot/core-db';
|
|
23
|
+
|
|
24
|
+
// TalkPilot
|
|
25
|
+
await mongodbClient.connect(uri);
|
|
26
|
+
|
|
27
|
+
// Municipal
|
|
28
|
+
await municipalDataMongodbClient.connect(uri);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Creating New Getters
|
|
32
|
+
|
|
33
|
+
1. **Location**: Place getters in the relevant domain folder (e.g., `src/talkpilot/agents/agents.getters.ts`).
|
|
34
|
+
2. **Naming**: Use `find...` for multiple results and `get...ById` for single results.
|
|
35
|
+
3. **Domain isolation**: Always use the `getDb()` function from the current domain's `index.ts`.
|
|
36
|
+
|
|
37
|
+
## Environment Validation
|
|
38
|
+
|
|
39
|
+
Always validate configuration "on-demand" within the `connect` methods using the validation utilities.
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { validateConfig, validateMongoUri } from '../utils/validation';
|
|
43
|
+
|
|
44
|
+
async connect(uri?: string) {
|
|
45
|
+
const mongodbUri = uri || process.env.MONGO_URI;
|
|
46
|
+
validateConfig('MONGO_URI', mongodbUri);
|
|
47
|
+
validateMongoUri(mongodbUri!);
|
|
48
|
+
// ... connection logic
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Testing Standards
|
|
53
|
+
|
|
54
|
+
1. **In-Memory DB**: Use `mongodb-memory-server` for all tests. It is automatically initialized in `src/__tests__/setup.ts`.
|
|
55
|
+
2. **Factories**: Use the Fishery factories in `src/test-utils/factories/` to generate test data.
|
|
56
|
+
3. **Organization**: Place tests in a `__tests__` folder within the relevant domain.
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { createAgent } from '../../../test-utils/factories';
|
|
60
|
+
|
|
61
|
+
it('should find agents', async () => {
|
|
62
|
+
const agent = createAgent({ name: 'Test' });
|
|
63
|
+
// ... test logic
|
|
64
|
+
});
|
|
65
|
+
```
|
package/DEVELOPMENT.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Development Guide
|
|
2
|
+
|
|
3
|
+
Welcome to the `core-db` development guide. This document explains how to set up, develop, and test this package.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- Node.js (v18 or later)
|
|
10
|
+
- TypeScript
|
|
11
|
+
|
|
12
|
+
### Setup
|
|
13
|
+
|
|
14
|
+
1. Install dependencies:
|
|
15
|
+
```bash
|
|
16
|
+
npm install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
2. Build the project:
|
|
20
|
+
```bash
|
|
21
|
+
npm run build
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Local Development
|
|
25
|
+
|
|
26
|
+
If you want to use this package in another project locally without publishing it:
|
|
27
|
+
|
|
28
|
+
1. In the `core-db` folder:
|
|
29
|
+
```bash
|
|
30
|
+
npm link
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
2. In your PROJECT folder:
|
|
34
|
+
```bash
|
|
35
|
+
npm link @talk-pilot/core-db
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Adding a New Getter
|
|
39
|
+
|
|
40
|
+
1. **Define Types**: Add your data types in the relevant domain's `types.ts` file.
|
|
41
|
+
2. **Implement Getter**: Add the function in the `getters.ts` file.
|
|
42
|
+
3. **Export**: Ensure the getter is exported from the domain's `index.ts` and finally from the main `src/index.ts`.
|
|
43
|
+
4. **Test**: Create a test in the domain's `__tests__` folder.
|
|
44
|
+
|
|
45
|
+
## Testing
|
|
46
|
+
|
|
47
|
+
We use Jest with `mongodb-memory-server` for fast, isolated database tests.
|
|
48
|
+
|
|
49
|
+
### Running Tests
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm test
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Using Factories
|
|
56
|
+
|
|
57
|
+
Always use factories to generate test data to keep tests clean and maintainable.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { createCallDoc } from '../calls.getters';
|
|
61
|
+
import { createOutGoingCallDoc } from '../../../test-utils/factories';
|
|
62
|
+
|
|
63
|
+
it('should save a call', async () => {
|
|
64
|
+
const call = createOutGoingCallDoc({ callSid: 'CA123' });
|
|
65
|
+
await createCallDoc(call);
|
|
66
|
+
// ... assertions
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Build Process
|
|
71
|
+
|
|
72
|
+
The project is built using TypeScript (`tsc`). The output is generated in the `dist/` directory.
|
|
73
|
+
|
|
74
|
+
- `main`: `dist/index.js`
|
|
75
|
+
- `types`: `dist/index.d.ts`
|
|
76
|
+
|
|
77
|
+
The `prepare` script in `package.json` ensures that the project is built automatically when installed via a Git URL.
|
|
78
|
+
|
|
79
|
+
## Team Access & Authentication
|
|
80
|
+
|
|
81
|
+
To allow the whole team to publish and install without adding individual npm accounts, we use a shared **npm Granular Access Token**.
|
|
82
|
+
|
|
83
|
+
### One-time Local Setup
|
|
84
|
+
|
|
85
|
+
Each developer needs to add the shared token to their local npm configuration. Do **NOT** add this to the project's `.npmrc` file, as it will be committed to Git.
|
|
86
|
+
|
|
87
|
+
1. Get the shared **npm Automation Token**.
|
|
88
|
+
2. Open (or create) your global npm configuration file:
|
|
89
|
+
```bash
|
|
90
|
+
nano ~/.npmrc
|
|
91
|
+
```
|
|
92
|
+
3. Add the following line (replace `[TOKEN]` with the actual token):
|
|
93
|
+
```text
|
|
94
|
+
//registry.npmjs.org/:_authToken=[TOKEN]
|
|
95
|
+
```
|
|
96
|
+
4. Save and exit.
|
|
97
|
+
|
|
98
|
+
Now you can run `npm publish` and `npm install` for scoped `@talk-pilot` packages without being prompted for credentials.
|
package/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# @talk-pilot/core-db
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@talk-pilot/core-db)
|
|
4
|
+
|
|
5
|
+
A TypeScript-based core database management package designed to provide centralized database connections, ORM integrations, and client utilities for other projects. This package manages connections to both **TalkPilot** and **Municipal** MongoDB databases.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 🚀 **Multi-Domain Database Management**: Centralized handlers for both TalkPilot and Municipal Data domains.
|
|
10
|
+
- 📦 **Reusable Getters**: Standardized functions for fetching data from various collections (calls, agents, leads, cities, etc.).
|
|
11
|
+
- 🏗️ **Type-safe**: Built with TypeScript for full type safety across all your database interactions.
|
|
12
|
+
- 🛠️ **Environment Aware**: Configurable via environment variables or explicit parameters.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
This package is intended to be used as a dependency in other projects. If you're working locally, you can install it using a file path:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# In your other project:
|
|
20
|
+
npm install /path/to/core-db
|
|
21
|
+
# or if published to a registry:
|
|
22
|
+
npm install @talk-pilot/core-db
|
|
23
|
+
# or via GitHub (ensure you have built or have a prepare script)
|
|
24
|
+
npm install github:Talk-Pilot/core-db
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
### 1. Initialize Database Connections
|
|
30
|
+
|
|
31
|
+
You must initialize the database clients before using any of the getters.
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { mongodbClient, municipalDataMongodbClient } from '@talk-pilot/core-db';
|
|
35
|
+
|
|
36
|
+
async function bootstrap() {
|
|
37
|
+
// Initialize TalkPilot DB
|
|
38
|
+
await mongodbClient.connect(process.env.TALKPILOT_MONGO_URI);
|
|
39
|
+
|
|
40
|
+
// Initialize Municipal Data DB (optional)
|
|
41
|
+
await municipalDataMongodbClient.connect(process.env.MUNICIPAL_MONGO_URI);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
bootstrap().catch(console.error);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Using Getters
|
|
48
|
+
|
|
49
|
+
Once initialized, you can import and use any of the exported database getters.
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { findAgents, findCities } from '@talk-pilot/core-db';
|
|
53
|
+
|
|
54
|
+
async function getSummary() {
|
|
55
|
+
// Get all agents from TalkPilot DB
|
|
56
|
+
const agents = await findAgents();
|
|
57
|
+
console.log('Total Agents:', agents.length);
|
|
58
|
+
|
|
59
|
+
// Get all cities from Municipal Data DB
|
|
60
|
+
const cities = await findCities();
|
|
61
|
+
console.log('Total Cities:', cities.length);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Available Domains
|
|
66
|
+
|
|
67
|
+
The package exports two main sets of tools:
|
|
68
|
+
|
|
69
|
+
### TalkPilot Domain
|
|
70
|
+
Includes access to:
|
|
71
|
+
- `agents`, `calls`, `clients`, `flows`, `leads`, `phone_numbers`, `plans`, `results`, `sessions`, `subscriptions`, etc.
|
|
72
|
+
- Exported as root level functions or via `mongodbClient`.
|
|
73
|
+
|
|
74
|
+
### Municipal Domain
|
|
75
|
+
Includes access to:
|
|
76
|
+
- `cities`, `streets`, `departmentsSubjects`, `tickets`.
|
|
77
|
+
- Functions are prefixed where necessary or accessible via `getMunicipalDataDb`.
|
|
78
|
+
|
|
79
|
+
## Environment Variables
|
|
80
|
+
|
|
81
|
+
The clients will automatically attempt to use the following environment variables if no URI is provided to the `connect()` method:
|
|
82
|
+
|
|
83
|
+
- `MONGO_URI` or `MONGODB_URI`: Primary MongoDB connection string.
|
|
84
|
+
- `MONGODB_DB_NAME`: Database name (defaults to 'municipal-data' for the municipal client if not specified).
|
|
85
|
+
|
|
86
|
+
## Development
|
|
87
|
+
|
|
88
|
+
### Setup
|
|
89
|
+
|
|
90
|
+
1. Clone the repository and install dependencies:
|
|
91
|
+
```bash
|
|
92
|
+
git clone https://github.com/Talk-Pilot/core-db.git
|
|
93
|
+
cd core-db
|
|
94
|
+
npm install
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
2. Build the project:
|
|
98
|
+
```bash
|
|
99
|
+
npm run build
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
This will generate the `dist/` directory with the compiled JavaScript and type definitions.
|
|
103
|
+
|
|
104
|
+
### Publishing New Versions
|
|
105
|
+
|
|
106
|
+
To publish a new version of the package:
|
|
107
|
+
|
|
108
|
+
1. **Test your changes**:
|
|
109
|
+
```bash
|
|
110
|
+
npm test
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
2. **Update the version**:
|
|
114
|
+
```bash
|
|
115
|
+
# Bumps patch version (0.1.0 -> 0.1.1)
|
|
116
|
+
npm version patch
|
|
117
|
+
# Or for minor changes (0.1.0 -> 0.2.0)
|
|
118
|
+
# npm version minor
|
|
119
|
+
# Or for major changes (0.1.0 -> 1.0.0)
|
|
120
|
+
# npm version major
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
3. **Publish to npm**:
|
|
124
|
+
Ensure you have the shared team token in your `~/.npmrc` (see [Development Guide](./DEVELOPMENT.md#team-access--authentication)).
|
|
125
|
+
```bash
|
|
126
|
+
npm publish
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
4. **Update in other repos**:
|
|
130
|
+
```bash
|
|
131
|
+
npm update @talk-pilot/core-db
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
**Interested in contributing?** Check out our [Development Guide](./DEVELOPMENT.md) for standards and setup instructions.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './talkpilot';
|
|
2
|
+
export { municipalDataMongodbClient, getDb as getMunicipalDataDb, setDb as setMunicipalDataDb, ObjectId as MunicipalDataObjectId, } from './municipal';
|
|
3
|
+
export * from './municipal/cities';
|
|
4
|
+
export * from './municipal/streets';
|
|
5
|
+
export * from './municipal/departmentsSubjects';
|
|
6
|
+
export * from './municipal/tickets';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAE5B,OAAO,EACL,0BAA0B,EAC1B,KAAK,IAAI,kBAAkB,EAC3B,KAAK,IAAI,kBAAkB,EAC3B,QAAQ,IAAI,qBAAqB,GAClC,MAAM,aAAa,CAAC;AACrB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.MunicipalDataObjectId = exports.setMunicipalDataDb = exports.getMunicipalDataDb = exports.municipalDataMongodbClient = void 0;
|
|
18
|
+
// TalkPilot DB exports
|
|
19
|
+
__exportStar(require("./talkpilot"), exports);
|
|
20
|
+
var municipal_1 = require("./municipal");
|
|
21
|
+
Object.defineProperty(exports, "municipalDataMongodbClient", { enumerable: true, get: function () { return municipal_1.municipalDataMongodbClient; } });
|
|
22
|
+
Object.defineProperty(exports, "getMunicipalDataDb", { enumerable: true, get: function () { return municipal_1.getDb; } });
|
|
23
|
+
Object.defineProperty(exports, "setMunicipalDataDb", { enumerable: true, get: function () { return municipal_1.setDb; } });
|
|
24
|
+
Object.defineProperty(exports, "MunicipalDataObjectId", { enumerable: true, get: function () { return municipal_1.ObjectId; } });
|
|
25
|
+
__exportStar(require("./municipal/cities"), exports);
|
|
26
|
+
__exportStar(require("./municipal/streets"), exports);
|
|
27
|
+
__exportStar(require("./municipal/departmentsSubjects"), exports);
|
|
28
|
+
__exportStar(require("./municipal/tickets"), exports);
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uBAAuB;AACvB,8CAA4B;AAE5B,yCAKqB;AAJnB,uHAAA,0BAA0B,OAAA;AAC1B,+GAAA,KAAK,OAAsB;AAC3B,+GAAA,KAAK,OAAsB;AAC3B,kHAAA,QAAQ,OAAyB;AAEnC,qDAAmC;AACnC,sDAAoC;AACpC,kEAAgD;AAChD,sDAAoC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { City } from '../index';
|
|
2
|
+
import { Collection, Filter, ObjectId as MongoObjectId } from 'mongodb';
|
|
3
|
+
export declare const getCitiesCollection: () => Collection<City>;
|
|
4
|
+
export declare const findCities: (filter?: Filter<City>) => Promise<City[]>;
|
|
5
|
+
export declare const getCityById: (cityId: string) => Promise<City | null>;
|
|
6
|
+
export declare const createCity: (cityData: Omit<City, "_id" | "createdAt" | "updatedAt">) => Promise<MongoObjectId>;
|
|
7
|
+
export declare const updateCity: (cityId: string, data: Partial<Omit<City, "_id" | "createdAt" | "updatedAt">>) => Promise<City | null>;
|
|
8
|
+
export declare const deleteCity: (cityId: string) => Promise<boolean>;
|
|
9
|
+
//# sourceMappingURL=cities.getters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cities.getters.d.ts","sourceRoot":"","sources":["../../../src/municipal/cities/cities.getters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAExE,eAAO,MAAM,mBAAmB,QAAO,UAAU,CAAC,IAAI,CAErD,CAAC;AAEF,eAAO,MAAM,UAAU,GAAU,SAAQ,MAAM,CAAC,IAAI,CAAM,KAAG,OAAO,CAAC,IAAI,EAAE,CAE1E,CAAC;AAEF,eAAO,MAAM,WAAW,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAGrE,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,UAAU,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,WAAW,GAAG,WAAW,CAAC,KACtD,OAAO,CAAC,aAAa,CAQvB,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,QAAQ,MAAM,EACd,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,WAAW,GAAG,WAAW,CAAC,CAAC,KAC3D,OAAO,CAAC,IAAI,GAAG,IAAI,CAOrB,CAAC;AAEF,eAAO,MAAM,UAAU,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,OAAO,CAGhE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteCity = exports.updateCity = exports.createCity = exports.getCityById = exports.findCities = exports.getCitiesCollection = void 0;
|
|
4
|
+
const index_1 = require("../index");
|
|
5
|
+
const getCitiesCollection = () => {
|
|
6
|
+
return (0, index_1.getDb)().collection('cities');
|
|
7
|
+
};
|
|
8
|
+
exports.getCitiesCollection = getCitiesCollection;
|
|
9
|
+
const findCities = async (filter = {}) => {
|
|
10
|
+
return await (0, exports.getCitiesCollection)().find(filter).toArray();
|
|
11
|
+
};
|
|
12
|
+
exports.findCities = findCities;
|
|
13
|
+
const getCityById = async (cityId) => {
|
|
14
|
+
const city = await (0, exports.getCitiesCollection)().findOne({ _id: new index_1.ObjectId(cityId) });
|
|
15
|
+
return city ? city : null;
|
|
16
|
+
};
|
|
17
|
+
exports.getCityById = getCityById;
|
|
18
|
+
const createCity = async (cityData) => {
|
|
19
|
+
const city = {
|
|
20
|
+
...cityData,
|
|
21
|
+
createdAt: new Date(),
|
|
22
|
+
updatedAt: new Date(),
|
|
23
|
+
};
|
|
24
|
+
const { insertedId } = await (0, exports.getCitiesCollection)().insertOne(city);
|
|
25
|
+
return insertedId;
|
|
26
|
+
};
|
|
27
|
+
exports.createCity = createCity;
|
|
28
|
+
const updateCity = async (cityId, data) => {
|
|
29
|
+
const result = await (0, exports.getCitiesCollection)().findOneAndUpdate({ _id: new index_1.ObjectId(cityId) }, { $set: { ...data, updatedAt: new Date() } }, { returnDocument: 'after' });
|
|
30
|
+
return result || null;
|
|
31
|
+
};
|
|
32
|
+
exports.updateCity = updateCity;
|
|
33
|
+
const deleteCity = async (cityId) => {
|
|
34
|
+
const result = await (0, exports.getCitiesCollection)().deleteOne({ _id: new index_1.ObjectId(cityId) });
|
|
35
|
+
return result.deletedCount > 0;
|
|
36
|
+
};
|
|
37
|
+
exports.deleteCity = deleteCity;
|
|
38
|
+
//# sourceMappingURL=cities.getters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cities.getters.js","sourceRoot":"","sources":["../../../src/municipal/cities/cities.getters.ts"],"names":[],"mappings":";;;AAAA,oCAAiD;AAG1C,MAAM,mBAAmB,GAAG,GAAqB,EAAE;IACxD,OAAO,IAAA,aAAK,GAAE,CAAC,UAAU,CAAO,QAAQ,CAAC,CAAC;AAC5C,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEK,MAAM,UAAU,GAAG,KAAK,EAAE,SAAuB,EAAE,EAAmB,EAAE;IAC7E,OAAO,MAAM,IAAA,2BAAmB,GAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;AAC5D,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEK,MAAM,WAAW,GAAG,KAAK,EAAE,MAAc,EAAwB,EAAE;IACxE,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAmB,GAAE,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,gBAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAChF,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5B,CAAC,CAAC;AAHW,QAAA,WAAW,eAGtB;AAEK,MAAM,UAAU,GAAG,KAAK,EAC7B,QAAuD,EAC/B,EAAE;IAC1B,MAAM,IAAI,GAAsB;QAC9B,GAAG,QAAQ;QACX,SAAS,EAAE,IAAI,IAAI,EAAE;QACrB,SAAS,EAAE,IAAI,IAAI,EAAE;KACtB,CAAC;IACF,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,2BAAmB,GAAE,CAAC,SAAS,CAAC,IAAY,CAAC,CAAC;IAC3E,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAVW,QAAA,UAAU,cAUrB;AAEK,MAAM,UAAU,GAAG,KAAK,EAC7B,MAAc,EACd,IAA4D,EACtC,EAAE;IACxB,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAmB,GAAE,CAAC,gBAAgB,CACzD,EAAE,GAAG,EAAE,IAAI,gBAAQ,CAAC,MAAM,CAAC,EAAE,EAC7B,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,EAAE,EAC5C,EAAE,cAAc,EAAE,OAAO,EAAE,CAC5B,CAAC;IACF,OAAO,MAAM,IAAI,IAAI,CAAC;AACxB,CAAC,CAAC;AAVW,QAAA,UAAU,cAUrB;AAEK,MAAM,UAAU,GAAG,KAAK,EAAE,MAAc,EAAoB,EAAE;IACnE,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAmB,GAAE,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,IAAI,gBAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACpF,OAAO,MAAM,CAAC,YAAY,GAAG,CAAC,CAAC;AACjC,CAAC,CAAC;AAHW,QAAA,UAAU,cAGrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cities.types.d.ts","sourceRoot":"","sources":["../../../src/municipal/cities/cities.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,MAAM,IAAI,GAAG;IACjB,GAAG,EAAE,QAAQ,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cities.types.js","sourceRoot":"","sources":["../../../src/municipal/cities/cities.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/municipal/cities/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./cities.getters"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/municipal/cities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { DepartmentSubject } from '../index';
|
|
2
|
+
import { Collection, Filter } from 'mongodb';
|
|
3
|
+
import { CityName, VectorSearchResult } from './departmentsSubjects.types';
|
|
4
|
+
export declare const getDepartmentsSubjectsCollection: () => Collection<DepartmentSubject>;
|
|
5
|
+
/**
|
|
6
|
+
* Get all departments subjects for a given city.
|
|
7
|
+
* No DB sort; tree build does not depend on order. Callers that need alphabetical order
|
|
8
|
+
* sort in memory (e.g. sortTreeAlphabetically in full-tree-subjects.service).
|
|
9
|
+
* @param cityName - City name to filter subjects
|
|
10
|
+
* @param withEmbeddings - Whether to include embedding and embedding_model fields (default: false)
|
|
11
|
+
* @returns Array of all department subjects for the city
|
|
12
|
+
*/
|
|
13
|
+
export declare const getAllDepartmentsSubjectsByCity: (cityName: CityName, withEmbeddings?: boolean) => Promise<DepartmentSubject[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Perform vector search on departmentsSubjects collection
|
|
16
|
+
* @param queryVector - The embedding vector to search with
|
|
17
|
+
* @param cityName - City name to filter results
|
|
18
|
+
* @param limit - Maximum number of results (default: 5)
|
|
19
|
+
* @param numCandidates - Number of candidates to consider (default: 800)
|
|
20
|
+
* @returns Array of vector search results
|
|
21
|
+
*/
|
|
22
|
+
export declare const vectorSearchDepartmentsSubjects: (queryVector: number[], cityName: CityName, limit?: number, numCandidates?: number) => Promise<VectorSearchResult[]>;
|
|
23
|
+
export declare const addDepartmentSubjectInstruction: (filter: Filter<DepartmentSubject>, instructionText: string) => Promise<DepartmentSubject | null>;
|
|
24
|
+
export declare const updateDepartmentSubjectInstruction: (filter: Filter<DepartmentSubject>, instructionId: number, newInstructionText: string) => Promise<DepartmentSubject | null>;
|
|
25
|
+
export declare const removeDepartmentSubjectInstruction: (filter: Filter<DepartmentSubject>, instructionId: number) => Promise<DepartmentSubject | null>;
|
|
26
|
+
export declare const addDepartmentSubjectCommunication: (filter: Filter<DepartmentSubject>, communication: {
|
|
27
|
+
type: "free_text_sms" | "upload_url_sms";
|
|
28
|
+
message_text?: string;
|
|
29
|
+
template_id?: string;
|
|
30
|
+
to?: string;
|
|
31
|
+
}) => Promise<DepartmentSubject | null>;
|
|
32
|
+
export declare const updateDepartmentSubjectCommunication: (filter: Filter<DepartmentSubject>, communicationId: number, updates: {
|
|
33
|
+
type?: "free_text_sms" | "upload_url_sms";
|
|
34
|
+
message_text?: string | null;
|
|
35
|
+
template_id?: string | null;
|
|
36
|
+
to?: string | null;
|
|
37
|
+
is_deleted?: boolean | null;
|
|
38
|
+
}) => Promise<DepartmentSubject | null>;
|
|
39
|
+
export declare const removeDepartmentSubjectCommunication: (filter: Filter<DepartmentSubject>, communicationId: number) => Promise<DepartmentSubject | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Get department subject by subject_id, sub_subject_id, and cityName
|
|
42
|
+
* @param subjectId - Subject ID (from event_subject_id)
|
|
43
|
+
* @param subSubjectId - Sub-subject ID (from event_sub_subject_id, optional)
|
|
44
|
+
* @param cityName - City name to filter results
|
|
45
|
+
* @returns DepartmentSubject document or null if not found
|
|
46
|
+
*/
|
|
47
|
+
export declare const getDepartmentSubjectBySubjectIds: (subjectId: string, subSubjectId: string, cityName: CityName) => Promise<DepartmentSubject | null>;
|
|
48
|
+
/**
|
|
49
|
+
* Update or create guidelines field for a department subject
|
|
50
|
+
* @param filter - MongoDB filter to find the document
|
|
51
|
+
* @param guidelines - Guidelines text to set
|
|
52
|
+
* @returns Updated DepartmentSubject document or null if not found
|
|
53
|
+
*/
|
|
54
|
+
export declare const updateDepartmentSubjectGuidelines: (filter: Filter<DepartmentSubject>, guidelines: string) => Promise<DepartmentSubject | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Clear guidelines field from a department subject document (sets it to null)
|
|
57
|
+
* @param filter - MongoDB filter to find the document
|
|
58
|
+
* @returns Updated DepartmentSubject document or null if not found
|
|
59
|
+
*/
|
|
60
|
+
export declare const deleteDepartmentSubjectGuidelines: (filter: Filter<DepartmentSubject>) => Promise<DepartmentSubject | null>;
|
|
61
|
+
export declare const findSubjectByQuery: (query: Partial<DepartmentSubject>) => Promise<import("mongodb").WithId<DepartmentSubject> | null>;
|
|
62
|
+
//# sourceMappingURL=departmentsSubjects.getters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"departmentsSubjects.getters.d.ts","sourceRoot":"","sources":["../../../src/municipal/departmentsSubjects/departmentsSubjects.getters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,eAAO,MAAM,gCAAgC,QAAO,UAAU,CAAC,iBAAiB,CAE/E,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,GAC1C,UAAU,QAAQ,EAClB,iBAAgB,OAAe,KAC9B,OAAO,CAAC,iBAAiB,EAAE,CAW7B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,GAC1C,aAAa,MAAM,EAAE,EACrB,UAAU,QAAQ,EAClB,QAAO,MAAU,EACjB,gBAAe,MAAY,KAC1B,OAAO,CAAC,kBAAkB,EAAE,CAgC9B,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAC1C,QAAQ,MAAM,CAAC,iBAAiB,CAAC,EACjC,iBAAiB,MAAM,KACtB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAgBlC,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAC7C,QAAQ,MAAM,CAAC,iBAAiB,CAAC,EACjC,eAAe,MAAM,EACrB,oBAAoB,MAAM,KACzB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAQlC,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAC7C,QAAQ,MAAM,CAAC,iBAAiB,CAAC,EACjC,eAAe,MAAM,KACpB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAWlC,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAC5C,QAAQ,MAAM,CAAC,iBAAiB,CAAC,EACjC,eAAe;IACb,IAAI,EAAE,eAAe,GAAG,gBAAgB,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,KACA,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAoBlC,CAAC;AAEF,eAAO,MAAM,oCAAoC,GAC/C,QAAQ,MAAM,CAAC,iBAAiB,CAAC,EACjC,iBAAiB,MAAM,EACvB,SAAS;IACP,IAAI,CAAC,EAAE,eAAe,GAAG,gBAAgB,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7B,KACA,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAkBlC,CAAC;AAEF,eAAO,MAAM,oCAAoC,GAC/C,QAAQ,MAAM,CAAC,iBAAiB,CAAC,EACjC,iBAAiB,MAAM,KACtB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAWlC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,GAC3C,WAAW,MAAM,EACjB,cAAc,MAAM,EACpB,UAAU,QAAQ,KACjB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAelC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,GAC5C,QAAQ,MAAM,CAAC,iBAAiB,CAAC,EACjC,YAAY,MAAM,KACjB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAQlC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,GAC5C,QAAQ,MAAM,CAAC,iBAAiB,CAAC,KAChC,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAQlC,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAU,OAAO,OAAO,CAAC,iBAAiB,CAAC,gEAEzE,CAAC"}
|