@open-wa/wa-automate-types-only 4.55.0 → 4.55.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/Client.d.ts +17 -1
- package/dist/api/model/events.d.ts +6 -1
- package/dist/api/model/group-metadata.d.ts +23 -1
- package/package.json +1 -1
- package/dist/connect/index.d.ts +0 -1
- package/dist/connect/socket.d.ts +0 -96
- package/dist/controllers/browser.ignore.d.ts +0 -13
- package/dist/controllers/data_dir_watcher.d.ts +0 -2
- package/dist/utils/configSchema.d.ts +0 -5
- package/dist/utils/elastic.d.ts +0 -50
package/dist/api/Client.d.ts
CHANGED
@@ -4,7 +4,7 @@ import { Chat, LiveLocationChangedEvent, ChatState, ChatMuteDuration, GroupChatC
|
|
4
4
|
import { Contact, NumberCheck } from './model/contact';
|
5
5
|
import { Message, MessageInfo, PollData } from './model/message';
|
6
6
|
import { AxiosRequestConfig } from 'axios';
|
7
|
-
import { NewCommunityGroup, ParticipantChangedEventModel } from './model/group-metadata';
|
7
|
+
import { NewCommunityGroup, ParticipantChangedEventModel, GenericGroupChangeEvent } from './model/group-metadata';
|
8
8
|
import { ConfigObject, STATE, LicenseType, Webhook, EventPayload } from './model';
|
9
9
|
import PQueue, { DefaultAddOptions, Options } from 'p-queue';
|
10
10
|
import { HealthCheck, SessionInfo } from './model/sessionInfo';
|
@@ -200,8 +200,16 @@ export declare class Client {
|
|
200
200
|
*/
|
201
201
|
onBroadcast(fn: (message: Message) => void): Promise<Listener | boolean>;
|
202
202
|
/**
|
203
|
+
* @deprecated
|
204
|
+
*
|
203
205
|
* Listens to battery changes
|
204
206
|
*
|
207
|
+
* :::caution
|
208
|
+
*
|
209
|
+
* This will most likely not work with multi-device mode (the only remaining mode) since the session is no longer connected to the phone but directly to WA servers.
|
210
|
+
*
|
211
|
+
* :::
|
212
|
+
*
|
205
213
|
* @event
|
206
214
|
* @param fn callback
|
207
215
|
* @fires number
|
@@ -316,6 +324,14 @@ export declare class Client {
|
|
316
324
|
* @returns `true` if the callback was registered
|
317
325
|
*/
|
318
326
|
onGlobalParticipantsChanged(fn: (participantChangedEvent: ParticipantChangedEventModel) => void): Promise<Listener | boolean>;
|
327
|
+
/**
|
328
|
+
* Listens to all group (gp2) events. This can be useful if you want to catch when a group title, subject or picture is changed.
|
329
|
+
*
|
330
|
+
* @event
|
331
|
+
* @param fn callback function that handles a [[ParticipantChangedEventModel]] as the first and only parameter.
|
332
|
+
* @returns `true` if the callback was registered
|
333
|
+
*/
|
334
|
+
onGroupChange(fn: (genericGroupChangeEvent: GenericGroupChangeEvent) => void): Promise<Listener | boolean>;
|
319
335
|
/**
|
320
336
|
* Fires callback with Chat object every time the host phone is added to a group.
|
321
337
|
*
|
@@ -107,5 +107,10 @@ export declare enum SimpleListener {
|
|
107
107
|
* Requires licence
|
108
108
|
* Represents [[onReaction]]
|
109
109
|
*/
|
110
|
-
Reaction = "onReaction"
|
110
|
+
Reaction = "onReaction",
|
111
|
+
/**
|
112
|
+
* Requires licence
|
113
|
+
* Represents [[onGroupChange]]
|
114
|
+
*/
|
115
|
+
GroupChange = "onGroupChange"
|
111
116
|
}
|
@@ -1,5 +1,7 @@
|
|
1
|
-
import { ChatId, ContactId, GroupChatId, NonSerializedId, DataURL, GroupId } from './aliases';
|
1
|
+
import { ChatId, ContactId, GroupChatId, NonSerializedId, DataURL, GroupId, MessageId } from './aliases';
|
2
|
+
import { Contact } from './contact';
|
2
3
|
export interface Participant {
|
4
|
+
contact: Contact;
|
3
5
|
id: NonSerializedId;
|
4
6
|
isAdmin: boolean;
|
5
7
|
isSuperAdmin: boolean;
|
@@ -100,3 +102,23 @@ export interface NewCommunityGroup {
|
|
100
102
|
icon?: DataURL;
|
101
103
|
ephemeralDuration?: number;
|
102
104
|
}
|
105
|
+
export interface GenericGroupChangeEvent {
|
106
|
+
/**
|
107
|
+
* The contact who triggered this event. (E.g the contact who changed the group picture)
|
108
|
+
*/
|
109
|
+
author: Contact;
|
110
|
+
/**
|
111
|
+
* Some more information about the event
|
112
|
+
*/
|
113
|
+
body: string;
|
114
|
+
groupMetadata: GroupMetadata;
|
115
|
+
/**
|
116
|
+
* Base 64 encoded image
|
117
|
+
*/
|
118
|
+
groupPic: string;
|
119
|
+
id: MessageId;
|
120
|
+
/**
|
121
|
+
* Type of the event
|
122
|
+
*/
|
123
|
+
type: 'picutre' | 'create' | 'delete' | 'subject' | 'revoke_invite' | 'description' | 'restrict' | 'announce' | 'no_frequently_forwarded' | 'announce_msg_bounce' | 'add' | 'remove' | 'demote' | 'promote' | 'invite' | 'leave' | 'modify' | 'v4_add_invite_sent' | 'v4_add_invite_join' | 'growth_locked' | 'growth_unlocked' | 'linked_group_join';
|
124
|
+
}
|
package/package.json
CHANGED
package/dist/connect/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './socket';
|
package/dist/connect/socket.d.ts
DELETED
@@ -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 baed 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
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { Browser, Page } from 'puppeteer';
|
2
|
-
import { Spin } from './events';
|
3
|
-
import { ConfigObject } from '../api/model';
|
4
|
-
export declare let BROWSER_START_TS: number;
|
5
|
-
export declare function initPage(sessionId?: string, config?: ConfigObject, customUserAgent?: string, spinner?: Spin, _page?: Page, skipAuth?: boolean): Promise<Page>;
|
6
|
-
export declare const deleteSessionData: (config: ConfigObject) => boolean;
|
7
|
-
export declare const getSessionDataFilePath: (sessionId: string, config: ConfigObject) => string | boolean;
|
8
|
-
export declare const addScript: (page: Page, js: string) => Promise<unknown>;
|
9
|
-
export declare function injectApi(page: Page): Promise<Page>;
|
10
|
-
/**
|
11
|
-
* @internal
|
12
|
-
*/
|
13
|
-
export declare const kill: (p: Page, b?: Browser, exit?: boolean, pid?: number, reason?: string) => Promise<void>;
|
package/dist/utils/elastic.d.ts
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
import { Request, Response } from "express";
|
2
|
-
type CustomResponse = Response & {
|
3
|
-
_swsReq: any;
|
4
|
-
};
|
5
|
-
export declare class ElasticEmitter {
|
6
|
-
queue: any;
|
7
|
-
pipeline: any;
|
8
|
-
username: any;
|
9
|
-
password: any;
|
10
|
-
elasticURL: any;
|
11
|
-
enabled: boolean;
|
12
|
-
lastFlush: any;
|
13
|
-
hostname: any;
|
14
|
-
sanitize: any;
|
15
|
-
version: string;
|
16
|
-
es7: boolean;
|
17
|
-
ES_MAX_BUFF: number;
|
18
|
-
indexBuffer: string;
|
19
|
-
bufferCount: number;
|
20
|
-
indexPrefix: string;
|
21
|
-
ip: any;
|
22
|
-
/**
|
23
|
-
*
|
24
|
-
* @param elasticUrl Elastic search endpoint URL
|
25
|
-
* @param username Elastic username
|
26
|
-
* @param password Elastic passowrd
|
27
|
-
* @param pipeline Pipeline to send the RRR
|
28
|
-
*/
|
29
|
-
constructor(elasticURL: string, username: string, password: string, max?: number, pipeline?: string, indexPrefix?: string);
|
30
|
-
private get elasticURLBulk();
|
31
|
-
private initTemplate;
|
32
|
-
processRecord(rrr: any): Promise<void>;
|
33
|
-
flush(): Promise<void>;
|
34
|
-
elasticMiddleware(config: {
|
35
|
-
sanitize: Function;
|
36
|
-
}): (req: Request, res: CustomResponse, next: any) => unknown;
|
37
|
-
private collectRequestResponseData;
|
38
|
-
private handleRequest;
|
39
|
-
private processRequest;
|
40
|
-
private processResponse;
|
41
|
-
}
|
42
|
-
export declare const getStatusCodeClass: (code: number) => string;
|
43
|
-
export declare const swsStringRecursive: (output: any, val: any) => any;
|
44
|
-
export declare const swsStringValue: (val: any) => string;
|
45
|
-
export declare const getPort: (req: any) => number;
|
46
|
-
export declare const getResponseContentLength: (req: any, res: any) => any;
|
47
|
-
export declare const getRemoteIP: (req: any) => string;
|
48
|
-
export declare const getRemoteRealIP: (req: any) => any;
|
49
|
-
export declare const getApiOpParameterValues: (path: any, method: any, req: any) => {};
|
50
|
-
export {};
|