@openclaw/whatsapp 2026.6.8 → 2026.6.9-beta.1
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/{access-control-BKaMOvIk.js → access-control-BnFVCHHH.js} +161 -50
- package/dist/{action-runtime-Cyp5GNIT.js → action-runtime-ClQLHIwf.js} +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/api.js +10 -9
- package/dist/{approval-handler.runtime-BVmOu6x1.js → approval-handler.runtime-DLjPf_Mx.js} +1 -1
- package/dist/{auth-store-e9VzLZ-S.js → auth-store-RyuCPHE0.js} +3 -3
- package/dist/{channel-DyUm8hqs.js → channel-BG3zFbs9.js} +7 -7
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-zvbaCnGe.js → channel-react-action-Cuep4yMf.js} +2 -2
- package/dist/{channel.runtime-BXkzo0j1.js → channel.runtime-CzHkB9T6.js} +4 -4
- package/dist/{channel.setup-CpyAie9O.js → channel.setup-XxgR62Qi.js} +2 -2
- package/dist/{connection-controller-BWBoVQr4.js → connection-controller-BDuM0Kc7.js} +52 -27
- package/dist/contract-api.js +1 -1
- package/dist/{identity-Bupuq9vF.js → identity-Cm6bKAtk.js} +1 -1
- package/dist/light-runtime-api.js +1 -1
- package/dist/{login-Xv3ujrl0.js → login-B503Fwb8.js} +4 -3
- package/dist/{login-qr-CaJziL93.js → login-qr-AgwdQyj_.js} +16 -4
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-Ggwn3FDi.js → monitor-CirB7YZp.js} +337 -262
- package/dist/{quoted-message-CveINB35.js → quoted-message-DVOfpEja.js} +1 -1
- package/dist/runtime-api.js +7 -7
- package/dist/{send-DSlVXKL_.js → send-A9EqsNyz.js} +3 -1
- package/dist/{send-api-Cp9CUH5P.js → send-api-89SE5WKV.js} +19 -6
- package/dist/{session-BCKUPRkN.js → session-BW8RcCcb.js} +3 -20
- package/dist/{setup-core-Cp0NMO89.js → setup-core-v_nSSRfg.js} +2 -2
- package/dist/{setup-finalize-DnV-KlkQ.js → setup-finalize-BrMLr5Wj.js} +2 -2
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BmPcAhIF.js → setup-surface-DDpST8Qs.js} +2 -2
- package/dist/socket-timing-DvMNkIge.js +65 -0
- package/dist/{text-runtime-Dk37KYHj.js → text-runtime-BBSmIBHN.js} +6 -4
- package/node_modules/@protobufjs/aspromise/LICENSE +26 -0
- package/node_modules/@protobufjs/aspromise/README.md +13 -0
- package/node_modules/{protobufjs/src/util/aspromise.d.ts → @protobufjs/aspromise/index.d.ts} +13 -13
- package/node_modules/{protobufjs/src/util/aspromise.js → @protobufjs/aspromise/index.js} +52 -52
- package/node_modules/@protobufjs/aspromise/package.json +21 -0
- package/node_modules/@protobufjs/aspromise/tests/index.js +130 -0
- package/node_modules/@protobufjs/base64/LICENSE +26 -0
- package/node_modules/@protobufjs/base64/README.md +19 -0
- package/node_modules/{protobufjs/src/util/base64.d.ts → @protobufjs/base64/index.d.ts} +32 -32
- package/node_modules/{protobufjs/src/util/base64.js → @protobufjs/base64/index.js} +139 -146
- package/node_modules/@protobufjs/base64/package.json +21 -0
- package/node_modules/@protobufjs/base64/tests/index.js +46 -0
- package/node_modules/@protobufjs/codegen/LICENSE +26 -0
- package/node_modules/@protobufjs/codegen/README.md +49 -0
- package/node_modules/{protobufjs/src/util/codegen.d.ts → @protobufjs/codegen/index.d.ts} +31 -31
- package/node_modules/{protobufjs/src/util/codegen.js → @protobufjs/codegen/index.js} +112 -113
- package/node_modules/@protobufjs/codegen/package.json +13 -0
- package/node_modules/@protobufjs/codegen/tests/index.js +13 -0
- package/node_modules/@protobufjs/eventemitter/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/eventemitter/LICENSE +26 -0
- package/node_modules/@protobufjs/eventemitter/README.md +22 -0
- package/node_modules/{protobufjs/src/util/eventemitter.d.ts → @protobufjs/eventemitter/index.d.ts} +45 -45
- package/node_modules/{protobufjs/src/util/eventemitter.js → @protobufjs/eventemitter/index.js} +86 -86
- package/node_modules/@protobufjs/eventemitter/package.json +21 -0
- package/node_modules/@protobufjs/eventemitter/tests/index.js +83 -0
- package/node_modules/@protobufjs/fetch/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/fetch/LICENSE +26 -0
- package/node_modules/@protobufjs/fetch/README.md +13 -0
- package/node_modules/{protobufjs/src/util/fetch.d.ts → @protobufjs/fetch/index.d.ts} +56 -56
- package/node_modules/{protobufjs/src/util/fetch.js → @protobufjs/fetch/index.js} +112 -112
- package/node_modules/@protobufjs/fetch/package.json +27 -0
- package/node_modules/@protobufjs/fetch/tests/data/file.txt +1 -0
- package/node_modules/@protobufjs/fetch/tests/index.js +158 -0
- package/node_modules/@protobufjs/fetch/util/fs.js +11 -0
- package/node_modules/@protobufjs/float/LICENSE +26 -0
- package/node_modules/@protobufjs/float/README.md +102 -0
- package/node_modules/@protobufjs/float/bench/index.js +87 -0
- package/node_modules/@protobufjs/float/bench/suite.js +46 -0
- package/node_modules/{protobufjs/src/util/float.js → @protobufjs/float/index.js} +335 -335
- package/node_modules/@protobufjs/float/package.json +26 -0
- package/node_modules/@protobufjs/float/tests/index.js +100 -0
- package/node_modules/@protobufjs/inquire/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/inquire/LICENSE +26 -0
- package/node_modules/@protobufjs/inquire/README.md +13 -0
- package/node_modules/{protobufjs/src/util/inquire.d.ts → @protobufjs/inquire/index.d.ts} +10 -10
- package/node_modules/{protobufjs/src/util/inquire.js → @protobufjs/inquire/index.js} +38 -38
- package/node_modules/@protobufjs/inquire/package.json +21 -0
- package/node_modules/@protobufjs/inquire/tests/data/array.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/data/object.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/index.js +20 -0
- package/node_modules/@protobufjs/path/LICENSE +26 -0
- package/node_modules/@protobufjs/path/README.md +19 -0
- package/node_modules/{protobufjs/src/util/path.d.ts → @protobufjs/path/index.d.ts} +22 -22
- package/node_modules/{protobufjs/src/util/path.js → @protobufjs/path/index.js} +65 -72
- package/node_modules/@protobufjs/path/package.json +21 -0
- package/node_modules/@protobufjs/path/tests/index.js +60 -0
- package/node_modules/@protobufjs/pool/.npmignore +3 -0
- package/node_modules/@protobufjs/pool/LICENSE +26 -0
- package/node_modules/@protobufjs/pool/README.md +13 -0
- package/node_modules/{protobufjs/src/util/pool.d.ts → @protobufjs/pool/index.d.ts} +32 -32
- package/node_modules/{protobufjs/src/util/pool.js → @protobufjs/pool/index.js} +48 -48
- package/node_modules/@protobufjs/pool/package.json +21 -0
- package/node_modules/@protobufjs/pool/tests/index.js +33 -0
- package/node_modules/@protobufjs/utf8/LICENSE +26 -0
- package/node_modules/@protobufjs/utf8/README.md +20 -0
- package/node_modules/{protobufjs/src/util/utf8.d.ts → @protobufjs/utf8/index.d.ts} +24 -24
- package/node_modules/{protobufjs/src/util/utf8.js → @protobufjs/utf8/index.js} +104 -130
- package/node_modules/@protobufjs/utf8/package.json +21 -0
- package/node_modules/@protobufjs/utf8/tests/data/surrogate_pair_bug.txt +207 -0
- package/node_modules/@protobufjs/utf8/tests/data/utf8.txt +216 -0
- package/node_modules/@protobufjs/utf8/tests/index.js +74 -0
- package/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/node/README.md +15 -0
- package/node_modules/@types/node/assert/strict.d.ts +59 -0
- package/node_modules/@types/node/assert.d.ts +950 -0
- package/node_modules/@types/node/async_hooks.d.ts +711 -0
- package/node_modules/@types/node/buffer.buffer.d.ts +466 -0
- package/node_modules/@types/node/buffer.d.ts +1765 -0
- package/node_modules/@types/node/child_process.d.ts +1366 -0
- package/node_modules/@types/node/cluster.d.ts +432 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/node/console.d.ts +93 -0
- package/node_modules/@types/node/constants.d.ts +14 -0
- package/node_modules/@types/node/crypto.d.ts +4058 -0
- package/node_modules/@types/node/dgram.d.ts +537 -0
- package/node_modules/@types/node/diagnostics_channel.d.ts +552 -0
- package/node_modules/@types/node/dns/promises.d.ts +497 -0
- package/node_modules/@types/node/dns.d.ts +876 -0
- package/node_modules/@types/node/domain.d.ts +150 -0
- package/node_modules/@types/node/events.d.ts +1008 -0
- package/node_modules/@types/node/fs/promises.d.ts +1468 -0
- package/node_modules/@types/node/fs.d.ts +4780 -0
- package/node_modules/@types/node/globals.d.ts +150 -0
- package/node_modules/@types/node/globals.typedarray.d.ts +101 -0
- package/node_modules/@types/node/http.d.ts +2147 -0
- package/node_modules/@types/node/http2.d.ts +2485 -0
- package/node_modules/@types/node/https.d.ts +400 -0
- package/node_modules/@types/node/index.d.ts +117 -0
- package/node_modules/@types/node/inspector/promises.d.ts +35 -0
- package/node_modules/@types/node/inspector.d.ts +264 -0
- package/node_modules/@types/node/inspector.generated.d.ts +4406 -0
- package/node_modules/@types/node/module.d.ts +755 -0
- package/node_modules/@types/node/net.d.ts +970 -0
- package/node_modules/@types/node/os.d.ts +498 -0
- package/node_modules/@types/node/package.json +155 -0
- package/node_modules/@types/node/path/posix.d.ts +8 -0
- package/node_modules/@types/node/path/win32.d.ts +8 -0
- package/node_modules/@types/node/path.d.ts +178 -0
- package/node_modules/@types/node/perf_hooks.d.ts +612 -0
- package/node_modules/@types/node/process.d.ts +2204 -0
- package/node_modules/@types/node/punycode.d.ts +89 -0
- package/node_modules/@types/node/querystring.d.ts +139 -0
- package/node_modules/@types/node/quic.d.ts +897 -0
- package/node_modules/@types/node/readline/promises.d.ts +158 -0
- package/node_modules/@types/node/readline.d.ts +507 -0
- package/node_modules/@types/node/repl.d.ts +420 -0
- package/node_modules/@types/node/sea.d.ts +47 -0
- package/node_modules/@types/node/sqlite.d.ts +1068 -0
- package/node_modules/@types/node/stream/consumers.d.ts +114 -0
- package/node_modules/@types/node/stream/iter.d.ts +301 -0
- package/node_modules/@types/node/stream/promises.d.ts +211 -0
- package/node_modules/@types/node/stream/web.d.ts +300 -0
- package/node_modules/@types/node/stream.d.ts +1774 -0
- package/node_modules/@types/node/string_decoder.d.ts +27 -0
- package/node_modules/@types/node/test/reporters.d.ts +59 -0
- package/node_modules/@types/node/test.d.ts +2279 -0
- package/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/node_modules/@types/node/timers.d.ts +149 -0
- package/node_modules/@types/node/tls.d.ts +1193 -0
- package/node_modules/@types/node/trace_events.d.ts +103 -0
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +462 -0
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +119 -0
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +119 -0
- package/node_modules/@types/node/tty.d.ts +225 -0
- package/node_modules/@types/node/url.d.ts +556 -0
- package/node_modules/@types/node/util/types.d.ts +558 -0
- package/node_modules/@types/node/util.d.ts +1677 -0
- package/node_modules/@types/node/v8.d.ts +980 -0
- package/node_modules/@types/node/vm.d.ts +1136 -0
- package/node_modules/@types/node/wasi.d.ts +131 -0
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
- package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
- package/node_modules/@types/node/web-globals/console.d.ts +9 -0
- package/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
- package/node_modules/@types/node/web-globals/events.d.ts +106 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
- package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
- package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
- package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
- package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/@types/node/web-globals/streams.d.ts +115 -0
- package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
- package/node_modules/@types/node/web-globals/url.d.ts +24 -0
- package/node_modules/@types/node/worker_threads.d.ts +671 -0
- package/node_modules/@types/node/zlib/iter.d.ts +131 -0
- package/node_modules/@types/node/zlib.d.ts +589 -0
- package/node_modules/protobufjs/README.md +556 -263
- package/node_modules/protobufjs/dist/light/protobuf.js +1569 -1919
- package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.js +906 -1132
- package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.js +1576 -1993
- package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/ext/descriptor/README.md +70 -3
- package/node_modules/protobufjs/ext/descriptor/index.d.ts +193 -0
- package/node_modules/protobufjs/ext/descriptor/index.js +1185 -1
- package/node_modules/protobufjs/ext/descriptor/test.js +54 -0
- package/node_modules/protobufjs/index.d.ts +720 -834
- package/node_modules/protobufjs/package.json +44 -20
- package/node_modules/protobufjs/src/converter.js +36 -60
- package/node_modules/protobufjs/src/decoder.js +53 -124
- package/node_modules/protobufjs/src/encoder.js +2 -10
- package/node_modules/protobufjs/src/enum.js +3 -8
- package/node_modules/protobufjs/src/field.js +11 -13
- package/node_modules/protobufjs/src/index-light.js +1 -1
- package/node_modules/protobufjs/src/mapfield.js +0 -1
- package/node_modules/protobufjs/src/message.js +11 -5
- package/node_modules/protobufjs/src/method.js +4 -5
- package/node_modules/protobufjs/src/namespace.js +3 -10
- package/node_modules/protobufjs/src/object.js +20 -20
- package/node_modules/protobufjs/src/oneof.js +0 -3
- package/node_modules/protobufjs/src/parse.js +16 -78
- package/node_modules/protobufjs/src/reader.js +31 -136
- package/node_modules/protobufjs/src/reader_buffer.js +3 -24
- package/node_modules/protobufjs/src/root.js +3 -7
- package/node_modules/protobufjs/src/roots.js +1 -1
- package/node_modules/protobufjs/src/service.js +6 -13
- package/node_modules/protobufjs/src/tokenize.js +1 -6
- package/node_modules/protobufjs/src/type.js +30 -44
- package/node_modules/protobufjs/src/typescript.jsdoc +15 -0
- package/node_modules/protobufjs/src/util/minimal.js +12 -36
- package/node_modules/protobufjs/src/util.js +17 -6
- package/node_modules/protobufjs/src/verifier.js +6 -6
- package/node_modules/protobufjs/src/wrappers.js +1 -0
- package/node_modules/protobufjs/src/writer.js +16 -42
- package/node_modules/protobufjs/src/writer_buffer.js +1 -18
- package/node_modules/protobufjs/tsconfig.json +5 -3
- package/node_modules/undici-types/LICENSE +21 -0
- package/node_modules/undici-types/README.md +6 -0
- package/node_modules/undici-types/agent.d.ts +32 -0
- package/node_modules/undici-types/api.d.ts +43 -0
- package/node_modules/undici-types/balanced-pool.d.ts +30 -0
- package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
- package/node_modules/undici-types/cache.d.ts +36 -0
- package/node_modules/undici-types/client-stats.d.ts +15 -0
- package/node_modules/undici-types/client.d.ts +123 -0
- package/node_modules/undici-types/connector.d.ts +36 -0
- package/node_modules/undici-types/content-type.d.ts +21 -0
- package/node_modules/undici-types/cookies.d.ts +30 -0
- package/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
- package/node_modules/undici-types/dispatcher.d.ts +279 -0
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/undici-types/errors.d.ts +177 -0
- package/node_modules/undici-types/eventsource.d.ts +66 -0
- package/node_modules/undici-types/fetch.d.ts +211 -0
- package/node_modules/undici-types/formdata.d.ts +108 -0
- package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici-types/global-origin.d.ts +7 -0
- package/node_modules/undici-types/h2c-client.d.ts +73 -0
- package/node_modules/undici-types/handlers.d.ts +15 -0
- package/node_modules/undici-types/header.d.ts +160 -0
- package/node_modules/undici-types/index.d.ts +91 -0
- package/node_modules/undici-types/interceptors.d.ts +80 -0
- package/node_modules/undici-types/mock-agent.d.ts +68 -0
- package/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/node_modules/undici-types/mock-client.d.ts +27 -0
- package/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +94 -0
- package/node_modules/undici-types/mock-pool.d.ts +27 -0
- package/node_modules/undici-types/package.json +55 -0
- package/node_modules/undici-types/patch.d.ts +29 -0
- package/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/node_modules/undici-types/pool.d.ts +41 -0
- package/node_modules/undici-types/proxy-agent.d.ts +29 -0
- package/node_modules/undici-types/readable.d.ts +68 -0
- package/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/node_modules/undici-types/retry-handler.d.ts +125 -0
- package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
- package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
- package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
- package/node_modules/undici-types/util.d.ts +18 -0
- package/node_modules/undici-types/utility.d.ts +7 -0
- package/node_modules/undici-types/webidl.d.ts +347 -0
- package/node_modules/undici-types/websocket.d.ts +188 -0
- package/npm-shrinkwrap.json +95 -6
- package/package.json +4 -4
- package/node_modules/protobufjs/ext/README.md +0 -81
- package/node_modules/protobufjs/ext/descriptor.d.ts +0 -86
- package/node_modules/protobufjs/ext/descriptor.generated.d.ts +0 -409
- package/node_modules/protobufjs/ext/descriptor.js +0 -1266
- package/node_modules/protobufjs/ext/textformat.d.ts +0 -19
- package/node_modules/protobufjs/ext/textformat.generated.d.ts +0 -11
- package/node_modules/protobufjs/ext/textformat.js +0 -1235
- package/node_modules/protobufjs/google/protobuf/compiler/plugin.json +0 -126
- package/node_modules/protobufjs/google/protobuf/compiler/plugin.proto +0 -47
- package/node_modules/protobufjs/src/typescript.js +0 -25
- /package/node_modules/{protobufjs/src/util/float.d.ts → @protobufjs/float/index.d.ts} +0 -0
package/dist/runtime-api.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { o as resolveWebCredsBackupPath, r as hasWebCredsSync, s as resolveWebCredsPath } from "./creds-files-B1kSWtBg.js";
|
|
2
|
-
import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-
|
|
3
|
-
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-
|
|
2
|
+
import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-ClQLHIwf.js";
|
|
3
|
+
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-A9EqsNyz.js";
|
|
4
4
|
import { r as setWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
|
|
5
5
|
import { n as getStatusCode, t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
6
6
|
import { startWebLoginWithQr, waitForWebLogin } from "./login-qr-runtime.js";
|
|
7
7
|
import { t as createWhatsAppLoginTool } from "./agent-tools-login-BX7eHgDm.js";
|
|
8
|
-
import { C as waitForCredsSaveQueue, T as writeCredsJsonAtomically, _ as readWebSelfIdentity, a as formatWhatsAppWebAuthStatusState, b as restoreCredsFromBackupIfNeeded, c as logoutWeb, d as readWebAuthExistsBestEffort, f as readWebAuthExistsForDecision, g as readWebSelfId, h as readWebAuthState, l as pickWebChannel, m as readWebAuthSnapshotBestEffort, n as WHATSAPP_AUTH_UNSTABLE_CODE, o as getWebAuthAgeMs, p as readWebAuthSnapshot, r as WhatsAppAuthUnstableError, s as logWebSelfId, t as WA_WEB_AUTH_DIR, u as readCredsJsonRaw, v as readWebSelfIdentityForDecision, w as waitForCredsSaveQueueWithTimeout, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-
|
|
8
|
+
import { C as waitForCredsSaveQueue, T as writeCredsJsonAtomically, _ as readWebSelfIdentity, a as formatWhatsAppWebAuthStatusState, b as restoreCredsFromBackupIfNeeded, c as logoutWeb, d as readWebAuthExistsBestEffort, f as readWebAuthExistsForDecision, g as readWebSelfId, h as readWebAuthState, l as pickWebChannel, m as readWebAuthSnapshotBestEffort, n as WHATSAPP_AUTH_UNSTABLE_CODE, o as getWebAuthAgeMs, p as readWebAuthSnapshot, r as WhatsAppAuthUnstableError, s as logWebSelfId, t as WA_WEB_AUTH_DIR, u as readCredsJsonRaw, v as readWebSelfIdentityForDecision, w as waitForCredsSaveQueueWithTimeout, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-RyuCPHE0.js";
|
|
9
9
|
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-HU41RHGI.js";
|
|
10
|
-
import { _ as
|
|
11
|
-
import { n as newConnectionId, r as waitForWaConnection, t as createWaSocket } from "./session-
|
|
10
|
+
import { _ as extractLocationData, b as extractText, m as extractContactContext, v as extractMediaPlaceholder } from "./send-api-89SE5WKV.js";
|
|
11
|
+
import { n as newConnectionId, r as waitForWaConnection, t as createWaSocket } from "./session-BW8RcCcb.js";
|
|
12
12
|
import { n as resolveWebAccountId, t as getActiveWebListener } from "./active-listener-CFwkn3ho.js";
|
|
13
|
-
import { a as loadWebMediaRaw, c as monitorWebInbox, i as loadWebMedia, l as resetWebInboundDedupe, n as LocalMediaAccessError, o as optimizeImageToJpeg, r as getDefaultLocalRoots, s as optimizeImageToPng, t as monitorWebChannel } from "./monitor-
|
|
14
|
-
import { t as loginWeb } from "./login-
|
|
13
|
+
import { a as loadWebMediaRaw, c as monitorWebInbox, i as loadWebMedia, l as resetWebInboundDedupe, n as LocalMediaAccessError, o as optimizeImageToJpeg, r as getDefaultLocalRoots, s as optimizeImageToPng, t as monitorWebChannel } from "./monitor-CirB7YZp.js";
|
|
14
|
+
import { t as loginWeb } from "./login-B503Fwb8.js";
|
|
15
15
|
import { HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, SILENT_REPLY_TOKEN, stripHeartbeatToken } from "openclaw/plugin-sdk/reply-runtime";
|
|
16
16
|
export { DEFAULT_WEB_MEDIA_BYTES, HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, LocalMediaAccessError, SILENT_REPLY_TOKEN, WA_WEB_AUTH_DIR, WHATSAPP_AUTH_UNSTABLE_CODE, WhatsAppAuthUnstableError, createWaSocket, createWhatsAppLoginTool, extractContactContext, extractLocationData, extractMediaPlaceholder, extractText, formatError, formatWhatsAppWebAuthStatusState, getActiveWebListener, getDefaultLocalRoots, getStatusCode, getWebAuthAgeMs, handleWhatsAppAction, hasWebCredsSync, loadWebMedia, loadWebMediaRaw, logWebSelfId, loginWeb, logoutWeb, monitorWebChannel, monitorWebInbox, newConnectionId, optimizeImageToJpeg, optimizeImageToPng, pickWebChannel, readCredsJsonRaw, readWebAuthExistsBestEffort, readWebAuthExistsForDecision, readWebAuthSnapshot, readWebAuthSnapshotBestEffort, readWebAuthState, readWebSelfId, readWebSelfIdentity, readWebSelfIdentityForDecision, resetWebInboundDedupe, resolveDefaultWebAuthDir, resolveWebAccountId, resolveWebCredsBackupPath, resolveWebCredsPath, restoreCredsFromBackupIfNeeded, sendMessageWhatsApp, sendPollWhatsApp, sendReactionWhatsApp, sendTypingWhatsApp, setWhatsAppRuntime, startWebLoginWithQr, stripHeartbeatToken, waitForCredsSaveQueue, waitForCredsSaveQueueWithTimeout, waitForWaConnection, waitForWebLogin, webAuthExists, whatsAppActionRuntime, writeCredsJsonAtomically };
|
|
@@ -5,7 +5,8 @@ import { c as normalizeWhatsAppTarget, n as isWhatsAppNewsletterJid } from "./no
|
|
|
5
5
|
import "./normalize-Bxwqo-bW.js";
|
|
6
6
|
import { t as getOptionalWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
|
|
7
7
|
import { r as getRegisteredWhatsAppConnectionController, t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
8
|
-
import {
|
|
8
|
+
import { r as isWhatsAppSocketOperationTimeoutError } from "./socket-timing-DvMNkIge.js";
|
|
9
|
+
import { a as sanitizeAssistantVisibleTextWithProfile, d as markdownToWhatsApp, i as sanitizeAssistantVisibleText, o as sleep, p as toWhatsappJid, s as stripToolCallXmlTags } from "./text-runtime-BBSmIBHN.js";
|
|
9
10
|
import path from "node:path";
|
|
10
11
|
import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
11
12
|
import { sanitizeForPlainText } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -431,6 +432,7 @@ function deriveWhatsAppDocumentFileName(mediaUrl) {
|
|
|
431
432
|
}
|
|
432
433
|
}
|
|
433
434
|
function isRetryableWhatsAppOutboundError(error) {
|
|
435
|
+
if (isWhatsAppSocketOperationTimeoutError(error)) return false;
|
|
434
436
|
return /closed|reset|timed\s*out|disconnect/i.test(formatError(error));
|
|
435
437
|
}
|
|
436
438
|
async function sendWhatsAppOutboundWithRetry(params) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as isWhatsAppNewsletterJid } from "./normalize-target-bVWjgftN.js";
|
|
2
|
-
import { u as resolveWhatsAppDocumentFileName } from "./send-
|
|
2
|
+
import { u as resolveWhatsAppDocumentFileName } from "./send-A9EqsNyz.js";
|
|
3
3
|
import "./normalize-Bxwqo-bW.js";
|
|
4
|
-
import { m as toWhatsappJidWithLid, p as toWhatsappJid, u as jidToE164 } from "./text-runtime-
|
|
5
|
-
import { t as buildQuotedMessageOptions } from "./quoted-message-
|
|
6
|
-
import { c as resolveComparableIdentity } from "./identity-
|
|
4
|
+
import { m as toWhatsappJidWithLid, p as toWhatsappJid, u as jidToE164 } from "./text-runtime-BBSmIBHN.js";
|
|
5
|
+
import { t as buildQuotedMessageOptions } from "./quoted-message-DVOfpEja.js";
|
|
6
|
+
import { c as resolveComparableIdentity } from "./identity-Cm6bKAtk.js";
|
|
7
7
|
import { normalizeLowercaseStringOrEmpty, normalizeStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds } from "openclaw/plugin-sdk/channel-outbound";
|
|
9
9
|
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -222,11 +222,24 @@ function extractText(rawMessage) {
|
|
|
222
222
|
const contactPlaceholder = extractContactPlaceholder(message) ?? (extracted && extracted !== message ? extractContactPlaceholder(extracted) : void 0);
|
|
223
223
|
if (contactPlaceholder) return contactPlaceholder;
|
|
224
224
|
}
|
|
225
|
+
function extractExternalAdReplyContext(rawMessage) {
|
|
226
|
+
const message = unwrapMessage(rawMessage);
|
|
227
|
+
const adReply = message?.imageMessage?.contextInfo?.externalAdReply ?? message?.videoMessage?.contextInfo?.externalAdReply;
|
|
228
|
+
if (!adReply) return;
|
|
229
|
+
const title = adReply.title?.trim() || void 0;
|
|
230
|
+
const sourceUrl = adReply.sourceUrl?.trim() || void 0;
|
|
231
|
+
const body = adReply.body?.trim() || void 0;
|
|
232
|
+
return title || sourceUrl || body ? {
|
|
233
|
+
title,
|
|
234
|
+
sourceUrl,
|
|
235
|
+
body
|
|
236
|
+
} : void 0;
|
|
237
|
+
}
|
|
225
238
|
function extractMediaPlaceholder(rawMessage) {
|
|
226
239
|
const message = unwrapMessage(rawMessage);
|
|
227
240
|
if (!message) return;
|
|
228
241
|
if (message.imageMessage) return "<media:image>";
|
|
229
|
-
if (message.videoMessage) return "<media:video>";
|
|
242
|
+
if (message.videoMessage) return message.videoMessage.gifPlayback === true ? "<media:gif>" : "<media:video>";
|
|
230
243
|
if (message.audioMessage) return "<media:audio>";
|
|
231
244
|
if (message.documentMessage) return "<media:document>";
|
|
232
245
|
if (message.stickerMessage) return "<media:sticker>";
|
|
@@ -781,4 +794,4 @@ function createWebSendApi(params) {
|
|
|
781
794
|
};
|
|
782
795
|
}
|
|
783
796
|
//#endregion
|
|
784
|
-
export {
|
|
797
|
+
export { extractLocationData as _, mayContainWhatsAppOutboundMention as a, extractText as b, DisconnectReason as c, normalizeMessageContent$1 as d, resolveInboundMediaMimetype as f, extractExternalAdReplyContext as g, extractContextInfo as h, addWhatsAppOutboundMentionsToContent as i, downloadMediaMessage as l, extractContactContext as m, listWhatsAppSendResultMessageIds as n, resolveWhatsAppOutboundMentions as o, describeReplyContext as p, normalizeWhatsAppSendResult as r, addWhatsAppImagePreviewFields as s, createWebSendApi as t, isJidGroup as u, extractMediaPlaceholder as v, hasInboundUserContent as x, extractMentionedJids as y };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { o as resolveWebCredsBackupPath, s as resolveWebCredsPath, t as assertWebCredsPathRegularFileOrMissing } from "./creds-files-B1kSWtBg.js";
|
|
2
2
|
import { n as getStatusCode } from "./session-errors-CbsoQqoy.js";
|
|
3
|
-
import {
|
|
3
|
+
import { t as DEFAULT_WHATSAPP_SOCKET_TIMING } from "./socket-timing-DvMNkIge.js";
|
|
4
|
+
import { E as writeWebCredsRawAtomically, S as enqueueCredsSave, T as writeCredsJsonAtomically, b as restoreCredsFromBackupIfNeeded, u as readCredsJsonRaw, w as waitForCredsSaveQueueWithTimeout, y as resolveDefaultWebAuthDir } from "./auth-store-RyuCPHE0.js";
|
|
4
5
|
import { i as makeWASocket, n as fetchLatestBaileysVersion, o as useMultiFileAuthState, r as makeCacheableSignalKeyStore } from "./session.runtime-CyooSQvj.js";
|
|
5
6
|
import { VERSION, formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
6
7
|
import { danger, getChildLogger, success, toPinoLikeLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -8,24 +9,6 @@ import { renderQrTerminal } from "openclaw/plugin-sdk/media-runtime";
|
|
|
8
9
|
import { ensureDir, resolveUserPath } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
9
10
|
import { randomUUID } from "node:crypto";
|
|
10
11
|
import { createHttp1EnvHttpProxyAgent, createHttp1ProxyAgent, createNodeProxyAgent } from "openclaw/plugin-sdk/fetch-runtime";
|
|
11
|
-
//#region extensions/whatsapp/src/socket-timing.ts
|
|
12
|
-
const DEFAULT_WHATSAPP_SOCKET_TIMING = {
|
|
13
|
-
keepAliveIntervalMs: 25e3,
|
|
14
|
-
connectTimeoutMs: 6e4,
|
|
15
|
-
defaultQueryTimeoutMs: 6e4
|
|
16
|
-
};
|
|
17
|
-
function positiveInteger(value) {
|
|
18
|
-
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : void 0;
|
|
19
|
-
}
|
|
20
|
-
function resolveWhatsAppSocketTiming(cfg, overrides) {
|
|
21
|
-
const configured = cfg.web?.whatsapp;
|
|
22
|
-
return {
|
|
23
|
-
keepAliveIntervalMs: positiveInteger(overrides?.keepAliveIntervalMs) ?? positiveInteger(configured?.keepAliveIntervalMs) ?? DEFAULT_WHATSAPP_SOCKET_TIMING.keepAliveIntervalMs,
|
|
24
|
-
connectTimeoutMs: positiveInteger(overrides?.connectTimeoutMs) ?? positiveInteger(configured?.connectTimeoutMs) ?? DEFAULT_WHATSAPP_SOCKET_TIMING.connectTimeoutMs,
|
|
25
|
-
defaultQueryTimeoutMs: positiveInteger(overrides?.defaultQueryTimeoutMs) ?? positiveInteger(configured?.defaultQueryTimeoutMs) ?? DEFAULT_WHATSAPP_SOCKET_TIMING.defaultQueryTimeoutMs
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
12
|
//#region extensions/whatsapp/src/session.ts
|
|
30
13
|
const LOGGED_OUT_STATUS = 401;
|
|
31
14
|
const WHATSAPP_WEBSOCKET_PROXY_TARGET = "https://mmg.whatsapp.net/";
|
|
@@ -234,4 +217,4 @@ function createConnectionTimeoutError(timeoutMs) {
|
|
|
234
217
|
return error;
|
|
235
218
|
}
|
|
236
219
|
//#endregion
|
|
237
|
-
export {
|
|
220
|
+
export { renderQrTerminal as i, newConnectionId as n, waitForWaConnection as r, createWaSocket as t };
|
|
@@ -99,10 +99,10 @@ async function applyWhatsAppSecurityConfigFixes(params) {
|
|
|
99
99
|
//#region extensions/whatsapp/src/shared.ts
|
|
100
100
|
const WHATSAPP_CHANNEL = "whatsapp";
|
|
101
101
|
async function loadWhatsAppChannelRuntime() {
|
|
102
|
-
return await import("./channel.runtime-
|
|
102
|
+
return await import("./channel.runtime-CzHkB9T6.js");
|
|
103
103
|
}
|
|
104
104
|
async function loadWhatsAppSetupSurface() {
|
|
105
|
-
return await import("./setup-surface-
|
|
105
|
+
return await import("./setup-surface-DDpST8Qs.js");
|
|
106
106
|
}
|
|
107
107
|
const whatsappSetupWizardProxy = createWhatsAppSetupWizardProxy(async () => (await loadWhatsAppSetupSurface()).whatsappSetupWizard);
|
|
108
108
|
const whatsappConfigAdapter = createScopedChannelConfigAdapter({
|
|
@@ -2,7 +2,7 @@ import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js"
|
|
|
2
2
|
import { r as hasWebCredsSync } from "./creds-files-B1kSWtBg.js";
|
|
3
3
|
import { a as resolveWhatsAppAccount, o as resolveWhatsAppAuthDir } from "./accounts-DgViSyJx.js";
|
|
4
4
|
import { a as normalizeWhatsAppAllowFromEntries, o as normalizeWhatsAppAllowFromEntry } from "./normalize-target-bVWjgftN.js";
|
|
5
|
-
import { t as whatsappSetupAdapter } from "./setup-core-
|
|
5
|
+
import { t as whatsappSetupAdapter } from "./setup-core-v_nSSRfg.js";
|
|
6
6
|
import { DEFAULT_ACCOUNT_ID, createSetupTranslator, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
7
7
|
import { formatCliCommand, formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
|
|
8
8
|
//#region extensions/whatsapp/src/setup-finalize.ts
|
|
@@ -280,7 +280,7 @@ async function finalizeWhatsAppSetup(params) {
|
|
|
280
280
|
message: linked ? t("wizard.whatsapp.relinkPrompt") : t("wizard.whatsapp.linkNowPrompt"),
|
|
281
281
|
initialValue: !linked
|
|
282
282
|
})) try {
|
|
283
|
-
const { loginWeb } = await import("./login-
|
|
283
|
+
const { loginWeb } = await import("./login-B503Fwb8.js").then((n) => n.n);
|
|
284
284
|
await loginWeb(false, void 0, params.runtime, accountId);
|
|
285
285
|
} catch (error) {
|
|
286
286
|
params.runtime.error(`WhatsApp login failed: ${String(error)}`);
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as whatsappSetupPlugin } from "./channel.setup-
|
|
1
|
+
import { t as whatsappSetupPlugin } from "./channel.setup-XxgR62Qi.js";
|
|
2
2
|
export { whatsappSetupPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as listAccountIds } from "./account-ids-CB5SOWjc.js";
|
|
2
2
|
import { o as resolveWhatsAppAuthDir } from "./accounts-DgViSyJx.js";
|
|
3
|
-
import { a as formatWhatsAppWebAuthStatusState, h as readWebAuthState } from "./auth-store-
|
|
3
|
+
import { a as formatWhatsAppWebAuthStatusState, h as readWebAuthState } from "./auth-store-RyuCPHE0.js";
|
|
4
4
|
import { DEFAULT_ACCOUNT_ID, createSetupTranslator, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
|
|
5
5
|
//#region extensions/whatsapp/src/setup-surface.ts
|
|
6
6
|
const t = createSetupTranslator();
|
|
@@ -36,7 +36,7 @@ const whatsappSetupWizard = {
|
|
|
36
36
|
},
|
|
37
37
|
resolveShouldPromptAccountIds: ({ shouldPromptAccountIds }) => shouldPromptAccountIds,
|
|
38
38
|
credentials: [],
|
|
39
|
-
finalize: async (params) => await (await import("./setup-finalize-
|
|
39
|
+
finalize: async (params) => await (await import("./setup-finalize-BrMLr5Wj.js")).finalizeWhatsAppSetup(params),
|
|
40
40
|
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false),
|
|
41
41
|
onAccountRecorded: (accountId, options) => {
|
|
42
42
|
options?.onAccountId?.(channel, accountId);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
2
|
+
//#region extensions/whatsapp/src/socket-timing.ts
|
|
3
|
+
const DEFAULT_WHATSAPP_SOCKET_TIMING = {
|
|
4
|
+
keepAliveIntervalMs: 25e3,
|
|
5
|
+
connectTimeoutMs: 6e4,
|
|
6
|
+
defaultQueryTimeoutMs: 6e4
|
|
7
|
+
};
|
|
8
|
+
var WhatsAppSocketOperationTimeoutError = class extends Error {
|
|
9
|
+
constructor(operation, timeoutMs) {
|
|
10
|
+
super(`WhatsApp socket ${operation} timed out after ${timeoutMs}ms; delivery state is unknown`);
|
|
11
|
+
this.operation = operation;
|
|
12
|
+
this.timeoutMs = timeoutMs;
|
|
13
|
+
this.deliveryState = "unknown";
|
|
14
|
+
this.name = "WhatsAppSocketOperationTimeoutError";
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
function positiveInteger(value) {
|
|
18
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : void 0;
|
|
19
|
+
}
|
|
20
|
+
function resolveWhatsAppSocketTiming(cfg, overrides) {
|
|
21
|
+
const configured = cfg.web?.whatsapp;
|
|
22
|
+
return {
|
|
23
|
+
keepAliveIntervalMs: positiveInteger(overrides?.keepAliveIntervalMs) ?? positiveInteger(configured?.keepAliveIntervalMs) ?? DEFAULT_WHATSAPP_SOCKET_TIMING.keepAliveIntervalMs,
|
|
24
|
+
connectTimeoutMs: positiveInteger(overrides?.connectTimeoutMs) ?? positiveInteger(configured?.connectTimeoutMs) ?? DEFAULT_WHATSAPP_SOCKET_TIMING.connectTimeoutMs,
|
|
25
|
+
defaultQueryTimeoutMs: positiveInteger(overrides?.defaultQueryTimeoutMs) ?? positiveInteger(configured?.defaultQueryTimeoutMs) ?? DEFAULT_WHATSAPP_SOCKET_TIMING.defaultQueryTimeoutMs
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function isWhatsAppSocketOperationTimeoutError(error) {
|
|
29
|
+
return error instanceof WhatsAppSocketOperationTimeoutError;
|
|
30
|
+
}
|
|
31
|
+
function resolveWhatsAppSocketOperationTimeoutMs(timeoutMs) {
|
|
32
|
+
return resolveTimerTimeoutMs(timeoutMs, DEFAULT_WHATSAPP_SOCKET_TIMING.defaultQueryTimeoutMs);
|
|
33
|
+
}
|
|
34
|
+
async function withWhatsAppSocketOperationTimeout(operation, promise, timeoutMs, onTimeout) {
|
|
35
|
+
const resolvedTimeoutMs = resolveWhatsAppSocketOperationTimeoutMs(timeoutMs);
|
|
36
|
+
let timeout = null;
|
|
37
|
+
try {
|
|
38
|
+
return await Promise.race([promise, new Promise((_, reject) => {
|
|
39
|
+
timeout = setTimeout(() => {
|
|
40
|
+
onTimeout?.();
|
|
41
|
+
reject(new WhatsAppSocketOperationTimeoutError(operation, resolvedTimeoutMs));
|
|
42
|
+
}, resolvedTimeoutMs);
|
|
43
|
+
timeout.unref?.();
|
|
44
|
+
})]);
|
|
45
|
+
} finally {
|
|
46
|
+
if (timeout) clearTimeout(timeout);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function createWhatsAppSocketOperationTimeoutAdapter(sock, timeoutMs, hooks) {
|
|
50
|
+
const operationTimeoutMs = resolveWhatsAppSocketOperationTimeoutMs(timeoutMs);
|
|
51
|
+
return {
|
|
52
|
+
sendMessage: (jid, content, options) => {
|
|
53
|
+
const send = options ? sock.sendMessage(jid, content, options) : sock.sendMessage(jid, content);
|
|
54
|
+
return withWhatsAppSocketOperationTimeout("sendMessage", send, operationTimeoutMs, hooks?.onSendMessageTimeout ? () => hooks.onSendMessageTimeout?.({
|
|
55
|
+
jid,
|
|
56
|
+
promise: send
|
|
57
|
+
}) : void 0);
|
|
58
|
+
},
|
|
59
|
+
sendPresenceUpdate: (presence, jid) => {
|
|
60
|
+
return withWhatsAppSocketOperationTimeout("sendPresenceUpdate", jid === void 0 ? sock.sendPresenceUpdate(presence) : sock.sendPresenceUpdate(presence, jid), operationTimeoutMs);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { resolveWhatsAppSocketTiming as a, resolveWhatsAppSocketOperationTimeoutMs as i, createWhatsAppSocketOperationTimeoutAdapter as n, withWhatsAppSocketOperationTimeout as o, isWhatsAppSocketOperationTimeoutError as r, DEFAULT_WHATSAPP_SOCKET_TIMING as t };
|
|
@@ -7,6 +7,7 @@ import { CONFIG_DIR, escapeRegExp, normalizeE164 as normalizeE164$1, resolveUser
|
|
|
7
7
|
//#region extensions/whatsapp/src/targets-runtime.ts
|
|
8
8
|
const WHATSAPP_FENCE_PLACEHOLDER = "\0FENCE";
|
|
9
9
|
const WHATSAPP_INLINE_CODE_PLACEHOLDER = "\0CODE";
|
|
10
|
+
const WHATSAPP_PLACEHOLDER_TERMINATOR = "\0";
|
|
10
11
|
function assertWebChannel(input) {
|
|
11
12
|
if (input !== "web") throw new Error("Web channel must be 'web'");
|
|
12
13
|
}
|
|
@@ -111,18 +112,19 @@ function markdownToWhatsApp(text) {
|
|
|
111
112
|
const fences = [];
|
|
112
113
|
let result = text.replace(/```[\s\S]*?```/g, (match) => {
|
|
113
114
|
fences.push(match);
|
|
114
|
-
return `${WHATSAPP_FENCE_PLACEHOLDER}${fences.length - 1}`;
|
|
115
|
+
return `${WHATSAPP_FENCE_PLACEHOLDER}${fences.length - 1}${WHATSAPP_PLACEHOLDER_TERMINATOR}`;
|
|
115
116
|
});
|
|
116
117
|
const inlineCodes = [];
|
|
117
118
|
result = result.replace(/`[^`\n]+`/g, (match) => {
|
|
118
119
|
inlineCodes.push(match);
|
|
119
|
-
return `${WHATSAPP_INLINE_CODE_PLACEHOLDER}${inlineCodes.length - 1}`;
|
|
120
|
+
return `${WHATSAPP_INLINE_CODE_PLACEHOLDER}${inlineCodes.length - 1}${WHATSAPP_PLACEHOLDER_TERMINATOR}`;
|
|
120
121
|
});
|
|
121
122
|
result = result.replace(/\*\*(.+?)\*\*/g, "*$1*");
|
|
122
123
|
result = result.replace(/__(.+?)__/g, "*$1*");
|
|
123
124
|
result = result.replace(/~~(.+?)~~/g, "~$1~");
|
|
124
|
-
|
|
125
|
-
result = result.replace(new RegExp(`${escapeRegExp(
|
|
125
|
+
const terminator = escapeRegExp(WHATSAPP_PLACEHOLDER_TERMINATOR);
|
|
126
|
+
result = result.replace(new RegExp(`${escapeRegExp(WHATSAPP_INLINE_CODE_PLACEHOLDER)}(\\d+)${terminator}`, "g"), (_, idx) => inlineCodes[Number(idx)] ?? "");
|
|
127
|
+
result = result.replace(new RegExp(`${escapeRegExp(WHATSAPP_FENCE_PLACEHOLDER)}(\\d+)${terminator}`, "g"), (_, idx) => fences[Number(idx)] ?? "");
|
|
126
128
|
return result;
|
|
127
129
|
}
|
|
128
130
|
//#endregion
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Copyright (c) 2016, Daniel Wirtz All rights reserved.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are
|
|
5
|
+
met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright
|
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer in the
|
|
11
|
+
documentation and/or other materials provided with the distribution.
|
|
12
|
+
* Neither the name of its author, nor the names of its contributors
|
|
13
|
+
may be used to endorse or promote products derived from this software
|
|
14
|
+
without specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
17
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
18
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
19
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
20
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
21
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
23
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
24
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
25
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@protobufjs/aspromise
|
|
2
|
+
=====================
|
|
3
|
+
[](https://www.npmjs.com/package/@protobufjs/aspromise)
|
|
4
|
+
|
|
5
|
+
Returns a promise from a node-style callback function.
|
|
6
|
+
|
|
7
|
+
API
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
* **asPromise(fn: `function`, ctx: `Object`, ...params: `*`): `Promise<*>`**<br />
|
|
11
|
+
Returns a promise from a node-style callback function.
|
|
12
|
+
|
|
13
|
+
**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
|
package/node_modules/{protobufjs/src/util/aspromise.d.ts → @protobufjs/aspromise/index.d.ts}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export = asPromise;
|
|
2
|
-
|
|
3
|
-
type asPromiseCallback = (error: Error | null, ...params: any[]) => {};
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Returns a promise from a node-style callback function.
|
|
7
|
-
* @memberof util
|
|
8
|
-
* @param {asPromiseCallback} fn Function to call
|
|
9
|
-
* @param {*} ctx Function context
|
|
10
|
-
* @param {...*} params Function arguments
|
|
11
|
-
* @returns {Promise<*>} Promisified function
|
|
12
|
-
*/
|
|
13
|
-
declare function asPromise(fn: asPromiseCallback, ctx: any, ...params: any[]): Promise<any>;
|
|
1
|
+
export = asPromise;
|
|
2
|
+
|
|
3
|
+
type asPromiseCallback = (error: Error | null, ...params: any[]) => {};
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns a promise from a node-style callback function.
|
|
7
|
+
* @memberof util
|
|
8
|
+
* @param {asPromiseCallback} fn Function to call
|
|
9
|
+
* @param {*} ctx Function context
|
|
10
|
+
* @param {...*} params Function arguments
|
|
11
|
+
* @returns {Promise<*>} Promisified function
|
|
12
|
+
*/
|
|
13
|
+
declare function asPromise(fn: asPromiseCallback, ctx: any, ...params: any[]): Promise<any>;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
module.exports = asPromise;
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Callback as used by {@link util.asPromise}.
|
|
6
|
-
* @typedef asPromiseCallback
|
|
7
|
-
* @type {function}
|
|
8
|
-
* @param {Error|null} error Error, if any
|
|
9
|
-
* @param {...*} params Additional arguments
|
|
10
|
-
* @returns {undefined}
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Returns a promise from a node-style callback function.
|
|
15
|
-
* @memberof util
|
|
16
|
-
* @param {asPromiseCallback} fn Function to call
|
|
17
|
-
* @param {*} ctx Function context
|
|
18
|
-
* @param {...*} params Function arguments
|
|
19
|
-
* @returns {Promise<*>} Promisified function
|
|
20
|
-
*/
|
|
21
|
-
function asPromise(fn, ctx/*, varargs */) {
|
|
22
|
-
var params = new Array(arguments.length - 1),
|
|
23
|
-
offset = 0,
|
|
24
|
-
index = 2,
|
|
25
|
-
pending = true;
|
|
26
|
-
while (index < arguments.length)
|
|
27
|
-
params[offset++] = arguments[index++];
|
|
28
|
-
return new Promise(function executor(resolve, reject) {
|
|
29
|
-
params[offset] = function callback(err/*, varargs */) {
|
|
30
|
-
if (pending) {
|
|
31
|
-
pending = false;
|
|
32
|
-
if (err)
|
|
33
|
-
reject(err);
|
|
34
|
-
else {
|
|
35
|
-
var params = new Array(arguments.length - 1),
|
|
36
|
-
offset = 0;
|
|
37
|
-
while (offset < params.length)
|
|
38
|
-
params[offset++] = arguments[offset];
|
|
39
|
-
resolve.apply(null, params);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
try {
|
|
44
|
-
fn.apply(ctx || null, params);
|
|
45
|
-
} catch (err) {
|
|
46
|
-
if (pending) {
|
|
47
|
-
pending = false;
|
|
48
|
-
reject(err);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
module.exports = asPromise;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Callback as used by {@link util.asPromise}.
|
|
6
|
+
* @typedef asPromiseCallback
|
|
7
|
+
* @type {function}
|
|
8
|
+
* @param {Error|null} error Error, if any
|
|
9
|
+
* @param {...*} params Additional arguments
|
|
10
|
+
* @returns {undefined}
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns a promise from a node-style callback function.
|
|
15
|
+
* @memberof util
|
|
16
|
+
* @param {asPromiseCallback} fn Function to call
|
|
17
|
+
* @param {*} ctx Function context
|
|
18
|
+
* @param {...*} params Function arguments
|
|
19
|
+
* @returns {Promise<*>} Promisified function
|
|
20
|
+
*/
|
|
21
|
+
function asPromise(fn, ctx/*, varargs */) {
|
|
22
|
+
var params = new Array(arguments.length - 1),
|
|
23
|
+
offset = 0,
|
|
24
|
+
index = 2,
|
|
25
|
+
pending = true;
|
|
26
|
+
while (index < arguments.length)
|
|
27
|
+
params[offset++] = arguments[index++];
|
|
28
|
+
return new Promise(function executor(resolve, reject) {
|
|
29
|
+
params[offset] = function callback(err/*, varargs */) {
|
|
30
|
+
if (pending) {
|
|
31
|
+
pending = false;
|
|
32
|
+
if (err)
|
|
33
|
+
reject(err);
|
|
34
|
+
else {
|
|
35
|
+
var params = new Array(arguments.length - 1),
|
|
36
|
+
offset = 0;
|
|
37
|
+
while (offset < params.length)
|
|
38
|
+
params[offset++] = arguments[offset];
|
|
39
|
+
resolve.apply(null, params);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
fn.apply(ctx || null, params);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
if (pending) {
|
|
47
|
+
pending = false;
|
|
48
|
+
reject(err);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@protobufjs/aspromise",
|
|
3
|
+
"description": "Returns a promise from a node-style callback function.",
|
|
4
|
+
"version": "1.1.2",
|
|
5
|
+
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/dcodeIO/protobuf.js.git"
|
|
9
|
+
},
|
|
10
|
+
"license": "BSD-3-Clause",
|
|
11
|
+
"main": "index.js",
|
|
12
|
+
"types": "index.d.ts",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"istanbul": "^0.4.5",
|
|
15
|
+
"tape": "^4.6.3"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "tape tests/*.js",
|
|
19
|
+
"coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
var tape = require("tape");
|
|
2
|
+
|
|
3
|
+
var asPromise = require("..");
|
|
4
|
+
|
|
5
|
+
tape.test("aspromise", function(test) {
|
|
6
|
+
|
|
7
|
+
test.test(this.name + " - resolve", function(test) {
|
|
8
|
+
|
|
9
|
+
function fn(arg1, arg2, callback) {
|
|
10
|
+
test.equal(this, ctx, "function should be called with this = ctx");
|
|
11
|
+
test.equal(arg1, 1, "function should be called with arg1 = 1");
|
|
12
|
+
test.equal(arg2, 2, "function should be called with arg2 = 2");
|
|
13
|
+
callback(null, arg2);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var ctx = {};
|
|
17
|
+
|
|
18
|
+
var promise = asPromise(fn, ctx, 1, 2);
|
|
19
|
+
promise.then(function(arg2) {
|
|
20
|
+
test.equal(arg2, 2, "promise should be resolved with arg2 = 2");
|
|
21
|
+
test.end();
|
|
22
|
+
}).catch(function(err) {
|
|
23
|
+
test.fail("promise should not be rejected (" + err + ")");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test.test(this.name + " - reject", function(test) {
|
|
28
|
+
|
|
29
|
+
function fn(arg1, arg2, callback) {
|
|
30
|
+
test.equal(this, ctx, "function should be called with this = ctx");
|
|
31
|
+
test.equal(arg1, 1, "function should be called with arg1 = 1");
|
|
32
|
+
test.equal(arg2, 2, "function should be called with arg2 = 2");
|
|
33
|
+
callback(arg1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var ctx = {};
|
|
37
|
+
|
|
38
|
+
var promise = asPromise(fn, ctx, 1, 2);
|
|
39
|
+
promise.then(function() {
|
|
40
|
+
test.fail("promise should not be resolved");
|
|
41
|
+
}).catch(function(err) {
|
|
42
|
+
test.equal(err, 1, "promise should be rejected with err = 1");
|
|
43
|
+
test.end();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test.test(this.name + " - resolve twice", function(test) {
|
|
48
|
+
|
|
49
|
+
function fn(arg1, arg2, callback) {
|
|
50
|
+
test.equal(this, ctx, "function should be called with this = ctx");
|
|
51
|
+
test.equal(arg1, 1, "function should be called with arg1 = 1");
|
|
52
|
+
test.equal(arg2, 2, "function should be called with arg2 = 2");
|
|
53
|
+
callback(null, arg2);
|
|
54
|
+
callback(null, arg1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
var ctx = {};
|
|
58
|
+
var count = 0;
|
|
59
|
+
|
|
60
|
+
var promise = asPromise(fn, ctx, 1, 2);
|
|
61
|
+
promise.then(function(arg2) {
|
|
62
|
+
test.equal(arg2, 2, "promise should be resolved with arg2 = 2");
|
|
63
|
+
if (++count > 1)
|
|
64
|
+
test.fail("promise should not be resolved twice");
|
|
65
|
+
test.end();
|
|
66
|
+
}).catch(function(err) {
|
|
67
|
+
test.fail("promise should not be rejected (" + err + ")");
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test.test(this.name + " - reject twice", function(test) {
|
|
72
|
+
|
|
73
|
+
function fn(arg1, arg2, callback) {
|
|
74
|
+
test.equal(this, ctx, "function should be called with this = ctx");
|
|
75
|
+
test.equal(arg1, 1, "function should be called with arg1 = 1");
|
|
76
|
+
test.equal(arg2, 2, "function should be called with arg2 = 2");
|
|
77
|
+
callback(arg1);
|
|
78
|
+
callback(arg2);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var ctx = {};
|
|
82
|
+
var count = 0;
|
|
83
|
+
|
|
84
|
+
var promise = asPromise(fn, ctx, 1, 2);
|
|
85
|
+
promise.then(function() {
|
|
86
|
+
test.fail("promise should not be resolved");
|
|
87
|
+
}).catch(function(err) {
|
|
88
|
+
test.equal(err, 1, "promise should be rejected with err = 1");
|
|
89
|
+
if (++count > 1)
|
|
90
|
+
test.fail("promise should not be rejected twice");
|
|
91
|
+
test.end();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test.test(this.name + " - reject error", function(test) {
|
|
96
|
+
|
|
97
|
+
function fn(callback) {
|
|
98
|
+
test.ok(arguments.length === 1 && typeof callback === "function", "function should be called with just a callback");
|
|
99
|
+
throw 3;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
var promise = asPromise(fn, null);
|
|
103
|
+
promise.then(function() {
|
|
104
|
+
test.fail("promise should not be resolved");
|
|
105
|
+
}).catch(function(err) {
|
|
106
|
+
test.equal(err, 3, "promise should be rejected with err = 3");
|
|
107
|
+
test.end();
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test.test(this.name + " - reject and error", function(test) {
|
|
112
|
+
|
|
113
|
+
function fn(callback) {
|
|
114
|
+
callback(3);
|
|
115
|
+
throw 4;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
var count = 0;
|
|
119
|
+
|
|
120
|
+
var promise = asPromise(fn, null);
|
|
121
|
+
promise.then(function() {
|
|
122
|
+
test.fail("promise should not be resolved");
|
|
123
|
+
}).catch(function(err) {
|
|
124
|
+
test.equal(err, 3, "promise should be rejected with err = 3");
|
|
125
|
+
if (++count > 1)
|
|
126
|
+
test.fail("promise should not be rejected twice");
|
|
127
|
+
test.end();
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
});
|