@talkpilot/core-db 1.3.6 → 1.3.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.
Files changed (79) hide show
  1. package/.cursor/rules/development.mdc +65 -65
  2. package/DEVELOPMENT.md +141 -141
  3. package/README.md +243 -190
  4. package/README_OLD.md +160 -160
  5. package/dist/municipal/tickets/tickets.statistics.getters.d.ts +4 -0
  6. package/dist/municipal/tickets/tickets.statistics.getters.d.ts.map +1 -1
  7. package/dist/municipal/tickets/tickets.statistics.getters.js +30 -3
  8. package/dist/municipal/tickets/tickets.statistics.getters.js.map +1 -1
  9. package/dist/talkpilot/calls/calls.dashboard.d.ts +3 -0
  10. package/dist/talkpilot/calls/calls.dashboard.d.ts.map +1 -0
  11. package/dist/talkpilot/calls/calls.dashboard.js +191 -0
  12. package/dist/talkpilot/calls/calls.dashboard.js.map +1 -0
  13. package/dist/talkpilot/calls/calls.statistics.getters.js +12 -15
  14. package/dist/talkpilot/calls/calls.statistics.getters.js.map +1 -1
  15. package/dist/talkpilot/calls/calls.statistics.types.d.ts +4 -1
  16. package/dist/talkpilot/calls/calls.statistics.types.d.ts.map +1 -1
  17. package/dist/talkpilot/flows/flows.schema.d.ts +3 -0
  18. package/dist/talkpilot/flows/flows.schema.d.ts.map +1 -1
  19. package/dist/talkpilot/flows/flows.schema.js +1 -0
  20. package/dist/talkpilot/flows/flows.schema.js.map +1 -1
  21. package/dist/talkpilot/flows/flows.types.d.ts +1 -0
  22. package/dist/talkpilot/flows/flows.types.d.ts.map +1 -1
  23. package/jest.config.js +20 -20
  24. package/package.json +46 -46
  25. package/src/connection.ts +54 -54
  26. package/src/index.ts +26 -26
  27. package/src/municipal/index.ts +22 -22
  28. package/src/municipal/muniIssues/__tests__/muniIssues.setters.spec.ts +92 -92
  29. package/src/municipal/muniIssues/__tests__/muniIssues.setup.spec.ts +92 -92
  30. package/src/municipal/muniIssues/index.ts +17 -17
  31. package/src/municipal/muniIssues/muniIssues.constants.ts +18 -18
  32. package/src/municipal/muniIssues/muniIssues.getters.ts +24 -24
  33. package/src/municipal/muniIssues/muniIssues.schema.ts +66 -66
  34. package/src/municipal/muniIssues/muniIssues.setters.ts +24 -24
  35. package/src/municipal/muniIssues/muniIssues.setup.ts +65 -65
  36. package/src/municipal/muniIssues/muniIssues.types.ts +37 -37
  37. package/src/municipal/tickets/__tests__/tickets.getters.spec.ts +30 -30
  38. package/src/municipal/tickets/__tests__/tickets.statistics.spec.ts +68 -51
  39. package/src/municipal/tickets/index.ts +3 -3
  40. package/src/municipal/tickets/tickets.constants.ts +8 -8
  41. package/src/municipal/tickets/tickets.getters.ts +121 -121
  42. package/src/municipal/tickets/tickets.statistics.aggregation.ts +96 -96
  43. package/src/municipal/tickets/tickets.statistics.getters.ts +109 -71
  44. package/src/municipal/tickets/tickets.types.ts +53 -53
  45. package/src/talkpilot/calls/__tests__/calls.dashboard.spec.ts +149 -149
  46. package/src/talkpilot/calls/__tests__/calls.statistics.spec.ts +351 -344
  47. package/src/talkpilot/calls/calls.constants.ts +20 -20
  48. package/src/talkpilot/calls/calls.statistics.getters.ts +587 -587
  49. package/src/talkpilot/calls/calls.statistics.types.ts +47 -44
  50. package/src/talkpilot/calls/calls.types.ts +119 -119
  51. package/src/talkpilot/calls/dashboard/calls.dashboard.ts +292 -292
  52. package/src/talkpilot/calls/dashboard/calls.dashboard.types.ts +57 -57
  53. package/src/talkpilot/calls/index.ts +6 -6
  54. package/src/talkpilot/clientsConfig/__tests__/clientsConfig.spec.ts +190 -190
  55. package/src/talkpilot/contextNotes/__tests__/contextNotes.getters.spec.ts +176 -176
  56. package/src/talkpilot/contextNotes/contextNotes.getters.ts +86 -86
  57. package/src/talkpilot/contextNotes/contextNotes.types.ts +20 -20
  58. package/src/talkpilot/contextNotes/index.ts +2 -2
  59. package/src/talkpilot/flows/__tests__/flows.schema.spec.ts +96 -71
  60. package/src/talkpilot/flows/flows.schema.ts +154 -153
  61. package/src/talkpilot/flows/flows.types.ts +187 -186
  62. package/src/talkpilot/index.ts +31 -31
  63. package/src/talkpilot/products/__tests__/products.getters.spec.ts +45 -45
  64. package/src/talkpilot/products/index.ts +2 -2
  65. package/src/talkpilot/products/products.getters.ts +12 -12
  66. package/src/talkpilot/products/products.types.ts +9 -9
  67. package/src/test-utils/db-utils.ts +26 -26
  68. package/src/test-utils/factories/index.ts +15 -15
  69. package/src/test-utils/factories/municipal/muniIssues.ts +32 -32
  70. package/src/test-utils/factories/talkpilot/contextNotes.ts +33 -33
  71. package/src/test-utils/factories/websitalk/scans.ts +23 -23
  72. package/src/utils/date.utils.ts +116 -116
  73. package/src/websitalk/index.ts +15 -15
  74. package/src/websitalk/mongodb-client.ts +61 -61
  75. package/src/websitalk/scans/__tests__/scans.spec.ts +218 -218
  76. package/src/websitalk/scans/index.ts +2 -2
  77. package/src/websitalk/scans/scans.getters.ts +113 -113
  78. package/src/websitalk/scans/scans.types.ts +53 -53
  79. package/tsconfig.json +23 -23
