@app-connect/core 1.7.32 → 1.7.33
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/docs/connectors.md +1 -1
- package/docs/handlers.md +11 -8
- package/docs/libraries.md +0 -3
- package/docs/models.md +5 -5
- package/docs/routes.md +5 -1
- package/handlers/log.js +431 -167
- package/handlers/plugin.js +0 -24
- package/handlers/user.js +96 -9
- package/index.js +58 -46
- package/mcp/README.md +8 -0
- package/mcp/mcpHandler.js +126 -21
- package/package.json +1 -1
- package/releaseNotes.json +24 -0
- package/test/handlers/log.test.js +225 -0
- package/test/handlers/plugin.test.js +0 -256
- package/test/index.test.js +31 -0
- package/test/mcp/mcpHandler.test.js +73 -0
package/docs/connectors.md
CHANGED
|
@@ -94,7 +94,7 @@ The shared framework expects these methods most often:
|
|
|
94
94
|
- `createContact()`
|
|
95
95
|
- `findContactWithName()`
|
|
96
96
|
- `unAuthorize()`
|
|
97
|
-
- optional methods such as `getUserList()`, `getLicenseStatus()`, `upsertCallDisposition()`, `getServerLoggingSettings()`, `updateServerLoggingSettings()`, and `onUpdateUserSettings()`
|
|
97
|
+
- optional methods such as `refreshUserInfo()`, `getUserList()`, `getLicenseStatus()`, `upsertCallDisposition()`, `getServerLoggingSettings()`, `updateServerLoggingSettings()`, and `onUpdateUserSettings()`
|
|
98
98
|
|
|
99
99
|
## API-Key Managed Auth Fields
|
|
100
100
|
|
package/docs/handlers.md
CHANGED
|
@@ -8,12 +8,11 @@ Handlers contain the shared business workflows behind the route layer.
|
|
|
8
8
|
| --- | --- | --- |
|
|
9
9
|
| `handlers/auth.js` | Connector login, OAuth callback handling, user persistence, and auth validation | `onOAuthCallback`, `onApiKeyLogin`, `authValidation`, `getLicenseStatus`, `onRingcentralOAuthCallback` |
|
|
10
10
|
| `handlers/contact.js` | Contact search, creation, and account-data caching | `findContact`, `createContact`, `findContactWithName` |
|
|
11
|
-
| `handlers/log.js` | Call logging, message logging, plugin execution, call-log lookup, and note cache writes | `createCallLog`, `updateCallLog`, `createMessageLog`, `getCallLog`, `saveNoteCache` |
|
|
11
|
+
| `handlers/log.js` | Call logging, message logging, plugin execution, async plugin callbacks, call-log lookup, and note cache writes | `createCallLog`, `updateCallLog`, `createMessageLog`, `getCallLog`, `saveNoteCache`, `handleAsyncPluginCallback` |
|
|
12
12
|
| `handlers/admin.js` | Admin settings, RingCentral reporting, server logging settings, and user mapping | `validateAdminRole`, `upsertAdminSettings`, `getAdminSettings`, `updateAdminRcTokens`, `getServerLoggingSettings`, `updateServerLoggingSettings`, `getAdminReport`, `getUserReport`, `getUserMapping`, `reinitializeUserMapping` |
|
|
13
|
-
| `handlers/user.js` | User setting reads, admin/user setting merge, and updates | `getUserSettingsByAdmin`, `getUserSettings`, `updateUserSettings` |
|
|
13
|
+
| `handlers/user.js` | User info refresh, user setting reads, admin/user setting merge, and updates | `refreshUserInfo`, `getUserSettingsByAdmin`, `getUserSettings`, `updateUserSettings` |
|
|
14
14
|
| `handlers/disposition.js` | Call-disposition writes against an existing log | `upsertCallDisposition` |
|
|
15
15
|
| `handlers/calldown.js` | User-owned call-down scheduling | `schedule`, `list`, `remove`, `markCalled`, `update` |
|
|
16
|
-
| `handlers/plugin.js` | Async plugin task polling and cleanup | `getPluginAsyncTasks` |
|
|
17
16
|
| `handlers/managedAuth.js` | Shared API-key auth field discovery, secure storage, and login-time field resolution | `getManagedAuthAdminSettings`, `getManagedAuthState`, `resolveApiKeyLoginFields`, `upsertOrgManagedAuthValues`, `upsertUserManagedAuthValues` |
|
|
18
17
|
|
|
19
18
|
## Common Execution Pattern
|
|
@@ -62,7 +61,9 @@ Key responsibilities:
|
|
|
62
61
|
|
|
63
62
|
- prevents duplicate call-log creation by checking `CallLogModel` on `sessionId`
|
|
64
63
|
- loads note cache from DynamoDB when `USE_CACHE` and server-side call logging are enabled
|
|
65
|
-
- runs configured plugins before creating or updating logs
|
|
64
|
+
- runs configured synchronous plugins before creating or updating logs
|
|
65
|
+
- dispatches configured asynchronous call plugins after call-log create or update succeeds
|
|
66
|
+
- handles async plugin callbacks by appending Agent notes on success or marking task cache as failed on failure
|
|
66
67
|
- composes log body content with `composeCallLog()` or `composeSharedSMSLog()`
|
|
67
68
|
- stores local mappings between telephony ids and CRM log ids
|
|
68
69
|
- handles normal SMS, fax, group SMS, and shared SMS cases
|
|
@@ -72,7 +73,7 @@ Important persistence behavior:
|
|
|
72
73
|
|
|
73
74
|
- `CallLogModel` stores the App Connect to CRM mapping for call logs
|
|
74
75
|
- `MessageLogModel` stores the App Connect to CRM mapping for message logs
|
|
75
|
-
- `CacheModel` stores async plugin task
|
|
76
|
+
- `CacheModel` stores async plugin callback tasks with a one-week expiry; successful callbacks delete the task and failed callbacks keep the task with status `failed`
|
|
76
77
|
- `NoteCache` stores temporary notes keyed by session id
|
|
77
78
|
|
|
78
79
|
## `admin.js`
|
|
@@ -89,10 +90,11 @@ Key responsibilities:
|
|
|
89
90
|
|
|
90
91
|
## `user.js`
|
|
91
92
|
|
|
92
|
-
This module
|
|
93
|
+
This module handles user-owned workflows that do not belong to login, contact, or logging handlers.
|
|
93
94
|
|
|
94
95
|
Rules implemented here:
|
|
95
96
|
|
|
97
|
+
- `refreshUserInfo()` loads the current user, refreshes OAuth credentials when needed or builds API-key auth, then delegates to the connector's `refreshUserInfo({ user, authHeader, proxyConfig })`
|
|
96
98
|
- if no admin settings exist, return user settings directly
|
|
97
99
|
- admin settings can override or hide user settings
|
|
98
100
|
- plugin settings merge at both the plugin level and nested config-field level
|
|
@@ -112,8 +114,9 @@ Rules implemented here:
|
|
|
112
114
|
|
|
113
115
|
`plugin.js`:
|
|
114
116
|
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
+
- registers and unregisters account-level plugins
|
|
118
|
+
- validates plugin registration against RingCentral account identity
|
|
119
|
+
- reads plugin license status through the installed plugin profile
|
|
117
120
|
|
|
118
121
|
`managedAuth.js`:
|
|
119
122
|
|
package/docs/libraries.md
CHANGED
|
@@ -96,6 +96,3 @@ Exports:
|
|
|
96
96
|
- `secondsToHoursMinutesSeconds()`
|
|
97
97
|
- `getMostRecentDate()`
|
|
98
98
|
- `getMediaReaderLinkByPlatformMediaLink()`
|
|
99
|
-
- `getPluginsFromUserSettings()`
|
|
100
|
-
|
|
101
|
-
`getPluginsFromUserSettings()` is especially important because logging handlers use it to discover which plugins should run for call, SMS, or fax workflows.
|
package/docs/models.md
CHANGED
|
@@ -73,12 +73,12 @@ Stores temporary task state, mainly for async plugin work.
|
|
|
73
73
|
|
|
74
74
|
| Field | Notes |
|
|
75
75
|
| --- | --- |
|
|
76
|
-
| `id` | Task id
|
|
77
|
-
| `status` | Task status such as `initialized`, `completed`, or `failed` |
|
|
76
|
+
| `id` | Task id. Async plugin callback tasks use the UUID sent to the plugin as `asyncTaskId`. |
|
|
77
|
+
| `status` | Task status such as `pending`, `initialized`, `completed`, or `failed` |
|
|
78
78
|
| `userId` | Owning user |
|
|
79
|
-
| `cacheKey` | Logical task family |
|
|
80
|
-
| `data` | Optional task payload |
|
|
81
|
-
| `expiry` | Cleanup cutoff |
|
|
79
|
+
| `cacheKey` | Logical task family. Async plugin tasks use `asyncPluginTask-<pluginId>`. |
|
|
80
|
+
| `data` | Optional task payload. Async plugin tasks keep callback URL, plugin id, call-log lookup fields, original plugin input, and failure `message` when a callback fails. |
|
|
81
|
+
| `expiry` | Cleanup cutoff. Async plugin callback tasks expire after one week. |
|
|
82
82
|
|
|
83
83
|
### `models/accountDataModel.js`
|
|
84
84
|
|
package/docs/routes.md
CHANGED
|
@@ -58,6 +58,7 @@ This page documents the non-MCP HTTP routes defined in `index.js`.
|
|
|
58
58
|
| Method | Path | Purpose |
|
|
59
59
|
| --- | --- | --- |
|
|
60
60
|
| `GET` | `/user/preloadSettings` | Loads settings used to bootstrap client-side configuration |
|
|
61
|
+
| `POST` | `/user/refreshInfo` | Refreshes connector-owned CRM user information for the current user |
|
|
61
62
|
| `GET` | `/user/settings` | Returns merged user and admin settings |
|
|
62
63
|
| `POST` | `/user/settings` | Updates per-user settings, with connector hooks when present |
|
|
63
64
|
|
|
@@ -94,7 +95,10 @@ This page documents the non-MCP HTTP routes defined in `index.js`.
|
|
|
94
95
|
| Method | Path | Purpose |
|
|
95
96
|
| --- | --- | --- |
|
|
96
97
|
| `GET` | `/debug/report/url` | Returns a presigned URL for error log upload |
|
|
97
|
-
| `POST` | `/
|
|
98
|
+
| `POST` | `/plugin/async-callback/:taskId` | Receives async plugin completion callbacks for call-log tasks |
|
|
99
|
+
| `POST` | `/plugin/register` | Registers an account-level plugin and stores returned plugin auth data |
|
|
100
|
+
| `DELETE` | `/plugin/unregister` | Removes account-level plugin auth and settings |
|
|
101
|
+
| `GET` | `/plugin/licenseStatus` | Reads license status for an installed plugin |
|
|
98
102
|
|
|
99
103
|
## Development-Only Mock Routes
|
|
100
104
|
|