@remits/remits-cli 0.1.149 → 0.1.150
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/index.js +23 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
- L7473 Branches, Promotion, Commit, And Test Runs
|
|
15
15
|
- L9562 Tokens, Tools, Verification, And Config
|
|
16
16
|
- L10989 Service Dashboard And WebSocket Listener
|
|
17
|
-
-
|
|
18
|
-
-
|
|
17
|
+
- L13488 Agent And Ticket Workflows
|
|
18
|
+
- L17623 Help, Auto Update, And Command Dispatch
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
/*
|
|
@@ -13200,6 +13200,16 @@ function createManagedWebsocketClient(baseUrl, urlSessions) {
|
|
|
13200
13200
|
lastError: null
|
|
13201
13201
|
};
|
|
13202
13202
|
|
|
13203
|
+
const headerUserIds = [...new Set((managedClient.urlSessions || [])
|
|
13204
|
+
.map((session) => session && session.user && session.user.id != null ? String(session.user.id) : '')
|
|
13205
|
+
.filter(Boolean))];
|
|
13206
|
+
const headerAccountIds = [...new Set((managedClient.urlSessions || [])
|
|
13207
|
+
.map((session) => session && session.accountId != null ? String(session.accountId) : '')
|
|
13208
|
+
.filter(Boolean))];
|
|
13209
|
+
const headerScope = headerUserIds.length === 1
|
|
13210
|
+
? 'user:' + headerUserIds[0]
|
|
13211
|
+
: 'remits-cli:' + sha256(normalizedBaseUrl).slice(0, 12);
|
|
13212
|
+
|
|
13203
13213
|
const client = new Client({
|
|
13204
13214
|
brokerURL: webSocketUrl(normalizedBaseUrl),
|
|
13205
13215
|
reconnectDelay: WEBSOCKET_RECONNECT_DELAY_MS,
|
|
@@ -13207,6 +13217,17 @@ function createManagedWebsocketClient(baseUrl, urlSessions) {
|
|
|
13207
13217
|
heartbeatOutgoing: WEBSOCKET_HEARTBEAT_MS,
|
|
13208
13218
|
connectionTimeout: WEBSOCKET_CONNECTION_TIMEOUT_MS,
|
|
13209
13219
|
discardWebsocketOnCommFailure: true,
|
|
13220
|
+
connectHeaders: {
|
|
13221
|
+
'x-remits-ws-label': 'remits-cli',
|
|
13222
|
+
'x-remits-ws-scope': headerScope,
|
|
13223
|
+
'x-remits-user-id': headerUserIds.length === 1 ? headerUserIds[0] : '',
|
|
13224
|
+
'x-remits-account-id': headerAccountIds.length === 1 ? headerAccountIds[0] : '',
|
|
13225
|
+
'x-remits-tab-id': 'cli:' + String(process.pid || ''),
|
|
13226
|
+
'x-remits-origin': 'remits-cli://listener',
|
|
13227
|
+
'x-remits-path': 'listener',
|
|
13228
|
+
'x-remits-location': normalizedBaseUrl,
|
|
13229
|
+
'x-remits-broker': webSocketUrl(normalizedBaseUrl)
|
|
13230
|
+
},
|
|
13210
13231
|
debug: () => {},
|
|
13211
13232
|
beforeConnect: () => {
|
|
13212
13233
|
managedClient.lastConnectAttemptAt = Date.now();
|