proto: fix proto generation, tsc: fix node imports of compiled code
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
yarn pbjs -t static-module -w es6 --no-bundle -o ./WAProto/index.js ./WAProto/WAProto.proto;
|
||||
yarn pbts -o ./WAProto/index.d.ts ./WAProto/index.js;
|
||||
yarn pbjs -t static-module -w es6 --no-bundle -o ./index.js ./WAProto.proto;
|
||||
yarn pbts -o ./index.d.ts ./index.js;
|
||||
node ./fix-imports.js
|
||||
|
||||
@@ -13,6 +13,12 @@ try {
|
||||
'import $1 from'
|
||||
);
|
||||
|
||||
// add missing extension to the import
|
||||
content = content.replace(
|
||||
/(['"])protobufjs\/minimal(['"])/g,
|
||||
'$1protobufjs/minimal.js$2'
|
||||
);
|
||||
|
||||
// Write back
|
||||
writeFileSync(filePath, content, 'utf8');
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
|
||||
import $protobuf from "protobufjs/minimal";
|
||||
import $protobuf from "protobufjs/minimal.js";
|
||||
|
||||
// Common aliases
|
||||
const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
||||
|
||||
+2
-1
@@ -23,7 +23,7 @@
|
||||
"scripts": {
|
||||
"build:all": "yarn build && yarn build:docs",
|
||||
"build:docs": "typedoc",
|
||||
"build": "tsc -P tsconfig.build.json",
|
||||
"build": "tsc -P tsconfig.build.json && tsc-esm-fix --tsconfig='tsconfig.build.json' --ext='.js'",
|
||||
"changelog:last": "conventional-changelog -p angular -r 2",
|
||||
"changelog:preview": "conventional-changelog -p angular -u",
|
||||
"changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
||||
@@ -72,6 +72,7 @@
|
||||
"protobufjs-cli": "^1.1.3",
|
||||
"release-it": "^15.10.3",
|
||||
"ts-jest": "^29.3.2",
|
||||
"tsc-esm-fix": "^3.1.2",
|
||||
"tsx": "^4.20.3",
|
||||
"typedoc": "^0.27.9",
|
||||
"typedoc-plugin-markdown": "4.4.2",
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import { makeLibSignalRepository } from '../Signal/libsignal'
|
||||
import type { AuthenticationState, MediaType, SocketConfig, WAVersion } from '../Types'
|
||||
import { Browsers } from '../Utils'
|
||||
import logger from '../Utils/logger'
|
||||
import { version } from './baileys-version.json'
|
||||
import defaultVersion from './baileys-version.json' assert { type: 'json' }
|
||||
|
||||
const { version } = defaultVersion
|
||||
|
||||
export const UNAUTHORIZED_CODES = [401, 403, 419]
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { proto } from '../../../WAProto'
|
||||
import { proto } from '../../../WAProto/index.js'
|
||||
import { CiphertextMessage } from './ciphertext-message'
|
||||
|
||||
interface SenderKeyDistributionMessageStructure {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* @ts-ignore */
|
||||
import { calculateSignature, verifySignature } from 'libsignal/src/curve'
|
||||
import { proto } from '../../../WAProto'
|
||||
import { proto } from '../../../WAProto/index.js'
|
||||
import { CiphertextMessage } from './ciphertext-message'
|
||||
|
||||
interface SenderKeyMessageStructure {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import NodeCache from '@cacheable/node-cache'
|
||||
import { Boom } from '@hapi/boom'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import { DEFAULT_CACHE_TTLS, PROCESSABLE_HISTORY_TYPES } from '../Defaults'
|
||||
import type {
|
||||
BotListInfo,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import type { GroupMetadata, GroupParticipant, ParticipantAction, SocketConfig, WAMessageKey } from '../Types'
|
||||
import { WAMessageStubType } from '../Types'
|
||||
import { generateMessageIDV2, unixTimestampSeconds } from '../Utils'
|
||||
|
||||
@@ -2,7 +2,7 @@ import NodeCache from '@cacheable/node-cache'
|
||||
import { Boom } from '@hapi/boom'
|
||||
import { randomBytes } from 'crypto'
|
||||
import Long from 'long'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import { DEFAULT_CACHE_TTLS, KEY_BUNDLE_TYPE, MIN_PREKEY_COUNT } from '../Defaults'
|
||||
import type {
|
||||
MessageReceiptType,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import NodeCache from '@cacheable/node-cache'
|
||||
import { Boom } from '@hapi/boom'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import { DEFAULT_CACHE_TTLS, WA_DEFAULT_EPHEMERAL } from '../Defaults'
|
||||
import type {
|
||||
AnyMessageContent,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Boom } from '@hapi/boom'
|
||||
import { randomBytes } from 'crypto'
|
||||
import { URL } from 'url'
|
||||
import { promisify } from 'util'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import {
|
||||
DEF_CALLBACK_PREFIX,
|
||||
DEF_TAG_PREFIX,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import type { proto } from '../../WAProto'
|
||||
import type { proto } from '../../WAProto/index.js'
|
||||
import type { Contact } from './Contact'
|
||||
import type { MinimalMessage } from './Message'
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import type { proto } from '../../WAProto'
|
||||
import type { proto } from '../../WAProto/index.js'
|
||||
import type { AccountSettings } from './Auth'
|
||||
import type { BufferedEventData } from './Events'
|
||||
import type { LabelActionBody } from './Label'
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import type { Boom } from '@hapi/boom'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import type { AuthenticationCreds } from './Auth'
|
||||
import type { WACallEvent } from './Call'
|
||||
import type { Chat, ChatUpdate, PresenceData } from './Chat'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { AxiosRequestConfig } from 'axios'
|
||||
import type { Readable } from 'stream'
|
||||
import type { URL } from 'url'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults'
|
||||
import type { BinaryNode } from '../WABinary'
|
||||
import type { GroupMetadata } from './GroupMetadata'
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
|
||||
type DecryptGroupSignalOpts = {
|
||||
group: string
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import type { AxiosRequestConfig } from 'axios'
|
||||
import type { Agent } from 'https'
|
||||
import type { URL } from 'url'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import type { ILogger } from '../Utils/logger'
|
||||
import type { AuthenticationState, SignalAuthState, TransactionCapabilityOptions } from './Auth'
|
||||
import type { GroupMetadata } from './GroupMetadata'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Boom } from '@hapi/boom'
|
||||
import type { AxiosRequestConfig } from 'axios'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import type {
|
||||
BaileysEventEmitter,
|
||||
Chat,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Boom } from '@hapi/boom'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import type { SignalRepository, WAMessage, WAMessageKey } from '../Types'
|
||||
import {
|
||||
areJidsSameUser,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import EventEmitter from 'events'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import type {
|
||||
BaileysEvent,
|
||||
BaileysEventEmitter,
|
||||
|
||||
@@ -2,8 +2,9 @@ import { Boom } from '@hapi/boom'
|
||||
import axios, { type AxiosRequestConfig } from 'axios'
|
||||
import { createHash, randomBytes } from 'crypto'
|
||||
import { platform, release } from 'os'
|
||||
import { proto } from '../../WAProto'
|
||||
import { version as baileysVersion } from '../Defaults/baileys-version.json'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import version from '../Defaults/baileys-version.json' assert { type: 'json' }
|
||||
const baileysVersion = version.version
|
||||
import type {
|
||||
BaileysEventEmitter,
|
||||
BaileysEventMap,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { AxiosRequestConfig } from 'axios'
|
||||
import { promisify } from 'util'
|
||||
import { inflate } from 'zlib'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import type { Chat, Contact } from '../Types'
|
||||
import { WAMessageStubType } from '../Types'
|
||||
import { isJidUser } from '../WABinary'
|
||||
|
||||
@@ -9,7 +9,7 @@ import { tmpdir } from 'os'
|
||||
import { join } from 'path'
|
||||
import { Readable, Transform } from 'stream'
|
||||
import { URL } from 'url'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import { DEFAULT_ORIGIN, MEDIA_HKDF_KEY_MAPPING, MEDIA_PATH_MAP } from '../Defaults'
|
||||
import type {
|
||||
BaileysEventMap,
|
||||
|
||||
@@ -3,7 +3,7 @@ import axios from 'axios'
|
||||
import { randomBytes } from 'crypto'
|
||||
import { promises as fs } from 'fs'
|
||||
import { type Transform } from 'stream'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import { MEDIA_KEYS, URL_REGEX, WA_DEFAULT_EPHEMERAL } from '../Defaults'
|
||||
import type {
|
||||
AnyMediaMessageContent,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Boom } from '@hapi/boom'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import { NOISE_MODE, WA_CERT_DETAILS } from '../Defaults'
|
||||
import type { KeyPair } from '../Types'
|
||||
import type { BinaryNode } from '../WABinary'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { AxiosRequestConfig } from 'axios'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import type {
|
||||
AuthenticationCreds,
|
||||
BaileysEventEmitter,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Mutex } from 'async-mutex'
|
||||
import { mkdir, readFile, stat, unlink, writeFile } from 'fs/promises'
|
||||
import { join } from 'path'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import type { AuthenticationCreds, AuthenticationState, SignalDataTypeMap } from '../Types'
|
||||
import { initAuthCreds } from './auth-utils'
|
||||
import { BufferJSON } from './generics'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Boom } from '@hapi/boom'
|
||||
import { createHash } from 'crypto'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import { KEY_BUNDLE_TYPE } from '../Defaults'
|
||||
import type { AuthenticationCreds, SignalCreds, SocketConfig } from '../Types'
|
||||
import { type BinaryNode, getBinaryNodeChild, jidDecode, S_WHATSAPP_NET } from '../WABinary'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Boom } from '@hapi/boom'
|
||||
import { proto } from '../../WAProto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import { type BinaryNode } from './types'
|
||||
|
||||
// some extra useful utilities
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export * from './Protocols'
|
||||
export * from './Protocols/index'
|
||||
export * from './USyncQuery'
|
||||
export * from './USyncUser'
|
||||
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
import makeWASocket from './Socket'
|
||||
import makeWASocket from './Socket/index'
|
||||
|
||||
export * from '../WAProto'
|
||||
export * from './Utils'
|
||||
export * from './Types'
|
||||
export * from './Defaults'
|
||||
export * from './WABinary'
|
||||
export * from './WAM'
|
||||
export * from './WAUSync'
|
||||
export * from '../WAProto/index.js'
|
||||
export * from './Utils/index'
|
||||
export * from './Types/index'
|
||||
export * from './Defaults/index'
|
||||
export * from './WABinary/index'
|
||||
export * from './WAM/index'
|
||||
export * from './WAUSync/index'
|
||||
|
||||
export type WASocket = ReturnType<typeof makeWASocket>
|
||||
export { makeWASocket }
|
||||
|
||||
@@ -1861,6 +1861,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@topoconfig/extends@npm:^0.16.2":
|
||||
version: 0.16.2
|
||||
resolution: "@topoconfig/extends@npm:0.16.2"
|
||||
bin:
|
||||
xtends: target/esm/cli.mjs
|
||||
checksum: 10c0/9719b3cd84d2525dd4f4f19f47007b08909e9b19c74b498ebac8c596795d9613e383eac3e5f2e63fb5083af2d7eab5606a422f94d3554cb982736dc97c58cd81
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/babel__core@npm:^7.1.14":
|
||||
version: 7.20.5
|
||||
resolution: "@types/babel__core@npm:7.20.5"
|
||||
@@ -2659,6 +2668,7 @@ __metadata:
|
||||
protobufjs-cli: "npm:^1.1.3"
|
||||
release-it: "npm:^15.10.3"
|
||||
ts-jest: "npm:^29.3.2"
|
||||
tsc-esm-fix: "npm:^3.1.2"
|
||||
tsx: "npm:^4.20.3"
|
||||
typedoc: "npm:^0.27.9"
|
||||
typedoc-plugin-markdown: "npm:4.4.2"
|
||||
@@ -3782,6 +3792,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"depseek@npm:^0.4.1":
|
||||
version: 0.4.1
|
||||
resolution: "depseek@npm:0.4.1"
|
||||
checksum: 10c0/1313fba818793a5be4514c95f8770cbbe45cf6e746b629166115d0a380b3ccd2a4577355a928063daecec303e488cc414d1279938dd4d4521a57304746f0e892
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"detect-newline@npm:^3.0.0":
|
||||
version: 3.1.0
|
||||
resolution: "detect-newline@npm:3.1.0"
|
||||
@@ -4807,6 +4824,17 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fs-extra@npm:^11.2.0":
|
||||
version: 11.3.0
|
||||
resolution: "fs-extra@npm:11.3.0"
|
||||
dependencies:
|
||||
graceful-fs: "npm:^4.2.0"
|
||||
jsonfile: "npm:^6.0.1"
|
||||
universalify: "npm:^2.0.0"
|
||||
checksum: 10c0/5f95e996186ff45463059feb115a22fb048bdaf7e487ecee8a8646c78ed8fdca63630e3077d4c16ce677051f5e60d3355a06f3cd61f3ca43f48cc58822a44d0a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fs-minipass@npm:^3.0.0":
|
||||
version: 3.0.3
|
||||
resolution: "fs-minipass@npm:3.0.3"
|
||||
@@ -5179,7 +5207,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.9, graceful-fs@npm:^4.2.11, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9":
|
||||
"graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.1.9, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.11, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9":
|
||||
version: 4.2.11
|
||||
resolution: "graceful-fs@npm:4.2.11"
|
||||
checksum: 10c0/386d011a553e02bc594ac2ca0bd6d9e4c22d7fa8cfbfc448a6d148c59ea881b092db9dbe3547ae4b88e55f1b01f7c4a2ecc53b310c042793e63aa44cf6c257f2
|
||||
@@ -6839,6 +6867,19 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"jsonfile@npm:^6.0.1":
|
||||
version: 6.1.0
|
||||
resolution: "jsonfile@npm:6.1.0"
|
||||
dependencies:
|
||||
graceful-fs: "npm:^4.1.6"
|
||||
universalify: "npm:^2.0.0"
|
||||
dependenciesMeta:
|
||||
graceful-fs:
|
||||
optional: true
|
||||
checksum: 10c0/4f95b5e8a5622b1e9e8f33c96b7ef3158122f595998114d1e7f03985649ea99cb3cd99ce1ed1831ae94c8c8543ab45ebd044207612f31a56fd08462140e46865
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"jsonparse@npm:^1.2.0":
|
||||
version: 1.3.1
|
||||
resolution: "jsonparse@npm:1.3.1"
|
||||
@@ -9886,6 +9927,22 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tsc-esm-fix@npm:^3.1.2":
|
||||
version: 3.1.2
|
||||
resolution: "tsc-esm-fix@npm:3.1.2"
|
||||
dependencies:
|
||||
"@topoconfig/extends": "npm:^0.16.2"
|
||||
depseek: "npm:^0.4.1"
|
||||
fast-glob: "npm:^3.3.2"
|
||||
fs-extra: "npm:^11.2.0"
|
||||
json5: "npm:^2.2.3"
|
||||
type-flag: "npm:^3.0.0"
|
||||
bin:
|
||||
tsc-esm-fix: target/esm/cli.mjs
|
||||
checksum: 10c0/5072d08273cb942cf2868ecfeb1a213e3fa35f11c0e13807901610d80b90dd849c65d5f9714d7ac99b7c6faa9256d56afdd146fc4c1832226441dc7e3eb2e0d9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tslib@npm:^2.0.1, tslib@npm:^2.1.0, tslib@npm:^2.4.0":
|
||||
version: 2.8.1
|
||||
resolution: "tslib@npm:2.8.1"
|
||||
@@ -9983,6 +10040,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"type-flag@npm:^3.0.0":
|
||||
version: 3.0.0
|
||||
resolution: "type-flag@npm:3.0.0"
|
||||
checksum: 10c0/b1015d4eb18cd85432fa3bcd0228149dd6893a9c1360a2ad619f79b72e19acfb648a932e2a9ccf2e2db0f0c4b86385bd886a3364e221afb116424e0ae6d1b1ba
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typed-array-buffer@npm:^1.0.3":
|
||||
version: 1.0.3
|
||||
resolution: "typed-array-buffer@npm:1.0.3"
|
||||
@@ -10174,6 +10238,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"universalify@npm:^2.0.0":
|
||||
version: 2.0.1
|
||||
resolution: "universalify@npm:2.0.1"
|
||||
checksum: 10c0/73e8ee3809041ca8b818efb141801a1004e3fc0002727f1531f4de613ea281b494a40909596dae4a042a4fb6cd385af5d4db2e137b1362e0e91384b828effd3a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"untildify@npm:^4.0.0":
|
||||
version: 4.0.0
|
||||
resolution: "untildify@npm:4.0.0"
|
||||
|
||||
Reference in New Issue
Block a user