@astralibx/call-log-engine 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -4
- package/dist/index.cjs +517 -227
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +57 -13
- package/dist/index.d.ts +57 -13
- package/dist/index.mjs +515 -227
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -112,19 +112,44 @@ const engine = createCallLogEngine({
|
|
|
112
112
|
## Features
|
|
113
113
|
|
|
114
114
|
- **Pipeline management** -- CRUD pipelines with configurable stages, default/terminal flags, and stage reordering. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/api-routes.md)
|
|
115
|
-
- **Call log lifecycle** -- Create, update, change stage, assign, close, reopen calls with automatic timeline tracking. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/api-routes.md)
|
|
115
|
+
- **Call log lifecycle** -- Create, update, change stage, assign, close, reopen, soft delete calls with automatic timeline tracking. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/api-routes.md)
|
|
116
|
+
- **Call channels** -- Track communication channel per call (phone, whatsapp, telegram, etc.). Admin-configurable `availableChannels` in settings. Filterable in list queries. Channel distribution in analytics.
|
|
117
|
+
- **Call outcomes** -- Track result of each call separate from pipeline stage (interested, not_interested, no_answer, etc.). Admin-configurable `availableOutcomes` in settings. Filterable, with outcome distribution in analytics.
|
|
118
|
+
- **Follow-up flag** -- `isFollowUp` boolean distinguishes follow-up calls from fresh calls. Filterable in list queries. Follow-up ratio computed in analytics.
|
|
119
|
+
- **Soft delete** -- `DELETE /:id` soft-deletes with `isDeleted` flag and `deletedAt` timestamp. Excluded from all queries and analytics by default. `includeDeleted=true` query param for audit access.
|
|
120
|
+
- **Agent-scoped filtering** -- When `enableAgentScoping` is true (default), non-owner staff see only their own calls in list and analytics. Owners see everything. Based on `role` field from `authenticateAgent` adapter.
|
|
116
121
|
- **Timeline** -- Append-only audit trail per call with notes, stage changes, assignments, follow-up events. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/api-routes.md)
|
|
117
122
|
- **Contact timeline** -- Merged cross-call timeline for a contact. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/api-routes.md)
|
|
118
123
|
- **Follow-up worker** -- Background worker polls for due follow-ups and fires `onFollowUpDue` hook. Starts automatically, stops via `engine.destroy()`. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/hooks.md)
|
|
119
|
-
- **Analytics** -- Dashboard stats, agent stats, leaderboard, pipeline stats/funnel, team stats, daily/weekly/overall reports. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/api-routes.md)
|
|
124
|
+
- **Analytics** -- Dashboard stats, agent stats, leaderboard, pipeline stats/funnel, team stats, daily/weekly/overall reports, channel/outcome distributions, follow-up ratio. Deleted calls excluded from all analytics. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/api-routes.md)
|
|
120
125
|
- **Export** -- Bulk call export, single call export, pipeline report export in JSON or CSV. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/api-routes.md)
|
|
121
|
-
- **Settings** -- Runtime-mutable tags, categories, priority levels, follow-up defaults. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/api-routes.md)
|
|
126
|
+
- **Settings** -- Runtime-mutable tags, categories, priority levels, follow-up defaults, available channels, available outcomes. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/api-routes.md)
|
|
122
127
|
- **Bulk operations** -- Bulk stage change for multiple call logs at once. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/api-routes.md)
|
|
123
128
|
- **Contact adapters** -- Pluggable contact lookup and creation. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/adapters.md)
|
|
124
129
|
- **Agent sharing** -- Reuse chat-engine's agent collection. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/agent-sharing.md)
|
|
125
130
|
- **Lifecycle hooks** -- 6 hooks for call events, follow-ups, and metrics. [Details](https://github.com/Hariprakash1997/astralib/blob/main/packages/call-log/call-log-engine/docs/hooks.md)
|
|
126
131
|
- **Error classes** -- Typed errors with codes for every failure scenario.
|
|
127
132
|
|
|
133
|
+
## Phase 2 Routes
|
|
134
|
+
|
|
135
|
+
### New routes
|
|
136
|
+
|
|
137
|
+
| Method | Route | Description |
|
|
138
|
+
|--------|-------|-------------|
|
|
139
|
+
| `DELETE` | `/calls/:id` | Soft-delete a call log (sets `isDeleted` + `deletedAt`) |
|
|
140
|
+
| `GET` | `/analytics/channel-distribution` | Channel breakdown — query: `from?`, `to?` |
|
|
141
|
+
| `GET` | `/analytics/outcome-distribution` | Outcome breakdown — query: `from?`, `to?` |
|
|
142
|
+
| `GET` | `/analytics/follow-up-stats` | Follow-up ratio — query: `from?`, `to?` |
|
|
143
|
+
|
|
144
|
+
### New query params on `GET /calls`
|
|
145
|
+
|
|
146
|
+
| Param | Type | Description |
|
|
147
|
+
|-------|------|-------------|
|
|
148
|
+
| `channel` | `string` | Filter by communication channel |
|
|
149
|
+
| `outcome` | `string` | Filter by call outcome |
|
|
150
|
+
| `isFollowUp` | `boolean` | Filter follow-up calls (`true` or `false`) |
|
|
151
|
+
| `includeDeleted` | `boolean` | Include soft-deleted calls in results (`true` or `false`, default `false`) |
|
|
152
|
+
|
|
128
153
|
## Architecture
|
|
129
154
|
|
|
130
155
|
The library exposes an Express router from a single factory call:
|
|
@@ -134,7 +159,7 @@ The library exposes an Express router from a single factory call:
|
|
|
134
159
|
| `engine.routes` | REST API -- pipelines, calls, contacts, analytics, settings, export | Protected (via `authenticateAgent` adapter) |
|
|
135
160
|
| `engine.destroy()` | Stops follow-up worker, cleans up resources | Call on shutdown |
|
|
136
161
|
|
|
137
|
-
All services are also available programmatically via the returned `engine` object: `pipelines`, `callLogs`, `timeline`, `analytics`, `settings`, `export`, `models`.
|
|
162
|
+
All services are also available programmatically via the returned `engine` object: `pipelines`, `callLogs`, `lifecycle`, `timeline`, `analytics`, `pipelineAnalytics`, `settings`, `export`, `models`.
|
|
138
163
|
|
|
139
164
|
## Getting Started Guide
|
|
140
165
|
|