@xmoxmo/bncr 0.2.3 → 0.2.4
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.ts +24 -1
- package/package.json +1 -1
- package/src/channel.ts +1025 -106
- package/src/core/status.ts +10 -10
- package/src/core/types.ts +3 -0
- package/src/messaging/outbound/send.ts +2 -0
package/src/core/status.ts
CHANGED
|
@@ -75,20 +75,12 @@ export function buildIntegratedDiagnostics(input: RuntimeStatusInput): BncrDiagn
|
|
|
75
75
|
export function buildStatusHeadlineFromRuntime(input: RuntimeStatusInput): string {
|
|
76
76
|
const diag = buildIntegratedDiagnostics(input);
|
|
77
77
|
const h = diag.health;
|
|
78
|
-
const r = diag.regression;
|
|
79
|
-
|
|
80
78
|
const parts = [
|
|
81
|
-
|
|
79
|
+
input.connected ? 'linked' : 'status',
|
|
82
80
|
`p:${h.pending}`,
|
|
83
81
|
`d:${h.deadLetter}`,
|
|
84
82
|
`c:${h.activeConnections}`,
|
|
85
83
|
];
|
|
86
|
-
|
|
87
|
-
if (!r.ok) {
|
|
88
|
-
if (r.invalidOutboxSessionKeys > 0) parts.push(`invalid:${r.invalidOutboxSessionKeys}`);
|
|
89
|
-
if (r.legacyAccountResidue > 0) parts.push(`legacy:${r.legacyAccountResidue}`);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
84
|
return parts.join(' ');
|
|
93
85
|
}
|
|
94
86
|
|
|
@@ -128,6 +120,7 @@ export function buildStatusMetaFromRuntime(input: RuntimeStatusInput) {
|
|
|
128
120
|
}
|
|
129
121
|
|
|
130
122
|
export function buildAccountRuntimeSnapshot(input: RuntimeStatusInput) {
|
|
123
|
+
const meta = buildStatusMetaFromRuntime(input);
|
|
131
124
|
return {
|
|
132
125
|
accountId: input.accountId,
|
|
133
126
|
running: input.running ?? true,
|
|
@@ -138,7 +131,14 @@ export function buildAccountRuntimeSnapshot(input: RuntimeStatusInput) {
|
|
|
138
131
|
lastOutboundAt: input.lastOutboundAt || null,
|
|
139
132
|
mode: input.connected ? 'linked' : 'configured',
|
|
140
133
|
lastError: input.lastError ?? null,
|
|
141
|
-
|
|
134
|
+
pending: input.pending,
|
|
135
|
+
deadLetter: input.deadLetter,
|
|
136
|
+
lastSessionKey: input.lastSession?.sessionKey || null,
|
|
137
|
+
lastSessionScope: input.lastSession?.scope || null,
|
|
138
|
+
lastSessionAt: input.lastSession?.updatedAt || null,
|
|
139
|
+
lastActivityAt: input.lastActivityAt || null,
|
|
140
|
+
diagnostics: meta.diagnostics,
|
|
141
|
+
meta,
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
144
|
|
package/src/core/types.ts
CHANGED
|
@@ -49,6 +49,9 @@ export type OutboxEntry = {
|
|
|
49
49
|
lastPushAt?: number;
|
|
50
50
|
lastPushConnId?: string;
|
|
51
51
|
lastPushClientId?: string;
|
|
52
|
+
routeAttemptConnIds?: string[];
|
|
53
|
+
routeAttemptRound?: number;
|
|
54
|
+
fastReroutePending?: boolean;
|
|
52
55
|
};
|
|
53
56
|
|
|
54
57
|
export type BncrDiagnosticsSummary = {
|
|
@@ -51,6 +51,7 @@ export async function sendBncrMedia(params: {
|
|
|
51
51
|
to: string;
|
|
52
52
|
text?: string;
|
|
53
53
|
mediaUrl?: string;
|
|
54
|
+
mediaUrls?: string[];
|
|
54
55
|
asVoice?: boolean;
|
|
55
56
|
audioAsVoice?: boolean;
|
|
56
57
|
replyToId?: string;
|
|
@@ -86,6 +87,7 @@ export async function sendBncrMedia(params: {
|
|
|
86
87
|
payload: {
|
|
87
88
|
text: params.text || '',
|
|
88
89
|
mediaUrl: params.mediaUrl || '',
|
|
90
|
+
mediaUrls: params.mediaUrls?.length ? params.mediaUrls : undefined,
|
|
89
91
|
asVoice: params.asVoice === true ? true : undefined,
|
|
90
92
|
audioAsVoice: params.audioAsVoice === true ? true : undefined,
|
|
91
93
|
replyToId: params.replyToId,
|