package/README_OLD.md CHANGED
@@ -1,160 +1,160 @@
1
- # @talkpilot/core-db
2
-
3
- [NPM Version](https://www.npmjs.com/package/@talkpilot/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 @talkpilot/core-db
23
- # or via GitHub
24
- npm install github:talkpilot/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 '@talkpilot/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 '@talkpilot/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
-
71
- Includes access to:
72
-
73
- - `agents`, `calls`, `clients`, `flows`, `leads`, `phone_numbers`, `plans`, `results`, `sessions`, `subscriptions`, etc.
74
- - Exported as root level functions or via `mongodbClient`.
75
-
76
- ### Municipal Domain
77
-
78
- Includes access to:
79
-
80
- - `cities`, `streets`, `departmentsSubjects`, `tickets`.
81
- - Functions are prefixed where necessary or accessible via `getMunicipalDataDb`.
82
-
83
- ## Environment Variables
84
-
85
- The clients will automatically attempt to use the following environment variables if no URI is provided to the `connect()` method:
86
-
87
- - `MONGO_URI` or `MONGODB_URI`: Primary MongoDB connection string.
88
- - `MONGODB_DB_NAME`: Database name (defaults to 'municipal-data' for the municipal client if not specified).
89
-
90
- ## Development
91
-
92
- ### Setup
93
-
94
- 1. Clone the repository and install dependencies:
95
- ```bash
96
- git clone https://github.com/talkpilot/core-db.git
97
- cd core-db
98
- npm install
99
- ```
100
- 2. Build the project:
101
- ```bash
102
- npm run build
103
- ```
104
-
105
- This will generate the `dist/` directory with the compiled JavaScript and type definitions.
106
-
107
- ### Publishing New Versions
108
-
109
- To publish a new version of the package:
110
-
111
- 1. **Test your changes**:
112
- ```bash
113
- npm test
114
- ```
115
- 2. **Update the version**:
116
- ```bash
117
- # Bumps patch version (0.1.0 -> 0.1.1)
118
- npm version patch
119
- # Or for minor changes (0.1.0 -> 0.2.0)
120
- # npm version minor
121
- # Or for major changes (0.1.0 -> 1.0.0)
122
- # npm version major
123
- ```
124
- 3. **Publish to npm**:
125
- Ensure you have the shared team token in your `~/.npmrc` (see [Development Guide](./DEVELOPMENT.md#team-access--authentication)).
126
- 4. **Update in other repos**:
127
- ```bash
128
- npm update @talkpilot/core-db
129
- ```
130
-
131
- ## License
132
-
133
- MIT
134
-
135
- ---
136
-
137
- **Interested in contributing?** Check out our [Development Guide](./DEVELOPMENT.md) for standards and setup instructions.
138
-
139
- ## Release Notes
140
-
141
- ### 1.1.9
142
-
143
- - `getPhoneNumbersForFlows(clientId)` — lists each phone number linked to a flow for that client (newest first), with `flowId`, `phoneNumber`, and `isPrimary`.
144
- ### 1.1.5
145
-
146
- - `createPurchasedPhoneNumber` for API-bought numbers (Twilio/Telnyx metadata); optional `flowId` until linked to a flow. Types/schema updated accordingly.
147
-
148
- ### 1.0.16
149
-
150
- - Fixed critical issues present in version 1.0.15.
151
- - **Warning**: Version 1.0.15 is bugged and should not be used. Please use at least version 1.0.16.
152
-
153
- ### 1.0.20
154
-
155
- - Added to Moked106Config this param: withNeedAttentionCalls
156
- - withNeedAttentionCalls?: boolean
157
-
158
- ### 1.0.27
159
- - Added an optional `language` field to `ClientConfig` (e.g. Hebrew/English/Russian/French/Spanish) and updated tests.
160
-
1
+ # @talkpilot/core-db
2
+
3
+ [NPM Version](https://www.npmjs.com/package/@talkpilot/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 @talkpilot/core-db
23
+ # or via GitHub
24
+ npm install github:talkpilot/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 '@talkpilot/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 '@talkpilot/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
+
71
+ Includes access to:
72
+
73
+ - `agents`, `calls`, `clients`, `flows`, `leads`, `phone_numbers`, `plans`, `results`, `sessions`, `subscriptions`, etc.
74
+ - Exported as root level functions or via `mongodbClient`.
75
+
76
+ ### Municipal Domain
77
+
78
+ Includes access to:
79
+
80
+ - `cities`, `streets`, `departmentsSubjects`, `tickets`.
81
+ - Functions are prefixed where necessary or accessible via `getMunicipalDataDb`.
82
+
83
+ ## Environment Variables
84
+
85
+ The clients will automatically attempt to use the following environment variables if no URI is provided to the `connect()` method:
86
+
87
+ - `MONGO_URI` or `MONGODB_URI`: Primary MongoDB connection string.
88
+ - `MONGODB_DB_NAME`: Database name (defaults to 'municipal-data' for the municipal client if not specified).
89
+
90
+ ## Development
91
+
92
+ ### Setup
93
+
94
+ 1. Clone the repository and install dependencies:
95
+ ```bash
96
+ git clone https://github.com/talkpilot/core-db.git
97
+ cd core-db
98
+ npm install
99
+ ```
100
+ 2. Build the project:
101
+ ```bash
102
+ npm run build
103
+ ```
104
+
105
+ This will generate the `dist/` directory with the compiled JavaScript and type definitions.
106
+
107
+ ### Publishing New Versions
108
+
109
+ To publish a new version of the package:
110
+
111
+ 1. **Test your changes**:
112
+ ```bash
113
+ npm test
114
+ ```
115
+ 2. **Update the version**:
116
+ ```bash
117
+ # Bumps patch version (0.1.0 -> 0.1.1)
118
+ npm version patch
119
+ # Or for minor changes (0.1.0 -> 0.2.0)
120
+ # npm version minor
121
+ # Or for major changes (0.1.0 -> 1.0.0)
122
+ # npm version major
123
+ ```
124
+ 3. **Publish to npm**:
125
+ Ensure you have the shared team token in your `~/.npmrc` (see [Development Guide](./DEVELOPMENT.md#team-access--authentication)).
126
+ 4. **Update in other repos**:
127
+ ```bash
128
+ npm update @talkpilot/core-db
129
+ ```
130
+
131
+ ## License
132
+
133
+ MIT
134
+
135
+ ---
136
+
137
+ **Interested in contributing?** Check out our [Development Guide](./DEVELOPMENT.md) for standards and setup instructions.
138
+
139
+ ## Release Notes
140
+
141
+ ### 1.1.9
142
+
143
+ - `getPhoneNumbersForFlows(clientId)` — lists each phone number linked to a flow for that client (newest first), with `flowId`, `phoneNumber`, and `isPrimary`.
144
+ ### 1.1.5
145
+
146
+ - `createPurchasedPhoneNumber` for API-bought numbers (Twilio/Telnyx metadata); optional `flowId` until linked to a flow. Types/schema updated accordingly.
147
+
148
+ ### 1.0.16
149
+
150
+ - Fixed critical issues present in version 1.0.15.
151
+ - **Warning**: Version 1.0.15 is bugged and should not be used. Please use at least version 1.0.16.
152
+
153
+ ### 1.0.20
154
+
155
+ - Added to Moked106Config this param: withNeedAttentionCalls
156
+ - withNeedAttentionCalls?: boolean
157
+
158
+ ### 1.0.27
159
+ - Added an optional `language` field to `ClientConfig` (e.g. Hebrew/English/Russian/French/Spanish) and updated tests.
160
+
@@ -2,7 +2,11 @@ import { CityName } from "../utils/types";
2
2
  import type { TicketStatsDateRange, TicketStatsDateScope, TicketSubjectRow } from "./tickets.types";
3
3
  export declare const resolveTicketStatsDateRange: (dateScope?: TicketStatsDateScope) => TicketStatsDateRange;
4
4
  export declare const ticketStatsDateScopeFromYmd: (startStr: string, endStr: string, timezone: string) => TicketStatsDateScope;
5
+ /** @deprecated Use findCallSidTicketCountsByCity instead. */
5
6
  export declare const findCallSidsWithTicketsByCity: (cityName: CityName, dateScope?: TicketStatsDateScope) => Promise<string[]>;
7
+ export declare const findCallSidTicketCountsByCity: (cityName: CityName, dateScope?: TicketStatsDateScope) => Promise<Map<string, number>>;
8
+ /** @deprecated Use findCallSidDraftTicketCountsByCity instead. */
6
9
  export declare const findCallSidsWithDraftTicketsByCity: (cityName: CityName, dateScope?: TicketStatsDateScope) => Promise<string[]>;
10
+ export declare const findCallSidDraftTicketCountsByCity: (cityName: CityName, dateScope?: TicketStatsDateScope) => Promise<Map<string, number>>;
7
11
  export declare const findTicketSubjectRows: (cityName: CityName, dateScope?: TicketStatsDateScope) => Promise<TicketSubjectRow[]>;
8
12
  //# sourceMappingURL=tickets.statistics.getters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tickets.statistics.getters.d.ts","sourceRoot":"","sources":["../../../src/municipal/tickets/tickets.statistics.getters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAa1C,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,2BAA2B,GACtC,YAAY,oBAAoB,KAC/B,oBAKF,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,UAAU,MAAM,EAChB,QAAQ,MAAM,EACd,UAAU,MAAM,KACf,oBAGD,CAAC;AAEH,eAAO,MAAM,6BAA6B,GACxC,UAAU,QAAQ,EAClB,YAAY,oBAAoB,KAC/B,OAAO,CAAC,MAAM,EAAE,CAMlB,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAC7C,UAAU,QAAQ,EAClB,YAAY,oBAAoB,KAC/B,OAAO,CAAC,MAAM,EAAE,CAOlB,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,UAAU,QAAQ,EAClB,YAAY,oBAAoB,KAC/B,OAAO,CAAC,gBAAgB,EAAE,CAO5B,CAAC"}
1
+ {"version":3,"file":"tickets.statistics.getters.d.ts","sourceRoot":"","sources":["../../../src/municipal/tickets/tickets.statistics.getters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAa1C,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,2BAA2B,GACtC,YAAY,oBAAoB,KAC/B,oBAKF,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,UAAU,MAAM,EAChB,QAAQ,MAAM,EACd,UAAU,MAAM,KACf,oBAGD,CAAC;AAEH,6DAA6D;AAC7D,eAAO,MAAM,6BAA6B,GACxC,UAAU,QAAQ,EAClB,YAAY,oBAAoB,KAC/B,OAAO,CAAC,MAAM,EAAE,CAQlB,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,UAAU,QAAQ,EAClB,YAAY,oBAAoB,KAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAU7B,CAAC;AAGF,kEAAkE;AAClE,eAAO,MAAM,kCAAkC,GAC7C,UAAU,QAAQ,EAClB,YAAY,oBAAoB,KAC/B,OAAO,CAAC,MAAM,EAAE,CASlB,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAC7C,UAAU,QAAQ,EAClB,YAAY,oBAAoB,KAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAW7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,UAAU,QAAQ,EAClB,YAAY,oBAAoB,KAC/B,OAAO,CAAC,gBAAgB,EAAE,CAO5B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findTicketSubjectRows = exports.findCallSidsWithDraftTicketsByCity = exports.findCallSidsWithTicketsByCity = exports.ticketStatsDateScopeFromYmd = exports.resolveTicketStatsDateRange = void 0;
3
+ exports.findTicketSubjectRows = exports.findCallSidDraftTicketCountsByCity = exports.findCallSidsWithDraftTicketsByCity = exports.findCallSidTicketCountsByCity = exports.findCallSidsWithTicketsByCity = exports.ticketStatsDateScopeFromYmd = exports.resolveTicketStatsDateRange = void 0;
4
4
  const date_utils_1 = require("../../utils/date.utils");
5
5
  const tickets_constants_1 = require("./tickets.constants");
6
6
  const tickets_statistics_aggregation_1 = require("./tickets.statistics.aggregation");
@@ -15,23 +15,50 @@ const ticketStatsDateScopeFromYmd = (startStr, endStr, timezone) => ({
15
15
  to: (0, date_utils_1.endOfCalendarDayInTz)(endStr, timezone),
16
16
  });
17
17
  exports.ticketStatsDateScopeFromYmd = ticketStatsDateScopeFromYmd;
18
+ /** @deprecated Use findCallSidTicketCountsByCity instead. */
18
19
  const findCallSidsWithTicketsByCity = async (cityName, dateScope) => {
19
20
  const rows = await (0, tickets_statistics_aggregation_1.runTicketStatsAggregate)([
20
21
  { $match: (0, tickets_statistics_aggregation_1.ticketsWithCallSidMatch)(cityName, (0, exports.resolveTicketStatsDateRange)(dateScope)) },
21
22
  { $group: { _id: "$callSid" } },
22
23
  ]);
23
- return rows.map((r) => String(r._id)).filter(Boolean);
24
+ return rows
25
+ .filter((r) => r._id != null && r._id !== "")
26
+ .map((r) => String(r._id));
24
27
  };
25
28
  exports.findCallSidsWithTicketsByCity = findCallSidsWithTicketsByCity;
29
+ const findCallSidTicketCountsByCity = async (cityName, dateScope) => {
30
+ const rows = await (0, tickets_statistics_aggregation_1.runTicketStatsAggregate)([
31
+ { $match: (0, tickets_statistics_aggregation_1.ticketsWithCallSidMatch)(cityName, (0, exports.resolveTicketStatsDateRange)(dateScope)) },
32
+ { $group: { _id: "$callSid", ticketCount: { $sum: 1 } } },
33
+ ]);
34
+ return new Map(rows
35
+ .filter((r) => r._id != null && r._id !== "")
36
+ .map((r) => [String(r._id), r.ticketCount]));
37
+ };
38
+ exports.findCallSidTicketCountsByCity = findCallSidTicketCountsByCity;
39
+ /** @deprecated Use findCallSidDraftTicketCountsByCity instead. */
26
40
  const findCallSidsWithDraftTicketsByCity = async (cityName, dateScope) => {
27
41
  const rows = await (0, tickets_statistics_aggregation_1.runTicketStatsAggregate)([
28
42
  { $match: (0, tickets_statistics_aggregation_1.ticketsWithCallSidMatch)(cityName, (0, exports.resolveTicketStatsDateRange)(dateScope)) },
29
43
  { $match: { $expr: tickets_statistics_aggregation_1.isDraftSubjectIdExpr } },
30
44
  { $group: { _id: "$callSid" } },
31
45
  ]);
32
- return rows.map((r) => String(r._id)).filter(Boolean);
46
+ return rows
47
+ .filter((r) => r._id != null && r._id !== "")
48
+ .map((r) => String(r._id));
33
49
  };
34
50
  exports.findCallSidsWithDraftTicketsByCity = findCallSidsWithDraftTicketsByCity;
51
+ const findCallSidDraftTicketCountsByCity = async (cityName, dateScope) => {
52
+ const rows = await (0, tickets_statistics_aggregation_1.runTicketStatsAggregate)([
53
+ { $match: (0, tickets_statistics_aggregation_1.ticketsWithCallSidMatch)(cityName, (0, exports.resolveTicketStatsDateRange)(dateScope)) },
54
+ { $match: { $expr: tickets_statistics_aggregation_1.isDraftSubjectIdExpr } },
55
+ { $group: { _id: "$callSid", ticketCount: { $sum: 1 } } },
56
+ ]);
57
+ return new Map(rows
58
+ .filter((r) => r._id != null && r._id !== "")
59
+ .map((r) => [String(r._id), r.ticketCount]));
60
+ };
61
+ exports.findCallSidDraftTicketCountsByCity = findCallSidDraftTicketCountsByCity;
35
62
  const findTicketSubjectRows = async (cityName, dateScope) => {
36
63
  const rows = await (0, tickets_statistics_aggregation_1.runTicketStatsAggregate)([
37
64
  { $match: (0, tickets_statistics_aggregation_1.ticketsWithCallSidMatch)(cityName, (0, exports.resolveTicketStatsDateRange)(dateScope)) },
@@ -1 +1 @@
1
- {"version":3,"file":"tickets.statistics.getters.js","sourceRoot":"","sources":["../../../src/municipal/tickets/tickets.statistics.getters.ts"],"names":[],"mappings":";;;AACA,uDAIgC;AAChC,2DAA4D;AAC5D,qFAK0C;AAOnC,MAAM,2BAA2B,GAAG,CACzC,SAAgC,EACV,EAAE;IACxB,MAAM,EAAE,GAAG,SAAS,EAAE,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC;IACvC,MAAM,IAAI,GACR,SAAS,EAAE,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,yCAAqB,GAAG,mBAAM,CAAC,CAAC;IAC7E,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AACtB,CAAC,CAAC;AAPW,QAAA,2BAA2B,+BAOtC;AAEK,MAAM,2BAA2B,GAAG,CACzC,QAAgB,EAChB,MAAc,EACd,QAAgB,EACM,EAAE,CAAC,CAAC;IAC1B,IAAI,EAAE,IAAA,mCAAsB,EAAC,QAAQ,EAAE,QAAQ,CAAC;IAChD,EAAE,EAAE,IAAA,iCAAoB,EAAC,MAAM,EAAE,QA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jF,EAAE,MAAM,EAAE,IAAA,wDAAuB,EAAC,QAAQ,EAAE,IAAA,mCAA2B,EAAC,SAAS,CAAC,CAAC,EAAE;QACrF,GAAG,IAAA,wDAAuB,EAAC,QAAQ,CAAC;QACpC,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE;KACjD,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACvF,CAAC,CAAC;AAVW,QAAA,qBAAqB,yBAUhC"}
1
+ {"version":3,"file":"tickets.statistics.getters.js","sourceRoot":"","sources":["../../../src/municipal/tickets/tickets.statistics.getters.ts"],"names":[],"mappings":";;;AACA,uDAIgC;AAChC,2DAA4D;AAC5D,qFAK0C;AAOnC,MAAM,2BAA2B,GAAG,CACzC,SAAgC,EACV,EAAE;IACxB,MAAM,EAAE,GAAG,SAAS,EAAE,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC;IACvC,MAAM,IAAI,GACR,SAAS,EAAE,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,yCAAqB,GAAG,mBAAM,CAAC,CAAC;IAC7E,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AACtB,CAAC,CAAC;AAPW,QAAA,2BAA2B,+BAOtC;AAEK,MAAM,2BAA2B,GAAG,CACzC,QAAgB,EAChB,MAAc,EACd,QAAgB,EACM,EAAE,CAAC,CAAC;IAC1B,IAAI,EAAE,IAAA,mCAAsB,EAAC,QAAQ,EAAE,QAAQ,CAAC;IAChD,EAAE,EAAE,IAAA,iCAAoB,EAAC,MAAM,EAAE,QAAQ,CAAC;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,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC;SAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAC9C,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,kCAAkC,sCAc7C;AAEK,MAAM,qBAAqB,GAAG,KAAK,EACxC,QAAkB,EAClB,SAAgC,EACH,EAAE;IAC/B,MAAM,IAAI,GAAG,MAAM,IAAA,wDAAuB,EAAyC;QACjF,EAAE,MAAM,EAAE,IAAA,wDAAuB,EAAC,QAAQ,EAAE,IAAA,mCAA2B,EAAC,SAAS,CAAC,CAAC,EAAE;QACrF,GAAG,IAAA,wDAAuB,EAAC,QAAQ,CAAC;QACpC,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE;KACjD,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACvF,CAAC,CAAC;AAVW,QAAA,qBAAqB,yBAUhC"}
@@ -0,0 +1,3 @@
1
+ import { DashboardStatsParams, DashboardStatsResult } from "./calls.types";
2
+ export declare function getDashboardStats(params: DashboardStatsParams): Promise<DashboardStatsResult>;
3
+ //# sourceMappingURL=calls.dashboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calls.dashboard.d.ts","sourceRoot":"","sources":["../../../src/talkpilot/calls/calls.dashboard.ts"],"names":[],"mappings":"AAEA,OAAO,EAA8B,oBAAoB,EAAE,oBAAoB,EAAiD,MAAM,eAAe,CAAC;AAmGtJ,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC,CAuG/B"}
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getDashboardStats = getDashboardStats;
7
+ const dayjs_1 = __importDefault(require("dayjs"));
8
+ const calls_getters_1 = require("./calls.getters");
9
+ const clientsConfig_1 = require("../clientsConfig");
10
+ const utc_1 = __importDefault(require("dayjs/plugin/utc"));
11
+ const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
12
+ dayjs_1.default.extend(utc_1.default);
13
+ dayjs_1.default.extend(timezone_1.default);
14
+ function buildKpisPipeline() {
15
+ return [
16
+ {
17
+ $group: {
18
+ _id: null,
19
+ totalCalls: { $sum: 1 },
20
+ totalDuration: { $sum: "$callLength" },
21
+ completedCount: {
22
+ $sum: { $cond: [{ $eq: ["$status", "completed"] }, 1, 0] },
23
+ },
24
+ failedCount: {
25
+ $sum: { $cond: [{ $eq: ["$status", "failed"] }, 1, 0] },
26
+ },
27
+ noAnswerCount: {
28
+ $sum: { $cond: [{ $eq: ["$status", "no-answer"] }, 1, 0] },
29
+ },
30
+ busyCount: {
31
+ $sum: { $cond: [{ $eq: ["$status", "busy"] }, 1, 0] },
32
+ },
33
+ },
34
+ },
35
+ ];
36
+ }
37
+ function buildDailyDataPipeline(timezone) {
38
+ return [
39
+ {
40
+ $group: {
41
+ _id: {
42
+ $dateToString: {
43
+ format: "%Y-%m-%d",
44
+ date: "$createdAt",
45
+ timezone: timezone,
46
+ },
47
+ },
48
+ count: { $sum: 1 },
49
+ completed: {
50
+ $sum: { $cond: [{ $eq: ["$status", "completed"] }, 1, 0] },
51
+ },
52
+ },
53
+ },
54
+ { $sort: { _id: 1 } },
55
+ ];
56
+ }
57
+ function buildHourlyDataPipeline(timezone) {
58
+ return [
59
+ {
60
+ $group: {
61
+ _id: {
62
+ day: {
63
+ $dateToString: {
64
+ format: "%Y-%m-%d",
65
+ date: "$createdAt",
66
+ timezone: timezone,
67
+ },
68
+ },
69
+ hour: { $hour: { date: "$createdAt", timezone: timezone } },
70
+ },
71
+ count: { $sum: 1 },
72
+ },
73
+ },
74
+ ];
75
+ }
76
+ function buildCallLengthBucketsPipeline() {
77
+ return [
78
+ {
79
+ $group: {
80
+ _id: null,
81
+ short: { $sum: { $cond: [{ $lt: ["$callLength", 60] }, 1, 0] } },
82
+ medium: {
83
+ $sum: {
84
+ $cond: [
85
+ {
86
+ $and: [
87
+ { $gte: ["$callLength", 60] },
88
+ { $lte: ["$callLength", 180] },
89
+ ],
90
+ },
91
+ 1,
92
+ 0,
93
+ ],
94
+ },
95
+ },
96
+ long: { $sum: { $cond: [{ $gt: ["$callLength", 180] }, 1, 0] } },
97
+ },
98
+ },
99
+ ];
100
+ }
101
+ async function getDashboardStats(params) {
102
+ const { clientId, startDate, endDate } = params;
103
+ const clientConfig = await (0, clientsConfig_1.getClientConfig)(clientId);
104
+ const timezone = clientConfig?.timezone ?? "UTC";
105
+ const startDateObj = dayjs_1.default.tz(startDate, timezone).startOf("day").toDate();
106
+ const endDateObj = dayjs_1.default.tz(endDate, timezone).endOf("day").toDate();
107
+ const pipeline = [
108
+ {
109
+ $match: {
110
+ clientId,
111
+ createdAt: { $gte: startDateObj, $lte: endDateObj },
112
+ },
113
+ },
114
+ {
115
+ $facet: {
116
+ kpis: buildKpisPipeline(),
117
+ dailyData: buildDailyDataPipeline(timezone),
118
+ hourlyData: buildHourlyDataPipeline(timezone),
119
+ callLengthBuckets: buildCallLengthBucketsPipeline(),
120
+ },
121
+ },
122
+ ];
123
+ const callsCollection = (0, calls_getters_1.getCallsCollection)();
124
+ const [aggregatedResult] = await callsCollection
125
+ .aggregate(pipeline)
126
+ .toArray();
127
+ const kpiData = aggregatedResult?.kpis?.[0] ?? {
128
+ totalCalls: 0,
129
+ totalDuration: 0,
130
+ completedCount: 0,
131
+ failedCount: 0,
132
+ noAnswerCount: 0,
133
+ busyCount: 0,
134
+ };
135
+ const dailyDataRaw = aggregatedResult?.dailyData ?? [];
136
+ const hourlyDataRaw = aggregatedResult?.hourlyData ?? [];
137
+ const callLengthRaw = aggregatedResult?.callLengthBuckets?.[0] ?? {
138
+ short: 0,
139
+ medium: 0,
140
+ long: 0,
141
+ };
142
+ const count = kpiData.totalCalls;
143
+ const totalLen = kpiData.totalDuration;
144
+ const completed = kpiData.completedCount;
145
+ const kpis = {
146
+ totalCalls: count,
147
+ avgDurationSeconds: count > 0 ? Math.round(totalLen / count) : 0,
148
+ timeSavedMinutes: Math.round(totalLen / 60),
149
+ successRate: count > 0 ? Math.round((completed / count) * 1000) / 10 : 0,
150
+ completedCount: completed,
151
+ failedCount: kpiData.failedCount,
152
+ noAnswerCount: kpiData.noAnswerCount,
153
+ busyCount: kpiData.busyCount,
154
+ };
155
+ const volumeData = dailyDataRaw.map((d) => ({
156
+ date: d._id,
157
+ count: d.count,
158
+ completed: d.completed,
159
+ }));
160
+ const heatmapMap = new Map();
161
+ for (const bucket of hourlyDataRaw) {
162
+ const dayKey = bucket._id.day;
163
+ const hour = bucket._id.hour;
164
+ if (!heatmapMap.has(dayKey))
165
+ heatmapMap.set(dayKey, new Map());
166
+ heatmapMap.get(dayKey).set(hour, bucket.count);
167
+ }
168
+ const toSortedBuckets = (map) => Array.from(map.entries())
169
+ .sort(([a], [b]) => a - b)
170
+ .map(([h, c]) => ({
171
+ hour: `${String(h).padStart(2, "0")}:00`,
172
+ calls: c,
173
+ }));
174
+ const heatmap = {};
175
+ for (const [day, hourMap] of Array.from(heatmapMap.entries()).sort()) {
176
+ heatmap[day] = toSortedBuckets(hourMap);
177
+ }
178
+ return {
179
+ kpis,
180
+ charts: {
181
+ volumeData,
182
+ heatmap,
183
+ callLengthBuckets: {
184
+ short: callLengthRaw.short,
185
+ medium: callLengthRaw.medium,
186
+ long: callLengthRaw.long,
187
+ },
188
+ },
189
+ };
190
+ }
191
+ //# sourceMappingURL=calls.dashboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calls.dashboard.js","sourceRoot":"","sources":["../../../src/talkpilot/calls/calls.dashboard.ts"],"names":[],"mappings":";;;;;AAqGA,8CAyGC;AA9MD,kDAA0B;AAC1B,mDAAqD;AAErD,oDAAmD;AACnD,2DAAmC;AACnC,qEAAmD;AAEnD,eAAK,CAAC,MAAM,CAAC,aAAG,CAAC,CAAC;AAClB,eAAK,CAAC,MAAM,CAAC,kBAAc,CAAC,CAAC;AAC7B,SAAS,iBAAiB;IACxB,OAAO;QACL;YACE,MAAM,EAAE;gBACN,GAAG,EAAE,IAAI;gBACT,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;gBACvB,aAAa,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;gBACtC,cAAc,EAAE;oBACd,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;iBAC3D;gBACD,WAAW,EAAE;oBACX,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;iBACxD;gBACD,aAAa,EAAE;oBACb,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;iBAC3D;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;iBACtD;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