@oxidezap/baileyrs 0.3.3 → 0.3.6
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/README.md +56 -6
- package/lib/Compatibility/history-sync-admission.d.ts +55 -0
- package/lib/Compatibility/history-sync-admission.js +84 -0
- package/lib/Socket/events.js +2 -7
- package/lib/Socket/index.js +9 -1
- package/lib/Socket/unsupported-config.d.ts +2 -2
- package/lib/Socket/unsupported-config.js +3 -2
- package/lib/Types/Socket.d.ts +11 -1
- package/lib/Utils/boom.d.ts +80 -2
- package/lib/Utils/boom.js +165 -1
- package/lib/Utils/logger.d.ts +57 -1
- package/lib/Utils/logger.js +320 -12
- package/lib/Utils/optional-peer.d.ts +20 -0
- package/lib/Utils/optional-peer.js +39 -0
- package/package.json +13 -5
package/README.md
CHANGED
|
@@ -88,6 +88,37 @@ That writes the alias to your `package.json` (with the latest version at install
|
|
|
88
88
|
Every `import { makeWASocket } from '@whiskeysockets/baileys'` in your codebase
|
|
89
89
|
now resolves to baileyrs.
|
|
90
90
|
|
|
91
|
+
### What gets installed
|
|
92
|
+
|
|
93
|
+
`npm install @oxidezap/baileyrs` always brings two runtime dependencies.
|
|
94
|
+
|
|
95
|
+
- `@oxidezap/whatsapp-rust-bridge` is the Rust engine doing the protocol
|
|
96
|
+
work. It is the library, not an add-on, so it stays a hard dependency.
|
|
97
|
+
- `long` stays too. Fields like `messageTimestamp` and `fileLength` are
|
|
98
|
+
`Long` objects in the types, and the package builds real ones at runtime.
|
|
99
|
+
A consumer without it fails compilation in four declaration files and
|
|
100
|
+
fails at import, so there is nothing to save by dropping it. I checked.
|
|
101
|
+
|
|
102
|
+
Everything else is an optional peer. It is used when present and skipped
|
|
103
|
+
when not.
|
|
104
|
+
|
|
105
|
+
| Peer | What it does | Without it |
|
|
106
|
+
| --- | --- | --- |
|
|
107
|
+
| `@hapi/boom` (`^9` or `^10`) | Backs the exported `Boom` errors | A built-in implementation with the same shape |
|
|
108
|
+
| `pino` (`^9` or `^10`) | Backs the default logger | JSON lines on stdout, same redaction |
|
|
109
|
+
| `sharp`, `jimp`, `audio-decode`, `link-preview-js`, `music-metadata` | Media work | Same behavior as before this change |
|
|
110
|
+
|
|
111
|
+
Two setups both work.
|
|
112
|
+
|
|
113
|
+
- Migrating a Baileys project. Your tree already has `@hapi/boom` and
|
|
114
|
+
`pino`, and baileyrs reuses those copies. Error identity is shared, so
|
|
115
|
+
`instanceof` and `isBoom` checks against your own copy keep passing.
|
|
116
|
+
Install nothing, remove nothing.
|
|
117
|
+
- Fresh project. Install only what you touch. The defaults work with zero
|
|
118
|
+
extra dependencies. Add `@hapi/boom` if you compare errors against
|
|
119
|
+
another library's copy, and `pino` if you want transports and
|
|
120
|
+
pretty-printing instead of stdout JSON.
|
|
121
|
+
|
|
91
122
|
### Preview builds
|
|
92
123
|
|
|
93
124
|
Every commit on `main` and every pull request publishes an installable build
|
|
@@ -237,6 +268,24 @@ preserved. No QR re-scan, no logged-out events.
|
|
|
237
268
|
|
|
238
269
|
A few behaviors that differ from upstream — almost always to your advantage:
|
|
239
270
|
|
|
271
|
+
- **History contacts stay on `messaging-history.set`.** During HistorySync,
|
|
272
|
+
read the `contacts` array from that event to hydrate a contact store. baileyrs
|
|
273
|
+
does not re-emit those snapshot entries through `contacts.upsert`, including
|
|
274
|
+
push-name-only syncs. Semantic updates such as `contacts.update` still emit
|
|
275
|
+
normally for inbound push names and contact changes.
|
|
276
|
+
|
|
277
|
+
- **`shouldSyncHistoryMessage` is supported, on a partial notification view.**
|
|
278
|
+
The policy runs before the engine downloads or parses history content and
|
|
279
|
+
receives a decoded `HistorySyncNotification` carrying only that pre-download
|
|
280
|
+
metadata: `syncType`, `chunkOrder`, `progress`, `fileLength` (as `Long`) and
|
|
281
|
+
`peerDataRequestSessionId`. Media and key fields stay absent rather than
|
|
282
|
+
synthesized, and sync types outside the upstream processable set are rejected
|
|
283
|
+
after the callback runs. Returning `false` permanently acknowledges the
|
|
284
|
+
chunk — no retry — so it is not a transient load-shedding hook. Requesting
|
|
285
|
+
full history (`syncFullHistory`) stays engine-owned, and unlike upstream the
|
|
286
|
+
policy is not re-invoked to gate the initial-sync state machine: admission
|
|
287
|
+
covers received notifications only.
|
|
288
|
+
|
|
240
289
|
- **An undecryptable message tells you what it was.** The CIPHERTEXT stub
|
|
241
290
|
emitted on `messages.upsert` for a message that failed to decrypt carries
|
|
242
291
|
`stanzaType`: the envelope's `type` attribute as the server stamped it on the
|
|
@@ -283,8 +332,8 @@ A few behaviors that differ from upstream — almost always to your advantage:
|
|
|
283
332
|
authority — the type system requires each `SocketConfig` member to be
|
|
284
333
|
classified, so it cannot fall behind — and it also covers `keepAliveIntervalMs`,
|
|
285
334
|
`markOnlineOnConnect`, `maxMsgRetryCount`, `msgRetryCounterCache`,
|
|
286
|
-
|
|
287
|
-
|
|
335
|
+
`retryRequestDelayMs`, `fireInitQueries`, `syncFullHistory`,
|
|
336
|
+
`generateHighQualityLinkPreview`,
|
|
288
337
|
`linkPreviewImageThumbnailWidth`, `enableAutoSessionRecreation`,
|
|
289
338
|
`enableRecentMessageCache`, `appStateMacVerification`,
|
|
290
339
|
`patchMessageBeforeSending`, `customUploadHosts`, `countryCode`,
|
|
@@ -304,11 +353,12 @@ A few behaviors that differ from upstream — almost always to your advantage:
|
|
|
304
353
|
of one group can pick the same one, and a handler that keys on it would drop
|
|
305
354
|
the second person's message rather than a duplicate. That is why the engine's
|
|
306
355
|
own check carries the sender too.
|
|
307
|
-
- **`Boom`
|
|
356
|
+
- **`Boom` works with or without `@hapi/boom`.** baileyrs exports a
|
|
308
357
|
`@hapi/boom`-compatible `Boom`, so the existing
|
|
309
|
-
`(err as Boom).output.statusCode` pattern works unchanged.
|
|
310
|
-
|
|
311
|
-
the
|
|
358
|
+
`(err as Boom).output.statusCode` pattern works unchanged. The package is
|
|
359
|
+
an optional peer. With it installed your copy backs the export, without
|
|
360
|
+
it a built-in implementation with the same shape does. See
|
|
361
|
+
[What gets installed](#what-gets-installed).
|
|
312
362
|
- **Audio duration needs the optional `music-metadata` peer.** Upstream
|
|
313
363
|
Baileys bundles it as a hard dependency; here it is optional like the
|
|
314
364
|
other media peers (`sharp`, `jimp`, `audio-decode`, `link-preview-js`).
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { HistorySyncAdmissionMetadata } from '@oxidezap/whatsapp-rust-bridge';
|
|
2
|
+
import type { proto } from '../WAProto/runtime.js';
|
|
3
|
+
export type SocketHistoryPolicy = (message: proto.Message.IHistorySyncNotification) => boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Rebuilds the Baileys notification view from the metadata the bridge can
|
|
6
|
+
* inspect before downloading or parsing history-sync content.
|
|
7
|
+
*
|
|
8
|
+
* Partial view, by design: only `syncType`, `chunkOrder`, `progress`,
|
|
9
|
+
* `fileLength` and `peerDataRequestSessionId` cross the pre-download
|
|
10
|
+
* boundary. Media and key fields (`fileSha256`, `mediaKey`, `fileEncSha256`,
|
|
11
|
+
* `directPath`, `oldestMsgInChunkTimestampSec`,
|
|
12
|
+
* `fullHistorySyncOnDemandRequestMetadata`, `encHandle`, …) stay absent —
|
|
13
|
+
* never synthesized — so a policy filtering on them sees `undefined`, not a
|
|
14
|
+
* fabricated value.
|
|
15
|
+
*
|
|
16
|
+
* Only present fields become own properties: the result is a decoded
|
|
17
|
+
* `HistorySyncNotification` instance, so `Object.keys`, `Object.hasOwn` and
|
|
18
|
+
* `instanceof` match what Baileys hands its own policy.
|
|
19
|
+
*/
|
|
20
|
+
export declare const historySyncNotificationFromMetadata: (metadata: HistorySyncAdmissionMetadata) => proto.Message.IHistorySyncNotification;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the configured policy, falling back to the default when the caller
|
|
23
|
+
* spread an explicit `undefined` over it. Without this the shallow config
|
|
24
|
+
* merge would replace the default with `undefined` and the first history
|
|
25
|
+
* notification would die as a callback `TypeError` — rejected and permanently
|
|
26
|
+
* acknowledged by the bridge.
|
|
27
|
+
*/
|
|
28
|
+
export declare const resolveHistorySyncPolicy: (configured: SocketHistoryPolicy | undefined) => SocketHistoryPolicy;
|
|
29
|
+
/**
|
|
30
|
+
* Probe whether the policy rejects every upstream-processable sync type.
|
|
31
|
+
* Mirrors the upstream socket-construction check, including its call pattern:
|
|
32
|
+
* the policy runs once per processable type against a synthetic
|
|
33
|
+
* `{ syncType }` notification. Disabling everything also drops the initial
|
|
34
|
+
* LID mappings, which destabilizes sessions — hence the warning at the call
|
|
35
|
+
* site.
|
|
36
|
+
*
|
|
37
|
+
* One deliberate deviation: a probe call that throws is treated as
|
|
38
|
+
* potentially enabling rather than propagating. The probe is diagnostic-only,
|
|
39
|
+
* and a socket must never fail to build over a diagnostic — upstream lets
|
|
40
|
+
* that throw out of construction. Stateful policies still observe these
|
|
41
|
+
* calls, exactly as they do upstream.
|
|
42
|
+
*/
|
|
43
|
+
export declare const isHistorySyncFullyDisabled: (shouldSyncHistoryMessage: SocketHistoryPolicy) => boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Adapt the Baileys history policy to the bridge's pre-download policy.
|
|
46
|
+
*
|
|
47
|
+
* Order matches upstream: the callback runs first, then the processable-type
|
|
48
|
+
* gate. Unknown or absent `syncType` values are therefore rejected even when
|
|
49
|
+
* the callback accepts them, because the core enqueues whatever this policy
|
|
50
|
+
* admits with no further type filtering.
|
|
51
|
+
*/
|
|
52
|
+
export declare const makeHistorySyncAdmission: (shouldSyncHistoryMessage: SocketHistoryPolicy) => {
|
|
53
|
+
historySyncAdmission: (metadata: HistorySyncAdmissionMetadata) => boolean;
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=history-sync-admission.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import Long from 'long';
|
|
2
|
+
import { DEFAULT_CONNECTION_CONFIG, PROCESSABLE_HISTORY_TYPES } from '../Defaults/index.js';
|
|
3
|
+
import { proto as protoRuntime } from '../WAProto/runtime.js';
|
|
4
|
+
/**
|
|
5
|
+
* Rebuilds the Baileys notification view from the metadata the bridge can
|
|
6
|
+
* inspect before downloading or parsing history-sync content.
|
|
7
|
+
*
|
|
8
|
+
* Partial view, by design: only `syncType`, `chunkOrder`, `progress`,
|
|
9
|
+
* `fileLength` and `peerDataRequestSessionId` cross the pre-download
|
|
10
|
+
* boundary. Media and key fields (`fileSha256`, `mediaKey`, `fileEncSha256`,
|
|
11
|
+
* `directPath`, `oldestMsgInChunkTimestampSec`,
|
|
12
|
+
* `fullHistorySyncOnDemandRequestMetadata`, `encHandle`, …) stay absent —
|
|
13
|
+
* never synthesized — so a policy filtering on them sees `undefined`, not a
|
|
14
|
+
* fabricated value.
|
|
15
|
+
*
|
|
16
|
+
* Only present fields become own properties: the result is a decoded
|
|
17
|
+
* `HistorySyncNotification` instance, so `Object.keys`, `Object.hasOwn` and
|
|
18
|
+
* `instanceof` match what Baileys hands its own policy.
|
|
19
|
+
*/
|
|
20
|
+
export const historySyncNotificationFromMetadata = (metadata) => {
|
|
21
|
+
const fields = {};
|
|
22
|
+
if (metadata.syncType !== undefined) {
|
|
23
|
+
fields.syncType = metadata.syncType;
|
|
24
|
+
}
|
|
25
|
+
if (metadata.chunkOrder !== undefined) {
|
|
26
|
+
fields.chunkOrder = metadata.chunkOrder;
|
|
27
|
+
}
|
|
28
|
+
if (metadata.progress !== undefined) {
|
|
29
|
+
fields.progress = metadata.progress;
|
|
30
|
+
}
|
|
31
|
+
if (metadata.fileLength !== undefined) {
|
|
32
|
+
fields.fileLength = Long.fromString(metadata.fileLength, true);
|
|
33
|
+
}
|
|
34
|
+
if (metadata.peerDataRequestSessionId !== undefined) {
|
|
35
|
+
fields.peerDataRequestSessionId = metadata.peerDataRequestSessionId;
|
|
36
|
+
}
|
|
37
|
+
return protoRuntime.Message.HistorySyncNotification.create(fields);
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Resolve the configured policy, falling back to the default when the caller
|
|
41
|
+
* spread an explicit `undefined` over it. Without this the shallow config
|
|
42
|
+
* merge would replace the default with `undefined` and the first history
|
|
43
|
+
* notification would die as a callback `TypeError` — rejected and permanently
|
|
44
|
+
* acknowledged by the bridge.
|
|
45
|
+
*/
|
|
46
|
+
export const resolveHistorySyncPolicy = (configured) => configured ?? DEFAULT_CONNECTION_CONFIG.shouldSyncHistoryMessage;
|
|
47
|
+
/**
|
|
48
|
+
* Probe whether the policy rejects every upstream-processable sync type.
|
|
49
|
+
* Mirrors the upstream socket-construction check, including its call pattern:
|
|
50
|
+
* the policy runs once per processable type against a synthetic
|
|
51
|
+
* `{ syncType }` notification. Disabling everything also drops the initial
|
|
52
|
+
* LID mappings, which destabilizes sessions — hence the warning at the call
|
|
53
|
+
* site.
|
|
54
|
+
*
|
|
55
|
+
* One deliberate deviation: a probe call that throws is treated as
|
|
56
|
+
* potentially enabling rather than propagating. The probe is diagnostic-only,
|
|
57
|
+
* and a socket must never fail to build over a diagnostic — upstream lets
|
|
58
|
+
* that throw out of construction. Stateful policies still observe these
|
|
59
|
+
* calls, exactly as they do upstream.
|
|
60
|
+
*/
|
|
61
|
+
export const isHistorySyncFullyDisabled = (shouldSyncHistoryMessage) => PROCESSABLE_HISTORY_TYPES.every(syncType => {
|
|
62
|
+
try {
|
|
63
|
+
return shouldSyncHistoryMessage({ syncType }) === false;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* Adapt the Baileys history policy to the bridge's pre-download policy.
|
|
71
|
+
*
|
|
72
|
+
* Order matches upstream: the callback runs first, then the processable-type
|
|
73
|
+
* gate. Unknown or absent `syncType` values are therefore rejected even when
|
|
74
|
+
* the callback accepts them, because the core enqueues whatever this policy
|
|
75
|
+
* admits with no further type filtering.
|
|
76
|
+
*/
|
|
77
|
+
export const makeHistorySyncAdmission = (shouldSyncHistoryMessage) => ({
|
|
78
|
+
historySyncAdmission: metadata => {
|
|
79
|
+
const notification = historySyncNotificationFromMetadata(metadata);
|
|
80
|
+
const accepted = shouldSyncHistoryMessage(notification);
|
|
81
|
+
return accepted && PROCESSABLE_HISTORY_TYPES.includes(notification.syncType);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=history-sync-admission.js.map
|
package/lib/Socket/events.js
CHANGED
|
@@ -866,15 +866,10 @@ const DISPATCHERS = {
|
|
|
866
866
|
lidPnMappings: evt.lidPnMappings.length > 0 ? evt.lidPnMappings : undefined
|
|
867
867
|
};
|
|
868
868
|
ctx.ev.emit('messaging-history.set', payload);
|
|
869
|
-
//
|
|
870
|
-
//
|
|
871
|
-
// get hydrated. Upstream emits both channels from different code
|
|
872
|
-
// paths; we collapse them here so consumers picking either pattern
|
|
873
|
-
// see the same data on the first pair.
|
|
869
|
+
// Keep the chat hydration fan-out for compatibility. Contacts are part
|
|
870
|
+
// of the history snapshot and must not be re-emitted as mutations.
|
|
874
871
|
if (evt.chats.length > 0)
|
|
875
872
|
ctx.ev.emit('chats.upsert', evt.chats);
|
|
876
|
-
if (evt.contacts.length > 0)
|
|
877
|
-
ctx.ev.emit('contacts.upsert', evt.contacts);
|
|
878
873
|
}
|
|
879
874
|
};
|
|
880
875
|
const dispatchCanonicalEvent = (canonical, dispatchCtx) => {
|
package/lib/Socket/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import { Boom } from '../Utils/boom.js';
|
|
|
20
20
|
import { makeEventBuffer } from '../Utils/event-buffer.js';
|
|
21
21
|
import { _registerActiveBridgeClient, _unregisterActiveBridgeClient, downloadMediaMessage, MEDIA_DOWNLOAD_TYPES } from '../Utils/messages.js';
|
|
22
22
|
import { makeNativeCryptoProvider } from '../Utils/native-crypto-provider.js';
|
|
23
|
+
import { makeHistorySyncAdmission, resolveHistorySyncPolicy, isHistorySyncFullyDisabled } from '../Compatibility/history-sync-admission.js';
|
|
23
24
|
import { wrapLegacyStore } from '../Utils/wrap-legacy-store.js';
|
|
24
25
|
import { assertNodeErrorFree } from '../WABinary/generic-utils.js';
|
|
25
26
|
import { makeBlockingMethods } from './blocking.js';
|
|
@@ -104,6 +105,13 @@ const makeWASocket = (config) => {
|
|
|
104
105
|
// is worth naming. Merging the defaults first would report every unsupported
|
|
105
106
|
// option on every socket, including the ones nobody chose.
|
|
106
107
|
warnUnsupportedConfig(config, logger);
|
|
108
|
+
// `Partial<SocketConfig>` lets an explicit `undefined` overwrite the default
|
|
109
|
+
// in the shallow merge above; resolve against the raw config so the socket
|
|
110
|
+
// keeps the default policy instead of throwing on the first notification.
|
|
111
|
+
const shouldSyncHistoryMessage = resolveHistorySyncPolicy(config.shouldSyncHistoryMessage);
|
|
112
|
+
if (isHistorySyncFullyDisabled(shouldSyncHistoryMessage)) {
|
|
113
|
+
logger.warn('⚠️ DANGER: DISABLING ALL SYNC BY shouldSyncHistoryMsg PREVENTS BAILEYS FROM ACCESSING INITIAL LID MAPPINGS, LEADING TO INSTABILIY AND SESSION ERRORS');
|
|
114
|
+
}
|
|
107
115
|
const auth = normalizeSocketAuthenticationState(fullConfig.auth);
|
|
108
116
|
const getExposedKeys = makeLazyTransactionKeyStore(auth.keys, logger, fullConfig.transactionOpts);
|
|
109
117
|
const ev = makeEventBuffer(logger);
|
|
@@ -492,7 +500,7 @@ const makeWASocket = (config) => {
|
|
|
492
500
|
// other truthy value at construction, so a `!!`/ternary-style
|
|
493
501
|
// coercion could promote a malformed opt-out into an opt-in.
|
|
494
502
|
// Absent stays strict.
|
|
495
|
-
fullConfig.dangerSkipCertChainVerify);
|
|
503
|
+
fullConfig.dangerSkipCertChainVerify, makeHistorySyncAdmission(shouldSyncHistoryMessage));
|
|
496
504
|
// `end()` can land while the client is still being built — a `sock.end()`
|
|
497
505
|
// or `await using` right after `makeWASocket()` does exactly that. When
|
|
498
506
|
// it has, `adopt` frees this client and tells us to stop: nothing else
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* a type would look supported. A test anchors every entry to `SocketConfig`, so
|
|
25
25
|
* an option that starts being read here fails the audit for whoever removes it.
|
|
26
26
|
*/
|
|
27
|
-
export declare const UNSUPPORTED_CONFIG_KEYS: readonly ["keepAliveIntervalMs", "maxMsgRetryCount", "msgRetryCounterCache", "retryRequestDelayMs", "fireInitQueries", "markOnlineOnConnect", "syncFullHistory", "
|
|
27
|
+
export declare const UNSUPPORTED_CONFIG_KEYS: readonly ["keepAliveIntervalMs", "maxMsgRetryCount", "msgRetryCounterCache", "retryRequestDelayMs", "fireInitQueries", "markOnlineOnConnect", "syncFullHistory", "generateHighQualityLinkPreview", "linkPreviewImageThumbnailWidth", "enableAutoSessionRecreation", "enableRecentMessageCache", "appStateMacVerification", "cachedGroupMetadata", "getMessage", "patchMessageBeforeSending", "customUploadHosts", "countryCode", "connectTimeoutMs", "qrTimeout", "agent", "fetchAgent", "mobile", "printQRInTerminal", "ignoreOfflineMessages", "downloadHistory", "mediaCache", "userDevicesCache", "callOfferCache", "placeholderResendCache"];
|
|
28
28
|
/**
|
|
29
29
|
* The other half: options something on this side actually reads.
|
|
30
30
|
*
|
|
@@ -33,7 +33,7 @@ export declare const UNSUPPORTED_CONFIG_KEYS: readonly ["keepAliveIntervalMs", "
|
|
|
33
33
|
* member of `SocketConfig` belongs to neither list — which is exactly how the
|
|
34
34
|
* first version of the catalog shipped twelve keys short.
|
|
35
35
|
*/
|
|
36
|
-
export declare const READ_CONFIG_KEYS: readonly ["waWebSocketUrl", "options", "logger", "version", "browser", "pushName", "auth", "cache", "deviceProps", "wantedPreKeyCount", "dangerSkipCertChainVerify", "emitOwnEvents", "shouldIgnoreJid", "defaultQueryTimeoutMs", "transactionOpts", "makeSignalRepository"];
|
|
36
|
+
export declare const READ_CONFIG_KEYS: readonly ["waWebSocketUrl", "options", "logger", "version", "browser", "pushName", "auth", "cache", "deviceProps", "wantedPreKeyCount", "dangerSkipCertChainVerify", "shouldSyncHistoryMessage", "emitOwnEvents", "shouldIgnoreJid", "defaultQueryTimeoutMs", "transactionOpts", "makeSignalRepository"];
|
|
37
37
|
/**
|
|
38
38
|
* Which unsupported options this caller actually passed.
|
|
39
39
|
*
|
|
@@ -37,9 +37,9 @@ export const UNSUPPORTED_CONFIG_KEYS = [
|
|
|
37
37
|
'fireInitQueries',
|
|
38
38
|
// Presence is explicit here: call `sendPresenceUpdate` after `open`.
|
|
39
39
|
'markOnlineOnConnect',
|
|
40
|
-
//
|
|
40
|
+
// Full-history requests are driven by the engine. The per-notification
|
|
41
|
+
// admission policy is translated by Socket/index.ts.
|
|
41
42
|
'syncFullHistory',
|
|
42
|
-
'shouldSyncHistoryMessage',
|
|
43
43
|
// Link previews are not generated on this side.
|
|
44
44
|
'generateHighQualityLinkPreview',
|
|
45
45
|
'linkPreviewImageThumbnailWidth',
|
|
@@ -99,6 +99,7 @@ export const READ_CONFIG_KEYS = [
|
|
|
99
99
|
'deviceProps',
|
|
100
100
|
'wantedPreKeyCount',
|
|
101
101
|
'dangerSkipCertChainVerify',
|
|
102
|
+
'shouldSyncHistoryMessage',
|
|
102
103
|
'emitOwnEvents',
|
|
103
104
|
'shouldIgnoreJid',
|
|
104
105
|
'defaultQueryTimeoutMs',
|
package/lib/Types/Socket.d.ts
CHANGED
|
@@ -130,7 +130,17 @@ export type SocketConfig = {
|
|
|
130
130
|
countryCode: string;
|
|
131
131
|
/** @deprecated History download policy lives in the bridge. */
|
|
132
132
|
downloadHistory?: boolean;
|
|
133
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* Decide whether a history notification should be processed.
|
|
135
|
+
*
|
|
136
|
+
* Partial notification view: the callback receives a decoded
|
|
137
|
+
* `HistorySyncNotification` carrying only pre-download metadata
|
|
138
|
+
* (`syncType`, `chunkOrder`, `progress`, `fileLength` as `Long`,
|
|
139
|
+
* `peerDataRequestSessionId`). Media and key fields stay absent rather
|
|
140
|
+
* than synthesized, and types outside the upstream processable set are
|
|
141
|
+
* rejected after the callback runs. `false` permanently acknowledges the
|
|
142
|
+
* chunk — no retry — so this is not a transient load-shedding hook.
|
|
143
|
+
*/
|
|
134
144
|
shouldSyncHistoryMessage: (msg: proto.Message.IHistorySyncNotification) => boolean;
|
|
135
145
|
/** @deprecated QR rendering is the caller's responsibility — listen on `connection.update` for the QR string. */
|
|
136
146
|
printQRInTerminal?: boolean;
|
package/lib/Utils/boom.d.ts
CHANGED
|
@@ -3,7 +3,85 @@
|
|
|
3
3
|
* making `lastDisconnect.error` and `messages.media-update.error` exactly
|
|
4
4
|
* assignable, this preserves the full Boom runtime contract (`reformat`,
|
|
5
5
|
* `typeof`, mutable output headers and standard payload handling).
|
|
6
|
+
*
|
|
7
|
+
* `@hapi/boom` is an optional peer: when the consumer has it installed the
|
|
8
|
+
* real implementation backs the export, so `instanceof` identity is shared
|
|
9
|
+
* with the rest of their tree. Otherwise a local implementation with the
|
|
10
|
+
* same observable behavior backs it, so a fresh install works without
|
|
11
|
+
* adding the dependency.
|
|
6
12
|
*/
|
|
7
|
-
|
|
8
|
-
export
|
|
13
|
+
/** Extra error data carried beside the formatted response. */
|
|
14
|
+
export interface BoomOptions<Data = any> {
|
|
15
|
+
/** The HTTP status code. Must be 400 or above. @default 500 */
|
|
16
|
+
statusCode?: number;
|
|
17
|
+
/** Additional error information. @default null */
|
|
18
|
+
data?: Data;
|
|
19
|
+
/** Constructor reference used to crop the exception call stack output. */
|
|
20
|
+
ctor?: Function;
|
|
21
|
+
/** Replacement message applied on top of an existing error. */
|
|
22
|
+
message?: string;
|
|
23
|
+
/**
|
|
24
|
+
* When the input is already a Boom error and a statusCode or message is
|
|
25
|
+
* provided, apply them. Pass false to leave the error untouched.
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
override?: boolean;
|
|
29
|
+
/** Extra properties assigned onto the error object. */
|
|
30
|
+
decorate?: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
/** The formatted object used as the response payload. */
|
|
33
|
+
export interface BoomPayload {
|
|
34
|
+
/** The HTTP status code derived from error.output.statusCode. */
|
|
35
|
+
statusCode: number;
|
|
36
|
+
/** The HTTP status message derived from statusCode. */
|
|
37
|
+
error: string;
|
|
38
|
+
/** The error message derived from error.message. */
|
|
39
|
+
message: string;
|
|
40
|
+
/** Custom properties. */
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
}
|
|
43
|
+
/** The formatted response carried on every Boom error. */
|
|
44
|
+
export interface BoomOutput {
|
|
45
|
+
/** The HTTP status code. */
|
|
46
|
+
statusCode: number;
|
|
47
|
+
/** HTTP headers, each key a header name. Mutable by design. */
|
|
48
|
+
headers: {
|
|
49
|
+
[header: string]: string | string[] | number | undefined;
|
|
50
|
+
};
|
|
51
|
+
/** The formatted object used as the response payload. */
|
|
52
|
+
payload: BoomPayload;
|
|
53
|
+
}
|
|
54
|
+
/** A Boom error instance. */
|
|
55
|
+
export interface Boom<Data = any> extends Error {
|
|
56
|
+
/** Custom error data. Null unless the caller passed `data`. */
|
|
57
|
+
data?: Data | null;
|
|
58
|
+
/** Always true on a Boom error. Checked by {@link isBoom}. */
|
|
59
|
+
isBoom: boolean;
|
|
60
|
+
/** True when the status code is 500 or above. */
|
|
61
|
+
isServer: boolean;
|
|
62
|
+
/** The formatted response. */
|
|
63
|
+
output: BoomOutput;
|
|
64
|
+
/** The constructor used to create the error. */
|
|
65
|
+
typeof: Function;
|
|
66
|
+
/**
|
|
67
|
+
* Rebuild the payload from the current status code and message.
|
|
68
|
+
* Returns the formatted message, matching the peer's declaration.
|
|
69
|
+
*/
|
|
70
|
+
reformat(debug?: boolean): string;
|
|
71
|
+
}
|
|
72
|
+
/** The shared constructor behind the {@link Boom} export. */
|
|
73
|
+
export interface BoomConstructor {
|
|
74
|
+
new <Data = any>(message?: string | Error, options?: BoomOptions<Data>): Boom<Data>;
|
|
75
|
+
readonly prototype: Boom<unknown>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The shared error implementation. The peer's copy when installed, so error
|
|
79
|
+
* identity is shared with the rest of the consumer's tree, else the local
|
|
80
|
+
* implementation above.
|
|
81
|
+
*/
|
|
82
|
+
export declare const Boom: BoomConstructor;
|
|
83
|
+
/** Decorate an existing error with the Boom response shape. */
|
|
84
|
+
export declare const boomify: (error: Error, options?: BoomOptions) => Boom;
|
|
85
|
+
/** Whether a value is a Boom error, optionally with an exact status code. */
|
|
86
|
+
export declare const isBoom: (obj: unknown, statusCode?: number) => obj is Boom;
|
|
9
87
|
//# sourceMappingURL=boom.d.ts.map
|
package/lib/Utils/boom.js
CHANGED
|
@@ -3,6 +3,170 @@
|
|
|
3
3
|
* making `lastDisconnect.error` and `messages.media-update.error` exactly
|
|
4
4
|
* assignable, this preserves the full Boom runtime contract (`reformat`,
|
|
5
5
|
* `typeof`, mutable output headers and standard payload handling).
|
|
6
|
+
*
|
|
7
|
+
* `@hapi/boom` is an optional peer: when the consumer has it installed the
|
|
8
|
+
* real implementation backs the export, so `instanceof` identity is shared
|
|
9
|
+
* with the rest of their tree. Otherwise a local implementation with the
|
|
10
|
+
* same observable behavior backs it, so a fresh install works without
|
|
11
|
+
* adding the dependency.
|
|
6
12
|
*/
|
|
7
|
-
|
|
13
|
+
import { loadOptionalPeer } from './optional-peer.js';
|
|
14
|
+
/** Reason phrases per status code, matching the peer's table. */
|
|
15
|
+
const STATUS_MESSAGES = new Map([
|
|
16
|
+
[100, 'Continue'],
|
|
17
|
+
[101, 'Switching Protocols'],
|
|
18
|
+
[102, 'Processing'],
|
|
19
|
+
[200, 'OK'],
|
|
20
|
+
[201, 'Created'],
|
|
21
|
+
[202, 'Accepted'],
|
|
22
|
+
[203, 'Non-Authoritative Information'],
|
|
23
|
+
[204, 'No Content'],
|
|
24
|
+
[205, 'Reset Content'],
|
|
25
|
+
[206, 'Partial Content'],
|
|
26
|
+
[207, 'Multi-Status'],
|
|
27
|
+
[300, 'Multiple Choices'],
|
|
28
|
+
[301, 'Moved Permanently'],
|
|
29
|
+
[302, 'Moved Temporarily'],
|
|
30
|
+
[303, 'See Other'],
|
|
31
|
+
[304, 'Not Modified'],
|
|
32
|
+
[305, 'Use Proxy'],
|
|
33
|
+
[307, 'Temporary Redirect'],
|
|
34
|
+
[400, 'Bad Request'],
|
|
35
|
+
[401, 'Unauthorized'],
|
|
36
|
+
[402, 'Payment Required'],
|
|
37
|
+
[403, 'Forbidden'],
|
|
38
|
+
[404, 'Not Found'],
|
|
39
|
+
[405, 'Method Not Allowed'],
|
|
40
|
+
[406, 'Not Acceptable'],
|
|
41
|
+
[407, 'Proxy Authentication Required'],
|
|
42
|
+
[408, 'Request Time-out'],
|
|
43
|
+
[409, 'Conflict'],
|
|
44
|
+
[410, 'Gone'],
|
|
45
|
+
[411, 'Length Required'],
|
|
46
|
+
[412, 'Precondition Failed'],
|
|
47
|
+
[413, 'Request Entity Too Large'],
|
|
48
|
+
[414, 'Request-URI Too Large'],
|
|
49
|
+
[415, 'Unsupported Media Type'],
|
|
50
|
+
[416, 'Requested Range Not Satisfiable'],
|
|
51
|
+
[417, 'Expectation Failed'],
|
|
52
|
+
[418, "I'm a teapot"],
|
|
53
|
+
[422, 'Unprocessable Entity'],
|
|
54
|
+
[423, 'Locked'],
|
|
55
|
+
[424, 'Failed Dependency'],
|
|
56
|
+
[425, 'Too Early'],
|
|
57
|
+
[426, 'Upgrade Required'],
|
|
58
|
+
[428, 'Precondition Required'],
|
|
59
|
+
[429, 'Too Many Requests'],
|
|
60
|
+
[431, 'Request Header Fields Too Large'],
|
|
61
|
+
[451, 'Unavailable For Legal Reasons'],
|
|
62
|
+
[500, 'Internal Server Error'],
|
|
63
|
+
[501, 'Not Implemented'],
|
|
64
|
+
[502, 'Bad Gateway'],
|
|
65
|
+
[503, 'Service Unavailable'],
|
|
66
|
+
[504, 'Gateway Time-out'],
|
|
67
|
+
[505, 'HTTP Version Not Supported'],
|
|
68
|
+
[506, 'Variant Also Negotiates'],
|
|
69
|
+
[507, 'Insufficient Storage'],
|
|
70
|
+
[509, 'Bandwidth Limit Exceeded'],
|
|
71
|
+
[510, 'Not Extended'],
|
|
72
|
+
[511, 'Network Authentication Required']
|
|
73
|
+
]);
|
|
74
|
+
const reformatBoom = function (debug = false) {
|
|
75
|
+
this.output.payload.statusCode = this.output.statusCode;
|
|
76
|
+
this.output.payload.error = STATUS_MESSAGES.get(this.output.statusCode) || 'Unknown';
|
|
77
|
+
if (this.output.statusCode === 500 && debug !== true) {
|
|
78
|
+
this.output.payload.message = 'An internal server error occurred';
|
|
79
|
+
}
|
|
80
|
+
else if (this.message) {
|
|
81
|
+
this.output.payload.message = this.message;
|
|
82
|
+
}
|
|
83
|
+
return this.output.payload.message;
|
|
84
|
+
};
|
|
85
|
+
const initializeBoom = (error, statusCode, message) => {
|
|
86
|
+
const code = Number.parseInt(String(statusCode), 10);
|
|
87
|
+
if (Number.isNaN(code) || code < 400) {
|
|
88
|
+
throw new Error(`First argument must be a number (400+): ${String(statusCode)}`);
|
|
89
|
+
}
|
|
90
|
+
error.isBoom = true;
|
|
91
|
+
error.isServer = code >= 500;
|
|
92
|
+
if (!Object.hasOwn(error, 'data'))
|
|
93
|
+
error.data = null;
|
|
94
|
+
error.output = { statusCode: code, payload: {}, headers: {} };
|
|
95
|
+
Object.defineProperty(error, 'reformat', { value: reformatBoom, configurable: true });
|
|
96
|
+
if (!message && !error.message) {
|
|
97
|
+
error.reformat();
|
|
98
|
+
message = error.output.payload.error;
|
|
99
|
+
}
|
|
100
|
+
if (message) {
|
|
101
|
+
error.message = message + (error.message ? `: ${error.message}` : '');
|
|
102
|
+
error.output.payload.message = error.message;
|
|
103
|
+
}
|
|
104
|
+
error.reformat();
|
|
105
|
+
return error;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Local stand-in used only when `@hapi/boom` is not installed. Reproduces
|
|
109
|
+
* the observable contract the rest of the package relies on: `output` with
|
|
110
|
+
* status code, payload and mutable headers, `data`, `isServer`, `reformat`,
|
|
111
|
+
* `typeof`, sanitized 500 messages, and `instanceof` recognition through
|
|
112
|
+
* `Symbol.hasInstance`.
|
|
113
|
+
*/
|
|
114
|
+
class FallbackBoom extends Error {
|
|
115
|
+
constructor(messageOrError, options = {}) {
|
|
116
|
+
if (messageOrError instanceof Error) {
|
|
117
|
+
// Own properties are copied, the prototype is kept: a custom
|
|
118
|
+
// Error subclass still answers `instanceof` after wrapping,
|
|
119
|
+
// exactly like the peer's clone. Boom recognition does not need
|
|
120
|
+
// the fallback prototype, it goes through `isBoom`.
|
|
121
|
+
const copy = Object.create(Object.getPrototypeOf(messageOrError), Object.getOwnPropertyDescriptors(messageOrError));
|
|
122
|
+
return boomifyFallback(copy, options);
|
|
123
|
+
}
|
|
124
|
+
const { statusCode = 500, data = null, ctor = FallbackBoom } = options;
|
|
125
|
+
super(messageOrError ?? undefined);
|
|
126
|
+
this.isBoom = true;
|
|
127
|
+
this.isServer = true;
|
|
128
|
+
if (typeof Error.captureStackTrace === 'function')
|
|
129
|
+
Error.captureStackTrace(this, ctor);
|
|
130
|
+
this.data = (data ?? null);
|
|
131
|
+
const initialized = initializeBoom(this, statusCode);
|
|
132
|
+
Object.defineProperty(initialized, 'typeof', { value: ctor });
|
|
133
|
+
if (options.decorate)
|
|
134
|
+
Object.assign(initialized, options.decorate);
|
|
135
|
+
return initialized;
|
|
136
|
+
}
|
|
137
|
+
static [Symbol.hasInstance](instance) {
|
|
138
|
+
return isBoomFallback(instance);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/** Local `isBoom`: an Error carrying the Boom marker, nothing looser. */
|
|
142
|
+
const isBoomFallback = (obj, statusCode) => obj instanceof Error &&
|
|
143
|
+
obj.isBoom === true &&
|
|
144
|
+
(statusCode === undefined || obj.output?.statusCode === statusCode);
|
|
145
|
+
/** Local `boomify`: decorate an existing error in place. */
|
|
146
|
+
const boomifyFallback = (error, options = {}) => {
|
|
147
|
+
if (!(error instanceof Error))
|
|
148
|
+
throw new Error('Cannot wrap non-Error object');
|
|
149
|
+
const boom = error;
|
|
150
|
+
if (options.data !== undefined)
|
|
151
|
+
boom.data = options.data;
|
|
152
|
+
if (options.decorate)
|
|
153
|
+
Object.assign(boom, options.decorate);
|
|
154
|
+
if (!boom.isBoom)
|
|
155
|
+
return initializeBoom(boom, options.statusCode ?? 500, options.message);
|
|
156
|
+
if (options.override === false || (!options.statusCode && !options.message))
|
|
157
|
+
return boom;
|
|
158
|
+
return initializeBoom(boom, options.statusCode ?? boom.output.statusCode, options.message);
|
|
159
|
+
};
|
|
160
|
+
const loadBoomPeer = () => loadOptionalPeer('@hapi/boom');
|
|
161
|
+
const peer = loadBoomPeer();
|
|
162
|
+
/**
|
|
163
|
+
* The shared error implementation. The peer's copy when installed, so error
|
|
164
|
+
* identity is shared with the rest of the consumer's tree, else the local
|
|
165
|
+
* implementation above.
|
|
166
|
+
*/
|
|
167
|
+
export const Boom = (peer?.Boom ?? FallbackBoom);
|
|
168
|
+
/** Decorate an existing error with the Boom response shape. */
|
|
169
|
+
export const boomify = peer?.boomify ?? boomifyFallback;
|
|
170
|
+
/** Whether a value is a Boom error, optionally with an exact status code. */
|
|
171
|
+
export const isBoom = peer?.isBoom ?? isBoomFallback;
|
|
8
172
|
//# sourceMappingURL=boom.js.map
|
package/lib/Utils/logger.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Logger } from 'pino';
|
|
2
1
|
export interface ILogger {
|
|
3
2
|
level: string;
|
|
4
3
|
child(obj: Record<string, unknown>): ILogger;
|
|
@@ -8,6 +7,63 @@ export interface ILogger {
|
|
|
8
7
|
warn(obj: unknown, msg?: string): void;
|
|
9
8
|
error(obj: unknown, msg?: string): void;
|
|
10
9
|
}
|
|
10
|
+
/** Options accepted by `child()`. The fallback honors `level` and `msgPrefix`;
|
|
11
|
+
* anything else is accepted for signature compatibility and ignored there. */
|
|
12
|
+
export interface ChildLoggerOptions {
|
|
13
|
+
level?: string;
|
|
14
|
+
msgPrefix?: string;
|
|
15
|
+
[option: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The full logger surface behind the default export. Structural so both the
|
|
19
|
+
* peer logger and the local fallback satisfy it; deliberately free of any
|
|
20
|
+
* `pino` import so consumers typecheck with or without the peer installed.
|
|
21
|
+
*/
|
|
22
|
+
export interface Logger {
|
|
23
|
+
level: string;
|
|
24
|
+
child(bindings: Record<string, unknown>, options?: ChildLoggerOptions): Logger;
|
|
25
|
+
trace(...args: unknown[]): void;
|
|
26
|
+
debug(...args: unknown[]): void;
|
|
27
|
+
info(...args: unknown[]): void;
|
|
28
|
+
warn(...args: unknown[]): void;
|
|
29
|
+
error(...args: unknown[]): void;
|
|
30
|
+
fatal(...args: unknown[]): void;
|
|
31
|
+
silent(...args: unknown[]): void;
|
|
32
|
+
flush(callback?: () => void): void;
|
|
33
|
+
bindings(): Record<string, unknown>;
|
|
34
|
+
/** Replace the bindings carried on every line from here on. */
|
|
35
|
+
setBindings(bindings: Record<string, unknown>): void;
|
|
36
|
+
/** Numeric value of the current level. Mirrors the peer. */
|
|
37
|
+
readonly levelVal: number;
|
|
38
|
+
/** Prefix prepended to every message. Mirrors the peer. */
|
|
39
|
+
readonly msgPrefix: string | undefined;
|
|
40
|
+
/** Callback run on creation of a child. Assignable, like the peer. */
|
|
41
|
+
onChild: (child: Logger) => void;
|
|
42
|
+
levels: {
|
|
43
|
+
values: Record<string, number>;
|
|
44
|
+
labels: Record<number, string>;
|
|
45
|
+
};
|
|
46
|
+
isLevelEnabled(level: string): boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Whether a log call at `method` emits under `currentLevel`. Unknown
|
|
50
|
+
* requested levels are disabled, matching the peer: without the check a
|
|
51
|
+
* misspelled level maps to Infinity and wrongly enables guarded work.
|
|
52
|
+
*/
|
|
53
|
+
export declare const isFallbackLevelEnabled: (method: string, currentLevel: string) => boolean;
|
|
54
|
+
export interface FallbackLineInput {
|
|
55
|
+
method: string;
|
|
56
|
+
currentLevel: string;
|
|
57
|
+
bindings: Record<string, unknown>;
|
|
58
|
+
msgPrefix?: string;
|
|
59
|
+
args: unknown[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Render one fallback log line, or `undefined` when the level disables it.
|
|
63
|
+
* Pure so tests can exercise redaction, Error handling and formatting
|
|
64
|
+
* without hiding the `pino` peer. Never throws.
|
|
65
|
+
*/
|
|
66
|
+
export declare const formatFallbackLine: ({ method, currentLevel, bindings, msgPrefix, args }: FallbackLineInput) => string | undefined;
|
|
11
67
|
declare const _default: Logger;
|
|
12
68
|
export default _default;
|
|
13
69
|
//# sourceMappingURL=logger.d.ts.map
|
package/lib/Utils/logger.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { loadOptionalPeer } from './optional-peer.js';
|
|
2
2
|
const DEFAULT_LEVEL = 'info';
|
|
3
3
|
const REDACTED_PATHS = [
|
|
4
4
|
'creds',
|
|
@@ -17,6 +17,301 @@ const REDACTED_PATHS = [
|
|
|
17
17
|
'*.privateKey',
|
|
18
18
|
'*.secretKey'
|
|
19
19
|
];
|
|
20
|
+
const FALLBACK_LEVEL_VALUES = {
|
|
21
|
+
trace: 10,
|
|
22
|
+
debug: 20,
|
|
23
|
+
info: 30,
|
|
24
|
+
warn: 40,
|
|
25
|
+
error: 50,
|
|
26
|
+
fatal: 60,
|
|
27
|
+
silent: Infinity
|
|
28
|
+
};
|
|
29
|
+
const FALLBACK_LEVEL_LABELS = Object.fromEntries(Object.entries(FALLBACK_LEVEL_VALUES).map(([name, value]) => [value, name]));
|
|
30
|
+
const isPlainObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
31
|
+
const CIRCULAR_SENTINEL = '[Circular]';
|
|
32
|
+
const UNSERIALIZABLE_SENTINEL = '[Unserializable]';
|
|
33
|
+
const readProperty = (holder, key) => {
|
|
34
|
+
try {
|
|
35
|
+
return holder[key];
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return UNSERIALIZABLE_SENTINEL;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
/** An Error as plain data: type, message and stack survive serialization. */
|
|
42
|
+
const errorToRecord = (error) => {
|
|
43
|
+
const record = { type: error.name, message: error.message };
|
|
44
|
+
if (typeof error.stack === 'string')
|
|
45
|
+
record.stack = error.stack;
|
|
46
|
+
const fields = error;
|
|
47
|
+
for (const key of Object.keys(error))
|
|
48
|
+
record[key] = readProperty(fields, key);
|
|
49
|
+
if ('cause' in error)
|
|
50
|
+
record.cause = readProperty(fields, 'cause');
|
|
51
|
+
return record;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Deep-clone a logged value into JSON-safe data. Circular references become
|
|
55
|
+
* `[Circular]`, `BigInt` its string form, `Error` a record carrying message
|
|
56
|
+
* and stack. Never throws: logging must not crash the process it observes.
|
|
57
|
+
*/
|
|
58
|
+
const cloneForLog = (value, seen = new Set()) => {
|
|
59
|
+
try {
|
|
60
|
+
if (typeof value === 'bigint')
|
|
61
|
+
return String(value);
|
|
62
|
+
if (value instanceof Error)
|
|
63
|
+
return cloneForLog(errorToRecord(value), seen);
|
|
64
|
+
if (Array.isArray(value)) {
|
|
65
|
+
if (seen.has(value))
|
|
66
|
+
return CIRCULAR_SENTINEL;
|
|
67
|
+
seen.add(value);
|
|
68
|
+
const copy = value.map(entry => cloneForLog(entry, seen));
|
|
69
|
+
seen.delete(value);
|
|
70
|
+
return copy;
|
|
71
|
+
}
|
|
72
|
+
if (isPlainObject(value)) {
|
|
73
|
+
if (seen.has(value))
|
|
74
|
+
return CIRCULAR_SENTINEL;
|
|
75
|
+
seen.add(value);
|
|
76
|
+
const copy = {};
|
|
77
|
+
for (const key of Object.keys(value))
|
|
78
|
+
copy[key] = cloneForLog(readProperty(value, key), seen);
|
|
79
|
+
seen.delete(value);
|
|
80
|
+
return copy;
|
|
81
|
+
}
|
|
82
|
+
return value;
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return UNSERIALIZABLE_SENTINEL;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const safeStringify = (value) => JSON.stringify(cloneForLog(value)) ?? UNSERIALIZABLE_SENTINEL;
|
|
89
|
+
const censorPath = (root, path) => {
|
|
90
|
+
if (path.startsWith('*.')) {
|
|
91
|
+
const key = path.slice(2);
|
|
92
|
+
for (const value of Object.values(root)) {
|
|
93
|
+
if (isPlainObject(value) && key in value)
|
|
94
|
+
value[key] = '[REDACTED]';
|
|
95
|
+
}
|
|
96
|
+
if (key in root)
|
|
97
|
+
root[key] = '[REDACTED]';
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const segments = path.split('.');
|
|
101
|
+
let current = root;
|
|
102
|
+
for (let index = 0; index < segments.length - 1; index++) {
|
|
103
|
+
if (!isPlainObject(current))
|
|
104
|
+
return;
|
|
105
|
+
current = current[segments[index]];
|
|
106
|
+
}
|
|
107
|
+
if (isPlainObject(current)) {
|
|
108
|
+
const leaf = segments[segments.length - 1];
|
|
109
|
+
if (leaf in current)
|
|
110
|
+
current[leaf] = '[REDACTED]';
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const redactForFallback = (value) => {
|
|
114
|
+
const copy = cloneForLog(value);
|
|
115
|
+
if (isPlainObject(copy)) {
|
|
116
|
+
for (const path of REDACTED_PATHS)
|
|
117
|
+
censorPath(copy, path);
|
|
118
|
+
}
|
|
119
|
+
else if (Array.isArray(copy)) {
|
|
120
|
+
// Arrays skip the per-call object branch downstream and land under
|
|
121
|
+
// `data`, so redact each element the same way. Without this a
|
|
122
|
+
// `[{ privateKey }]` payload leaks while `{ privateKey }` does not.
|
|
123
|
+
for (const entry of copy) {
|
|
124
|
+
if (isPlainObject(entry))
|
|
125
|
+
for (const path of REDACTED_PATHS)
|
|
126
|
+
censorPath(entry, path);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return copy;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Minimal `%s`/`%d`/`%i`/`%f`/`%j`/`%o`/`%O` interpolation for the fallback,
|
|
133
|
+
* mirroring the peer's printf-style messages without adding a dependency.
|
|
134
|
+
* Leftover arguments are appended rather than dropped so no detail is lost.
|
|
135
|
+
*/
|
|
136
|
+
const formatFallbackMessage = (message, args) => {
|
|
137
|
+
let index = 0;
|
|
138
|
+
const formatted = message.replace(/%[sdifjoO%]/g, match => {
|
|
139
|
+
if (match === '%%')
|
|
140
|
+
return '%';
|
|
141
|
+
if (index >= args.length)
|
|
142
|
+
return match;
|
|
143
|
+
const arg = args[index++];
|
|
144
|
+
switch (match) {
|
|
145
|
+
case '%s':
|
|
146
|
+
return String(arg);
|
|
147
|
+
case '%d':
|
|
148
|
+
case '%i':
|
|
149
|
+
case '%f':
|
|
150
|
+
return String(Number(arg));
|
|
151
|
+
default:
|
|
152
|
+
return safeStringify(arg);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
const rest = args.slice(index).map(entry => (typeof entry === 'string' ? entry : safeStringify(entry)));
|
|
156
|
+
return rest.length > 0 ? `${formatted} ${rest.join(' ')}` : formatted;
|
|
157
|
+
};
|
|
158
|
+
const levelValue = (level, fallback) => FALLBACK_LEVEL_VALUES[level] ?? fallback;
|
|
159
|
+
/**
|
|
160
|
+
* Whether a log call at `method` emits under `currentLevel`. Unknown
|
|
161
|
+
* requested levels are disabled, matching the peer: without the check a
|
|
162
|
+
* misspelled level maps to Infinity and wrongly enables guarded work.
|
|
163
|
+
*/
|
|
164
|
+
export const isFallbackLevelEnabled = (method, currentLevel) => {
|
|
165
|
+
if (currentLevel === 'silent')
|
|
166
|
+
return false;
|
|
167
|
+
const want = FALLBACK_LEVEL_VALUES[method];
|
|
168
|
+
if (want === undefined)
|
|
169
|
+
return false;
|
|
170
|
+
return want >= levelValue(currentLevel, 30);
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Render one fallback log line, or `undefined` when the level disables it.
|
|
174
|
+
* Pure so tests can exercise redaction, Error handling and formatting
|
|
175
|
+
* without hiding the `pino` peer. Never throws.
|
|
176
|
+
*/
|
|
177
|
+
export const formatFallbackLine = ({ method, currentLevel, bindings, msgPrefix, args }) => {
|
|
178
|
+
if (!isFallbackLevelEnabled(method, currentLevel))
|
|
179
|
+
return undefined;
|
|
180
|
+
let logged;
|
|
181
|
+
let message;
|
|
182
|
+
const [first, second, ...rest] = args;
|
|
183
|
+
if (typeof first === 'string') {
|
|
184
|
+
message = formatFallbackMessage(first, second === undefined ? rest : [second, ...rest]);
|
|
185
|
+
}
|
|
186
|
+
else if (args.length > 0) {
|
|
187
|
+
logged = redactForFallback(first);
|
|
188
|
+
if (typeof second === 'string')
|
|
189
|
+
message = formatFallbackMessage(second, rest);
|
|
190
|
+
else if (second !== undefined)
|
|
191
|
+
logged = [logged, cloneForLog(second), ...rest.map(entry => cloneForLog(entry))];
|
|
192
|
+
}
|
|
193
|
+
if (msgPrefix)
|
|
194
|
+
message = `${msgPrefix}${message ?? ''}`;
|
|
195
|
+
const entry = {
|
|
196
|
+
level: levelValue(method, 30),
|
|
197
|
+
time: new Date().toJSON(),
|
|
198
|
+
...redactForFallback(bindings)
|
|
199
|
+
};
|
|
200
|
+
if (isPlainObject(logged))
|
|
201
|
+
Object.assign(entry, logged);
|
|
202
|
+
else if (logged !== undefined)
|
|
203
|
+
entry.data = logged;
|
|
204
|
+
if (message !== undefined)
|
|
205
|
+
entry.msg = message;
|
|
206
|
+
try {
|
|
207
|
+
return JSON.stringify(entry);
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
return JSON.stringify({ level: entry.level, time: entry.time, msg: UNSERIALIZABLE_SENTINEL });
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
/** Stdout is process-global, so pending-write tracking is too. */
|
|
214
|
+
let fallbackPendingWrites = 0;
|
|
215
|
+
const fallbackFlushWaiters = [];
|
|
216
|
+
const noteFallbackDelivered = () => {
|
|
217
|
+
fallbackPendingWrites--;
|
|
218
|
+
if (fallbackPendingWrites === 0) {
|
|
219
|
+
for (const resume of fallbackFlushWaiters.splice(0, fallbackFlushWaiters.length))
|
|
220
|
+
resume();
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
const writeFallbackLine = (line) => {
|
|
224
|
+
fallbackPendingWrites++;
|
|
225
|
+
let settled = false;
|
|
226
|
+
const delivered = () => {
|
|
227
|
+
if (settled)
|
|
228
|
+
return;
|
|
229
|
+
settled = true;
|
|
230
|
+
noteFallbackDelivered();
|
|
231
|
+
};
|
|
232
|
+
try {
|
|
233
|
+
process.stdout.write(`${line}\n`, delivered);
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
delivered();
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Console-backed logger used only when `pino` is not installed. Emits one
|
|
241
|
+
* JSON line per call with the same `level`/`time`/`msg` shape operators
|
|
242
|
+
* already parse, redacts the same credential paths from both per-call
|
|
243
|
+
* objects and child bindings, serializes `Error` values with their message
|
|
244
|
+
* and stack, and honors `level` and `child` bindings so level-gated code
|
|
245
|
+
* keeps working. A documented step down from the peer, never a crash.
|
|
246
|
+
*/
|
|
247
|
+
const createFallbackLogger = (state) => {
|
|
248
|
+
const write = (method, args) => {
|
|
249
|
+
const line = formatFallbackLine({
|
|
250
|
+
method,
|
|
251
|
+
currentLevel: state.level,
|
|
252
|
+
bindings: state.bindings,
|
|
253
|
+
msgPrefix: state.msgPrefix,
|
|
254
|
+
args
|
|
255
|
+
});
|
|
256
|
+
if (line !== undefined)
|
|
257
|
+
writeFallbackLine(line);
|
|
258
|
+
};
|
|
259
|
+
const logger = {
|
|
260
|
+
get level() {
|
|
261
|
+
return state.level;
|
|
262
|
+
},
|
|
263
|
+
set level(next) {
|
|
264
|
+
state.level = next;
|
|
265
|
+
},
|
|
266
|
+
get levelVal() {
|
|
267
|
+
return levelValue(state.level, 30);
|
|
268
|
+
},
|
|
269
|
+
get msgPrefix() {
|
|
270
|
+
return state.msgPrefix;
|
|
271
|
+
},
|
|
272
|
+
get onChild() {
|
|
273
|
+
return state.onChild;
|
|
274
|
+
},
|
|
275
|
+
set onChild(callback) {
|
|
276
|
+
state.onChild = callback;
|
|
277
|
+
},
|
|
278
|
+
child: (extra, options) => {
|
|
279
|
+
const created = createFallbackLogger({
|
|
280
|
+
level: options?.level ?? state.level,
|
|
281
|
+
msgPrefix: `${state.msgPrefix ?? ''}${typeof options?.msgPrefix === 'string' ? options.msgPrefix : ''}` || undefined,
|
|
282
|
+
onChild: state.onChild,
|
|
283
|
+
bindings: { ...state.bindings, ...extra }
|
|
284
|
+
});
|
|
285
|
+
state.onChild(created);
|
|
286
|
+
return created;
|
|
287
|
+
},
|
|
288
|
+
trace: (...args) => write('trace', args),
|
|
289
|
+
debug: (...args) => write('debug', args),
|
|
290
|
+
info: (...args) => write('info', args),
|
|
291
|
+
warn: (...args) => write('warn', args),
|
|
292
|
+
error: (...args) => write('error', args),
|
|
293
|
+
fatal: (...args) => write('fatal', args),
|
|
294
|
+
silent: () => { },
|
|
295
|
+
flush: (callback) => {
|
|
296
|
+
// Drain-aware: when stdout is a pipe, earlier lines may still be
|
|
297
|
+
// queued, and exiting from the callback would lose them.
|
|
298
|
+
if (!callback)
|
|
299
|
+
return;
|
|
300
|
+
if (fallbackPendingWrites === 0)
|
|
301
|
+
callback();
|
|
302
|
+
else
|
|
303
|
+
fallbackFlushWaiters.push(callback);
|
|
304
|
+
},
|
|
305
|
+
bindings: () => ({ ...state.bindings }),
|
|
306
|
+
setBindings: (extra) => {
|
|
307
|
+
Object.assign(state.bindings, extra);
|
|
308
|
+
},
|
|
309
|
+
levels: { values: { ...FALLBACK_LEVEL_VALUES }, labels: { ...FALLBACK_LEVEL_LABELS } },
|
|
310
|
+
isLevelEnabled: (level) => isFallbackLevelEnabled(level, state.level)
|
|
311
|
+
};
|
|
312
|
+
return logger;
|
|
313
|
+
};
|
|
314
|
+
const loadPinoPeer = () => loadOptionalPeer('pino');
|
|
20
315
|
/**
|
|
21
316
|
* Deferred because building pino at module evaluation cost ~10 MB of RSS in every
|
|
22
317
|
* importing process: ~4.5 MB for pino's module graph, the rest for the Date/ICU
|
|
@@ -30,20 +325,23 @@ const REDACTED_PATHS = [
|
|
|
30
325
|
let rootLogger;
|
|
31
326
|
const resolveRootLogger = () => {
|
|
32
327
|
if (!rootLogger) {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
rootLogger =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
328
|
+
const configuredLevel = process.env.BAILEYRS_LOG_LEVEL || DEFAULT_LEVEL;
|
|
329
|
+
const peer = loadPinoPeer();
|
|
330
|
+
rootLogger = peer
|
|
331
|
+
? peer({
|
|
332
|
+
name: 'baileyrs',
|
|
333
|
+
level: configuredLevel,
|
|
334
|
+
timestamp: () => `,"time":"${new Date().toJSON()}"`,
|
|
335
|
+
redact: { paths: REDACTED_PATHS, censor: '[REDACTED]' }
|
|
336
|
+
})
|
|
337
|
+
: createFallbackLogger({ level: configuredLevel, onChild: () => { }, bindings: { name: 'baileyrs' } });
|
|
41
338
|
}
|
|
42
339
|
return rootLogger;
|
|
43
340
|
};
|
|
44
341
|
const createDeferredLogger = (bindings, parent, childOptions) => {
|
|
45
342
|
let resolved;
|
|
46
343
|
let pendingLevel;
|
|
344
|
+
let pendingOnChild;
|
|
47
345
|
const members = new Map();
|
|
48
346
|
const resolve = () => {
|
|
49
347
|
if (!resolved) {
|
|
@@ -51,6 +349,8 @@ const createDeferredLogger = (bindings, parent, childOptions) => {
|
|
|
51
349
|
resolved = bindings ? source.child(bindings, childOptions) : source;
|
|
52
350
|
if (pendingLevel !== undefined)
|
|
53
351
|
resolved.level = pendingLevel;
|
|
352
|
+
if (pendingOnChild !== undefined)
|
|
353
|
+
resolved.onChild = pendingOnChild;
|
|
54
354
|
}
|
|
55
355
|
return resolved;
|
|
56
356
|
};
|
|
@@ -63,8 +363,8 @@ const createDeferredLogger = (bindings, parent, childOptions) => {
|
|
|
63
363
|
const self = { level: peekLevel, resolve };
|
|
64
364
|
// Hoisted so `logger.child` keeps the stable identity a plain property has.
|
|
65
365
|
const child = (extra, options) => createDeferredLogger(extra, self, options);
|
|
66
|
-
// Typed as
|
|
67
|
-
// at compile time even though the proxy forwards it.
|
|
366
|
+
// Typed as the full Logger, not ILogger: narrowing would reject
|
|
367
|
+
// `logger.fatal(...)` at compile time even though the proxy forwards it.
|
|
68
368
|
const target = {};
|
|
69
369
|
return new Proxy(target, {
|
|
70
370
|
get(_target, property) {
|
|
@@ -72,6 +372,8 @@ const createDeferredLogger = (bindings, parent, childOptions) => {
|
|
|
72
372
|
return child;
|
|
73
373
|
if (property === 'level' && !resolved)
|
|
74
374
|
return peekLevel();
|
|
375
|
+
if (property === 'onChild' && !resolved && pendingOnChild !== undefined)
|
|
376
|
+
return pendingOnChild;
|
|
75
377
|
const cached = members.get(property);
|
|
76
378
|
if (cached !== undefined)
|
|
77
379
|
return cached;
|
|
@@ -88,9 +390,15 @@ const createDeferredLogger = (bindings, parent, childOptions) => {
|
|
|
88
390
|
pendingLevel = value;
|
|
89
391
|
return true;
|
|
90
392
|
}
|
|
393
|
+
if (property === 'onChild' && !resolved) {
|
|
394
|
+
// Stored like `level`: assigning a hook must not build the
|
|
395
|
+
// logger the hook observes.
|
|
396
|
+
pendingOnChild = value;
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
91
399
|
;
|
|
92
400
|
resolve()[property] = value;
|
|
93
|
-
// Whole cache, not just this key:
|
|
401
|
+
// Whole cache, not just this key: the peer swaps its log methods for noops
|
|
94
402
|
// when `level` changes, so a cached `info` would stay silent forever.
|
|
95
403
|
members.clear();
|
|
96
404
|
return true;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Resolution and loading behind {@link loadOptionalPeer}. Injected in tests. */
|
|
2
|
+
export interface PeerLoader {
|
|
3
|
+
resolveSpecifier(specifier: string): string;
|
|
4
|
+
requireSpecifier(specifier: string): unknown;
|
|
5
|
+
}
|
|
6
|
+
/** Filesystem-backed loader, rooted at the importing module. */
|
|
7
|
+
export declare const nodePeerLoader: (baseUrl: string) => PeerLoader;
|
|
8
|
+
/**
|
|
9
|
+
* Load an optional peer, distinguishing "not installed" from
|
|
10
|
+
* "installed but broken".
|
|
11
|
+
*
|
|
12
|
+
* Presence is probed through the package manifest, which resolves whenever
|
|
13
|
+
* the package is installed regardless of the state of its entry point. Only
|
|
14
|
+
* a missing manifest falls back. Anything else — a broken entry point, a
|
|
15
|
+
* missing nested dependency — surfaces as an explicit error naming the
|
|
16
|
+
* peer, so a damaged installation is never silently hidden behind the
|
|
17
|
+
* fallback.
|
|
18
|
+
*/
|
|
19
|
+
export declare const loadOptionalPeer: <Module>(specifier: string, loader?: PeerLoader) => Module | undefined;
|
|
20
|
+
//# sourceMappingURL=optional-peer.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
/** Filesystem-backed loader, rooted at the importing module. */
|
|
3
|
+
export const nodePeerLoader = (baseUrl) => {
|
|
4
|
+
const requireFrom = createRequire(baseUrl);
|
|
5
|
+
return {
|
|
6
|
+
resolveSpecifier: specifier => requireFrom.resolve(specifier),
|
|
7
|
+
requireSpecifier: specifier => requireFrom(specifier)
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
const isAbsent = (error) => error?.code === 'MODULE_NOT_FOUND';
|
|
11
|
+
/**
|
|
12
|
+
* Load an optional peer, distinguishing "not installed" from
|
|
13
|
+
* "installed but broken".
|
|
14
|
+
*
|
|
15
|
+
* Presence is probed through the package manifest, which resolves whenever
|
|
16
|
+
* the package is installed regardless of the state of its entry point. Only
|
|
17
|
+
* a missing manifest falls back. Anything else — a broken entry point, a
|
|
18
|
+
* missing nested dependency — surfaces as an explicit error naming the
|
|
19
|
+
* peer, so a damaged installation is never silently hidden behind the
|
|
20
|
+
* fallback.
|
|
21
|
+
*/
|
|
22
|
+
export const loadOptionalPeer = (specifier, loader = nodePeerLoader(import.meta.url)) => {
|
|
23
|
+
try {
|
|
24
|
+
loader.resolveSpecifier(`${specifier}/package.json`);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
if (isAbsent(error))
|
|
28
|
+
return undefined;
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
return loader.requireSpecifier(specifier);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
throw new Error(`Failed to load optional peer '${specifier}': it is installed but broken. ` +
|
|
36
|
+
`Reinstall it, or remove it to use the built-in fallback.`, { cause: error });
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=optional-peer.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxidezap/baileyrs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.6",
|
|
5
5
|
"description": "A Rust-powered WhatsApp Web library for JavaScript, with a Baileys-compatible API",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|
|
@@ -82,13 +82,12 @@
|
|
|
82
82
|
"test:e2e": "NODE_TLS_REJECT_UNAUTHORIZED=0 ADV_SECRET_KEY=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= node --expose-gc --test --test-concurrency=1 ./src/__tests__/e2e/*.test-e2e.ts ./scripts/compatibility/__tests__/*.test-e2e.ts"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@
|
|
86
|
-
"
|
|
87
|
-
"long": "^5.3.2",
|
|
88
|
-
"pino": "^10.3.1"
|
|
85
|
+
"@oxidezap/whatsapp-rust-bridge": "0.22.0",
|
|
86
|
+
"long": "^5.3.2"
|
|
89
87
|
},
|
|
90
88
|
"devDependencies": {
|
|
91
89
|
"@bufbuild/protobuf": "^2.13.0",
|
|
90
|
+
"@hapi/boom": "^10.0.1",
|
|
92
91
|
"@types/node": "^26.1.1",
|
|
93
92
|
"baileys": "7.0.0-rc14",
|
|
94
93
|
"jimp": "^1.6.0",
|
|
@@ -96,6 +95,7 @@
|
|
|
96
95
|
"music-metadata": "^11.14.0",
|
|
97
96
|
"oxfmt": "^0.66.0",
|
|
98
97
|
"oxlint": "1.81.0",
|
|
98
|
+
"pino": "^10.3.1",
|
|
99
99
|
"pino-pretty": "^13.1.3",
|
|
100
100
|
"pkg-pr-new": "^0.0.88",
|
|
101
101
|
"protobufjs": "^8.8.0",
|
|
@@ -104,13 +104,18 @@
|
|
|
104
104
|
"typescript-compat-auditor": "npm:typescript@6.0.3"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
|
+
"@hapi/boom": "^9.1.0 || ^10.0.0",
|
|
107
108
|
"audio-decode": "^2.1.3",
|
|
108
109
|
"jimp": "^1.6.0",
|
|
109
110
|
"link-preview-js": "^3.0.0",
|
|
110
111
|
"music-metadata": "^11.14.0",
|
|
112
|
+
"pino": "^9.0.0 || ^10.0.0",
|
|
111
113
|
"sharp": "*"
|
|
112
114
|
},
|
|
113
115
|
"peerDependenciesMeta": {
|
|
116
|
+
"@hapi/boom": {
|
|
117
|
+
"optional": true
|
|
118
|
+
},
|
|
114
119
|
"audio-decode": {
|
|
115
120
|
"optional": true
|
|
116
121
|
},
|
|
@@ -123,6 +128,9 @@
|
|
|
123
128
|
"music-metadata": {
|
|
124
129
|
"optional": true
|
|
125
130
|
},
|
|
131
|
+
"pino": {
|
|
132
|
+
"optional": true
|
|
133
|
+
},
|
|
126
134
|
"sharp": {
|
|
127
135
|
"optional": true
|
|
128
136
|
}
|