@open-wa/wa-automate-types-only 4.44.4 → 4.44.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,3 +3,7 @@ import { Page } from 'puppeteer';
3
3
  * @private
4
4
  */
5
5
  export declare function injectInitPatch(page: Page): Promise<void>;
6
+ /**
7
+ * @private
8
+ */
9
+ export declare function injectProgObserver(page: Page): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { Client } from './api/Client';
2
+ import { SimpleListener } from './api/model';
1
3
  export * from './api/model';
2
4
  export * from './api/Client';
3
5
  export { create } from './controllers/initializer';
@@ -6,5 +8,6 @@ export { ev, Spin } from './controllers/events';
6
8
  export * from './utils/tools';
7
9
  export * from './logging/logging';
8
10
  export * from './structures/preProcessors';
9
- export * from './connect';
11
+ export * from '@open-wa/wa-automate-socket-client';
12
+ export { Client, SimpleListener };
10
13
  export * from './build/build-postman';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate-types-only",
3
- "version": "4.44.4",
3
+ "version": "4.44.7",
4
4
  "description": "Types generated from the @open-wa/wa-automate package",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -1 +0,0 @@
1
- export * from './socket';
@@ -1,96 +0,0 @@
1
- import { EventEmitter2 } from 'eventemitter2';
2
- import { Socket } from "socket.io-client";
3
- import { Client } from "../api/Client";
4
- import { SimpleListener } from "../api/model/events";
5
- import { Chat, ChatId, Message } from '..';
6
- import { MessageCollector } from '../structures/MessageCollector';
7
- import { CollectorFilter, CollectorOptions } from '../structures/Collector';
8
- /**
9
- * A convenience type that includes all keys from the `Client`.
10
- */
11
- export declare type ClientMethods = keyof Client;
12
- /**
13
- * [ALPHA - API will 100% change in the near future. Don't say I didn't warn you.]
14
- *
15
- *
16
- * An easy to use socket implementation that allows users to connect into remote instances of the EASY API.
17
- *
18
- * How to use it:
19
- *
20
- * 1. Make sure you're running an instance of the EASY API and make sure to start it with the `--socket` flag
21
- * ```bash
22
- * > docker run -e PORT=8080 -p 8080:8080 openwa/wa-automate:latest --socket
23
- * ```
24
- * 2. Use this in your code:
25
- *
26
- * ```javascript
27
- * import { SocketClient } from "@open-wa/wa-automate";
28
- *
29
- * SocketClient.connect("http://localhost:8080").then(async client => {
30
- * //now you can use the client similar to how you would use the http express middleware.
31
- *
32
- * //There are two main commands from this client
33
- *
34
- * // 1. client.listen - use this for your listeners
35
- *
36
- * await client.listen("onMessage", message => {
37
- * ...
38
- * })
39
- *
40
- * // 2. client.asj - ask the main host client to get things done
41
- *
42
- * await client.ask("sendText", {
43
- * "to" : "44771234567@c.us",
44
- * "content": "hellow socket"
45
- * })
46
- *
47
- * // or you can send the arguments in order as an array (or tuple, as the cool kids would say)
48
- * await client.ask("sendText", [
49
- * "44771234567@c.us",
50
- * "hellow socket"
51
- * ])
52
- *
53
- * })
54
- * ```
55
- */
56
- export declare class SocketClient {
57
- url: string;
58
- apiKey: string;
59
- socket: Socket;
60
- /**
61
- * A local version of the `ev` EventEmitter2
62
- */
63
- ev: EventEmitter2;
64
- listeners: {
65
- [listener in SimpleListener]?: {
66
- [id: string]: (data: any) => any;
67
- };
68
- };
69
- /**
70
- * The main way to create the socket based client.
71
- * @param url URL of the socket server (i.e the EASY API instance address)
72
- * @param apiKey optional api key if set
73
- * @returns SocketClient
74
- */
75
- static connect(url: string, apiKey?: string, ev?: boolean): Promise<SocketClient & Client>;
76
- createMessageCollector(c: Message | ChatId | Chat, filter: CollectorFilter<[Message]>, options: CollectorOptions): Promise<MessageCollector>;
77
- constructor(url: string, apiKey?: string, ev?: boolean);
78
- ask<M extends ClientMethods, P extends Parameters<Pick<Client, M>[M]>>(method: M, args?: any[] | P | {
79
- [k: string]: unknown;
80
- }): Promise<unknown>;
81
- /**
82
- * Set a callback on a simple listener
83
- * @param listener The listener name (e.g onMessage, onAnyMessage, etc.)
84
- * @param callback The callback you need to run on the selected listener
85
- * @returns The id of the callback
86
- */
87
- listen(listener: SimpleListener, callback: (data: unknown) => void): Promise<string>;
88
- /**
89
- * Discard a callback
90
- *
91
- * @param listener The listener name (e.g onMessage, onAnyMessage, etc.)
92
- * @param callbackId The ID from `listen`
93
- * @returns boolean - true if the callback was found and discarded, false if the callback is not found
94
- */
95
- stopListener(listener: SimpleListener, callbackId: string): boolean;
96
- }