@lazyneoaz/metachat 5.1.0 → 5.1.2
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.cjs +4022 -5426
- package/dist/index.d.mts +21 -14
- package/dist/index.d.ts +21 -14
- package/dist/index.mjs +4023 -5424
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1154,7 +1154,7 @@ interface RealtimeHealthState {
|
|
|
1154
1154
|
*/
|
|
1155
1155
|
declare class RealtimeHealth {
|
|
1156
1156
|
private now;
|
|
1157
|
-
private
|
|
1157
|
+
private frameCount;
|
|
1158
1158
|
private lastFrameAt;
|
|
1159
1159
|
private connectedAt;
|
|
1160
1160
|
private probes;
|
|
@@ -1175,15 +1175,19 @@ declare class RealtimeHealth {
|
|
|
1175
1175
|
/** Record an active ping being sent. */
|
|
1176
1176
|
notePing(): void;
|
|
1177
1177
|
sinceLastFrame(): number;
|
|
1178
|
+
/** Total inbound packets observed on this connection generation. */
|
|
1179
|
+
get frames(): number;
|
|
1178
1180
|
/**
|
|
1179
1181
|
* Decide what to do about the current socket.
|
|
1180
1182
|
*
|
|
1181
1183
|
* - `disconnected` — the transport already knows it is down; reconnect.
|
|
1182
|
-
* - `dead` — connected on paper
|
|
1183
|
-
*
|
|
1184
|
-
* - `suspect` — silent past the window but a ping was only just sent; wait.
|
|
1184
|
+
* - `dead` — connected on paper and silent past the window; the supervisor
|
|
1185
|
+
* runs a round-trip probe and recycles it only if the probe fails.
|
|
1185
1186
|
* - `quiet` — silent but inside the window; normal.
|
|
1186
1187
|
* - `healthy` — recent traffic.
|
|
1188
|
+
*
|
|
1189
|
+
* Silence alone is never proof of death: an idle-but-healthy socket is
|
|
1190
|
+
* frame-silent for hours. The probe is what distinguishes the two.
|
|
1187
1191
|
*/
|
|
1188
1192
|
verdict(connected: boolean): RealtimeHealthState["verdict"];
|
|
1189
1193
|
/** A snapshot for diagnostics. */
|
|
@@ -1196,8 +1200,12 @@ interface RealtimeSupervisorOptions {
|
|
|
1196
1200
|
intervalMs?: number;
|
|
1197
1201
|
/** Ask the transport to reconnect (fresh socket) — must be idempotent. */
|
|
1198
1202
|
reconnect: (reason: string) => void;
|
|
1199
|
-
/**
|
|
1200
|
-
|
|
1203
|
+
/**
|
|
1204
|
+
* Active liveness probe. Resolve true only when the broker's reply was
|
|
1205
|
+
* observed (e.g. a PINGRESP or app-level round-trip). Returning true marks
|
|
1206
|
+
* the socket alive; false allows it to be recycled.
|
|
1207
|
+
*/
|
|
1208
|
+
ping?: () => boolean | Promise<boolean>;
|
|
1201
1209
|
/** Whether the transport currently reports connected. */
|
|
1202
1210
|
isConnected: () => boolean;
|
|
1203
1211
|
/** Observe verdict changes (logging). */
|
|
@@ -1216,7 +1224,7 @@ interface RealtimeSupervisorOptions {
|
|
|
1216
1224
|
declare function startRealtimeSupervisor(options: RealtimeSupervisorOptions): {
|
|
1217
1225
|
health: RealtimeHealth;
|
|
1218
1226
|
stop: () => void;
|
|
1219
|
-
checkNow: () => RealtimeHealthState
|
|
1227
|
+
checkNow: () => Promise<RealtimeHealthState>;
|
|
1220
1228
|
};
|
|
1221
1229
|
|
|
1222
1230
|
/** Extract the `CurrentUserInitialData` object from a profile HTML document. */
|
|
@@ -1241,13 +1249,7 @@ interface AcquireResult {
|
|
|
1241
1249
|
/** Number of cookies written into the jar. */
|
|
1242
1250
|
loaded: number;
|
|
1243
1251
|
}
|
|
1244
|
-
|
|
1245
|
-
* Acquire session cookies into `jar`.
|
|
1246
|
-
*
|
|
1247
|
-
* Accepts an appState array, a `;`-joined cookie string, or email+password
|
|
1248
|
-
* credentials. Throws only when *no* usable source was provided — an individual
|
|
1249
|
-
* bad cookie never fails the whole load.
|
|
1250
|
-
*/
|
|
1252
|
+
|
|
1251
1253
|
declare function acquireCookies(jar: any, credentials: LoginCredentials$1, globalOptions: LoginOptions$1): Promise<AcquireResult>;
|
|
1252
1254
|
|
|
1253
1255
|
interface UploadedAttachment {
|
|
@@ -1276,6 +1278,11 @@ declare function normalizeReaction(value: unknown, options?: {
|
|
|
1276
1278
|
/**
|
|
1277
1279
|
* Facebook "non-critical" errors (e.g. 1357004) are retryable and must not be
|
|
1278
1280
|
* treated as auth failures or checkpoints.
|
|
1281
|
+
*
|
|
1282
|
+
* `1357001` ("Facebook blocked the login") and `1357031` (document token
|
|
1283
|
+
* invalid) are deliberately excluded: they mean the session is dead or the
|
|
1284
|
+
* tokens are stale, so retrying the same call hides a real problem instead of
|
|
1285
|
+
* repairing it.
|
|
1279
1286
|
*/
|
|
1280
1287
|
declare function isNonCriticalError(value: any): boolean;
|
|
1281
1288
|
declare function retryOnNonCritical<T = any>(operation: () => Promise<T>, refresh: () => void | Promise<void>): Promise<T>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1154,7 +1154,7 @@ interface RealtimeHealthState {
|
|
|
1154
1154
|
*/
|
|
1155
1155
|
declare class RealtimeHealth {
|
|
1156
1156
|
private now;
|
|
1157
|
-
private
|
|
1157
|
+
private frameCount;
|
|
1158
1158
|
private lastFrameAt;
|
|
1159
1159
|
private connectedAt;
|
|
1160
1160
|
private probes;
|
|
@@ -1175,15 +1175,19 @@ declare class RealtimeHealth {
|
|
|
1175
1175
|
/** Record an active ping being sent. */
|
|
1176
1176
|
notePing(): void;
|
|
1177
1177
|
sinceLastFrame(): number;
|
|
1178
|
+
/** Total inbound packets observed on this connection generation. */
|
|
1179
|
+
get frames(): number;
|
|
1178
1180
|
/**
|
|
1179
1181
|
* Decide what to do about the current socket.
|
|
1180
1182
|
*
|
|
1181
1183
|
* - `disconnected` — the transport already knows it is down; reconnect.
|
|
1182
|
-
* - `dead` — connected on paper
|
|
1183
|
-
*
|
|
1184
|
-
* - `suspect` — silent past the window but a ping was only just sent; wait.
|
|
1184
|
+
* - `dead` — connected on paper and silent past the window; the supervisor
|
|
1185
|
+
* runs a round-trip probe and recycles it only if the probe fails.
|
|
1185
1186
|
* - `quiet` — silent but inside the window; normal.
|
|
1186
1187
|
* - `healthy` — recent traffic.
|
|
1188
|
+
*
|
|
1189
|
+
* Silence alone is never proof of death: an idle-but-healthy socket is
|
|
1190
|
+
* frame-silent for hours. The probe is what distinguishes the two.
|
|
1187
1191
|
*/
|
|
1188
1192
|
verdict(connected: boolean): RealtimeHealthState["verdict"];
|
|
1189
1193
|
/** A snapshot for diagnostics. */
|
|
@@ -1196,8 +1200,12 @@ interface RealtimeSupervisorOptions {
|
|
|
1196
1200
|
intervalMs?: number;
|
|
1197
1201
|
/** Ask the transport to reconnect (fresh socket) — must be idempotent. */
|
|
1198
1202
|
reconnect: (reason: string) => void;
|
|
1199
|
-
/**
|
|
1200
|
-
|
|
1203
|
+
/**
|
|
1204
|
+
* Active liveness probe. Resolve true only when the broker's reply was
|
|
1205
|
+
* observed (e.g. a PINGRESP or app-level round-trip). Returning true marks
|
|
1206
|
+
* the socket alive; false allows it to be recycled.
|
|
1207
|
+
*/
|
|
1208
|
+
ping?: () => boolean | Promise<boolean>;
|
|
1201
1209
|
/** Whether the transport currently reports connected. */
|
|
1202
1210
|
isConnected: () => boolean;
|
|
1203
1211
|
/** Observe verdict changes (logging). */
|
|
@@ -1216,7 +1224,7 @@ interface RealtimeSupervisorOptions {
|
|
|
1216
1224
|
declare function startRealtimeSupervisor(options: RealtimeSupervisorOptions): {
|
|
1217
1225
|
health: RealtimeHealth;
|
|
1218
1226
|
stop: () => void;
|
|
1219
|
-
checkNow: () => RealtimeHealthState
|
|
1227
|
+
checkNow: () => Promise<RealtimeHealthState>;
|
|
1220
1228
|
};
|
|
1221
1229
|
|
|
1222
1230
|
/** Extract the `CurrentUserInitialData` object from a profile HTML document. */
|
|
@@ -1241,13 +1249,7 @@ interface AcquireResult {
|
|
|
1241
1249
|
/** Number of cookies written into the jar. */
|
|
1242
1250
|
loaded: number;
|
|
1243
1251
|
}
|
|
1244
|
-
|
|
1245
|
-
* Acquire session cookies into `jar`.
|
|
1246
|
-
*
|
|
1247
|
-
* Accepts an appState array, a `;`-joined cookie string, or email+password
|
|
1248
|
-
* credentials. Throws only when *no* usable source was provided — an individual
|
|
1249
|
-
* bad cookie never fails the whole load.
|
|
1250
|
-
*/
|
|
1252
|
+
|
|
1251
1253
|
declare function acquireCookies(jar: any, credentials: LoginCredentials$1, globalOptions: LoginOptions$1): Promise<AcquireResult>;
|
|
1252
1254
|
|
|
1253
1255
|
interface UploadedAttachment {
|
|
@@ -1276,6 +1278,11 @@ declare function normalizeReaction(value: unknown, options?: {
|
|
|
1276
1278
|
/**
|
|
1277
1279
|
* Facebook "non-critical" errors (e.g. 1357004) are retryable and must not be
|
|
1278
1280
|
* treated as auth failures or checkpoints.
|
|
1281
|
+
*
|
|
1282
|
+
* `1357001` ("Facebook blocked the login") and `1357031` (document token
|
|
1283
|
+
* invalid) are deliberately excluded: they mean the session is dead or the
|
|
1284
|
+
* tokens are stale, so retrying the same call hides a real problem instead of
|
|
1285
|
+
* repairing it.
|
|
1279
1286
|
*/
|
|
1280
1287
|
declare function isNonCriticalError(value: any): boolean;
|
|
1281
1288
|
declare function retryOnNonCritical<T = any>(operation: () => Promise<T>, refresh: () => void | Promise<void>): Promise<T>;
|