@corva/chat-core 0.1.4 → 0.1.5
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/dist/index.d.ts +3 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -78,6 +78,7 @@ interface AskCorvaData {
|
|
|
78
78
|
isTruncated?: boolean;
|
|
79
79
|
assetId?: number;
|
|
80
80
|
agentName?: string;
|
|
81
|
+
note?: string;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
type ChatAssetType = 'rig' | 'frac_fleet' | 'intervention_unit';
|
|
@@ -165,6 +166,7 @@ interface AskCorvaWirePayload {
|
|
|
165
166
|
trunc?: boolean;
|
|
166
167
|
assetId?: number;
|
|
167
168
|
agentName?: string;
|
|
169
|
+
n?: string;
|
|
168
170
|
}
|
|
169
171
|
/**
|
|
170
172
|
* One attachment on the wire. Keys are single letters like every other field in these payloads:
|
|
@@ -764,7 +766,7 @@ interface ParsedCorvaMessage {
|
|
|
764
766
|
/**
|
|
765
767
|
* Builds the wire-format content string for an AskCorva response.
|
|
766
768
|
*/
|
|
767
|
-
declare function buildAskCorvaMessageContent(requestId: string, answer: string, answerRef?: string, isTruncated?: boolean, assetId?: number, agentName?: string, companyId?: number): string;
|
|
769
|
+
declare function buildAskCorvaMessageContent(requestId: string, answer: string, answerRef?: string, isTruncated?: boolean, assetId?: number, agentName?: string, companyId?: number, note?: string): string;
|
|
768
770
|
/**
|
|
769
771
|
* Builds the wire-format content string for a forwarded message.
|
|
770
772
|
*/
|
package/dist/index.js
CHANGED
|
@@ -419,7 +419,8 @@ function mapAskCorvaPayload(d) {
|
|
|
419
419
|
companyId: d.cId,
|
|
420
420
|
isTruncated: d.trunc,
|
|
421
421
|
assetId: d.assetId,
|
|
422
|
-
agentName: d.agentName
|
|
422
|
+
agentName: d.agentName,
|
|
423
|
+
note: d.n || void 0
|
|
423
424
|
};
|
|
424
425
|
}
|
|
425
426
|
function mapForwardPayload(d) {
|
|
@@ -450,7 +451,7 @@ function mapAppCommentPayload(d) {
|
|
|
450
451
|
isTruncated: d.trunc
|
|
451
452
|
};
|
|
452
453
|
}
|
|
453
|
-
function buildAskCorvaMessageContent(requestId, answer, answerRef, isTruncated, assetId, agentName, companyId) {
|
|
454
|
+
function buildAskCorvaMessageContent(requestId, answer, answerRef, isTruncated, assetId, agentName, companyId, note) {
|
|
454
455
|
const payload = {
|
|
455
456
|
id: requestId,
|
|
456
457
|
a: answerRef ? "" : answer,
|
|
@@ -458,7 +459,8 @@ function buildAskCorvaMessageContent(requestId, answer, answerRef, isTruncated,
|
|
|
458
459
|
...answerRef && companyId && { cId: companyId },
|
|
459
460
|
...isTruncated && { trunc: true },
|
|
460
461
|
...assetId && { assetId },
|
|
461
|
-
...agentName && { agentName }
|
|
462
|
+
...agentName && { agentName },
|
|
463
|
+
...note?.trim() && { n: note.trim() }
|
|
462
464
|
};
|
|
463
465
|
return `${CORVA_SYS_PREFIX}${JSON.stringify({ t: CORVA_MESSAGE_TYPES.ASK_CORVA, v: 1, d: payload })}`;
|
|
464
466
|
}
|
|
@@ -563,7 +565,7 @@ function enrichWithCorvaData(message) {
|
|
|
563
565
|
if (!parsed) return message;
|
|
564
566
|
return {
|
|
565
567
|
...message,
|
|
566
|
-
msg: parsed.forwardedFrom?.note || "",
|
|
568
|
+
msg: parsed.forwardedFrom?.note || parsed.askCorva?.note || "",
|
|
567
569
|
t: parsed.messageType,
|
|
568
570
|
alert: parsed.alert,
|
|
569
571
|
feedItem: parsed.feedItem,
|