@open-wa/wa-automate-types-only 4.49.1 → 4.51.5

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.
@@ -654,7 +654,7 @@ export declare class Client {
654
654
  * @param hideTags boolean default: false [INSIDERS] set this to try silent tag someone in the caption
655
655
  * @returns `Promise <boolean | string>` This will either return true or the id of the message. It will return true after 10 seconds even if waitForId is true
656
656
  */
657
- sendImage(to: ChatId, file: AdvancedFile, filename: string, caption: Content, quotedMsgId?: MessageId, waitForId?: boolean, ptt?: boolean, withoutPreview?: boolean, hideTags?: boolean, viewOnce?: boolean): Promise<MessageId | boolean>;
657
+ sendImage(to: ChatId, file: AdvancedFile, filename: string, caption: Content, quotedMsgId?: MessageId, waitForId?: boolean, ptt?: boolean, withoutPreview?: boolean, hideTags?: boolean, viewOnce?: boolean, requestConfig?: any): Promise<MessageId | boolean>;
658
658
  /**
659
659
  * Automatically sends a youtube link with the auto generated link preview. You can also add a custom message.
660
660
  * @param chatId
@@ -713,7 +713,7 @@ export declare class Client {
713
713
  * @param hideTags boolean default: false [INSIDERS] set this to try silent tag someone in the caption
714
714
  * @returns `Promise <boolean | MessageId>` This will either return true or the id of the message. It will return true after 10 seconds even if waitForId is true
715
715
  */
716
- sendFile(to: ChatId, file: AdvancedFile, filename: string, caption: Content, quotedMsgId?: MessageId, waitForId?: boolean, ptt?: boolean, withoutPreview?: boolean, hideTags?: boolean, viewOnce?: boolean): Promise<MessageId | boolean>;
716
+ sendFile(to: ChatId, file: AdvancedFile, filename: string, caption: Content, quotedMsgId?: MessageId, waitForId?: boolean, ptt?: boolean, withoutPreview?: boolean, hideTags?: boolean, viewOnce?: boolean, requestConfig?: any): Promise<MessageId | boolean>;
717
717
  /**
718
718
  * {@license:insiders@}
719
719
  *
@@ -737,6 +737,13 @@ export declare class Client {
737
737
  * @param quotedMsgId string true_0000000000@c.us_JHB2HB23HJ4B234HJB to send as a reply to a message
738
738
  */
739
739
  sendAudio(to: ChatId, file: AdvancedFile, quotedMsgId?: MessageId): Promise<MessageId>;
740
+ /**
741
+ * Send a poll to a group chat
742
+ * @param to chat id - a group chat is required
743
+ * @param name the name of the poll
744
+ * @param options an array of poll options
745
+ */
746
+ sendPoll(to: GroupChatId, name: string, options: string[]): Promise<MessageId>;
740
747
  /**
741
748
  * Sends a video to given chat as a gif, with caption or not, using base64
742
749
  * @param to chat id `xxxxx@c.us`
@@ -1,26 +1,26 @@
1
- declare type Brand<K, T> = K & {
1
+ type Brand<K, T> = K & {
2
2
  __brand?: T;
3
3
  };
4
4
  /**
5
5
  * The suffix used to identify a non-group chat id
6
6
  */
7
- export declare type ChatServer = 'c.us';
7
+ export type ChatServer = 'c.us';
8
8
  /**
9
9
  * The suffix used to identify a group chat id
10
10
  */
11
- export declare type GroupChatServer = 'g.us';
11
+ export type GroupChatServer = 'g.us';
12
12
  /**
13
13
  * A type alias for all available "servers"
14
14
  */
15
- export declare type WaServers = ChatServer | GroupChatServer;
15
+ export type WaServers = ChatServer | GroupChatServer;
16
16
  /**
17
17
  * Type alias representing all available country codes
18
18
  */
19
- export declare type CountryCode = 1 | 7 | 20 | 27 | 30 | 31 | 32 | 33 | 34 | 36 | 39 | 40 | 41 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 81 | 82 | 84 | 86 | 90 | 91 | 92 | 93 | 94 | 95 | 98 | 211 | 212 | 213 | 216 | 218 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 290 | 291 | 297 | 298 | 299 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 380 | 381 | 382 | 383 | 385 | 386 | 387 | 389 | 420 | 421 | 423 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 670 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 850 | 852 | 853 | 855 | 856 | 880 | 886 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 992 | 993 | 994 | 995 | 996 | 998;
19
+ export type CountryCode = 1 | 7 | 20 | 27 | 30 | 31 | 32 | 33 | 34 | 36 | 39 | 40 | 41 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 81 | 82 | 84 | 86 | 90 | 91 | 92 | 93 | 94 | 95 | 98 | 211 | 212 | 213 | 216 | 218 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 290 | 291 | 297 | 298 | 299 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 380 | 381 | 382 | 383 | 385 | 386 | 387 | 389 | 420 | 421 | 423 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 670 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 850 | 852 | 853 | 855 | 856 | 880 | 886 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 992 | 993 | 994 | 995 | 996 | 998;
20
20
  /**
21
21
  * The account number. It is made up of a country code and then the local number without the preceeding 0. For example, if a UK (+44) wa account is linked to the number 07123456789 then the account number will be 447123456789.
22
22
  */
23
- export declare type AccountNumber = `${number}`;
23
+ export type AccountNumber = `${number}`;
24
24
  /**
25
25
  * A group chat ends with `@g.us` and usually has two parts, the timestamp of when it was created, and the user id of the number that created the group. For example `[creator number]-[timestamp]@g.us`
26
26
  *
@@ -28,7 +28,7 @@ export declare type AccountNumber = `${number}`;
28
28
  *
29
29
  * `"447123456789-1445627445@g.us"`
30
30
  */
31
- export declare type GroupChatId = `${AccountNumber}-${number}@${GroupChatServer}` | `${number}@${GroupChatServer}`;
31
+ export type GroupChatId = `${AccountNumber}-${number}@${GroupChatServer}` | `${number}@${GroupChatServer}`;
32
32
  /**
33
33
  * A contact id ends with `@c.us` and only contains the number of the contact. For example, if the country code of a contact is `44` and their number is `7123456789` then the contact id would be `447123456789@c.us`
34
34
  *
@@ -36,7 +36,7 @@ export declare type GroupChatId = `${AccountNumber}-${number}@${GroupChatServer}
36
36
  *
37
37
  * `"447123456789@c.us"`
38
38
  */
39
- export declare type ContactId = Brand<`${AccountNumber}@${ChatServer}`, "ContactId">;
39
+ export type ContactId = Brand<`${AccountNumber}@${ChatServer}`, "ContactId">;
40
40
  /**
41
41
  * A chat id ends with `@c.us` or `@g.us` for group chats.
42
42
  *
@@ -46,7 +46,7 @@ export declare type ContactId = Brand<`${AccountNumber}@${ChatServer}`, "Contact
46
46
  * A group chat: `"447123456789@g.us"`
47
47
  *
48
48
  */
49
- export declare type ChatId = ContactId | GroupChatId;
49
+ export type ChatId = ContactId | GroupChatId;
50
50
  /**
51
51
  * The id of a message. The format is `[boolean]_[ChatId]_[random character string]`
52
52
  *
@@ -54,7 +54,7 @@ export declare type ChatId = ContactId | GroupChatId;
54
54
  *
55
55
  * `"false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB"`
56
56
  */
57
- export declare type MessageId = Brand<`${boolean}_${ChatId}_${string}`, "MessageId">;
57
+ export type MessageId = Brand<`${boolean}_${ChatId}_${string}`, "MessageId">;
58
58
  /**
59
59
  * This is a generic type alias for the content of a message
60
60
  *
@@ -62,8 +62,8 @@ export declare type MessageId = Brand<`${boolean}_${ChatId}_${string}`, "Message
62
62
  *
63
63
  * `"hello!"`
64
64
  */
65
- export declare type Content = Brand<string, "Content">;
66
- export declare type NonSerializedId = {
65
+ export type Content = Brand<string, "Content">;
66
+ export type NonSerializedId = {
67
67
  server: WaServers;
68
68
  user: AccountNumber;
69
69
  _serialized: ContactId;
@@ -80,7 +80,7 @@ export declare type NonSerializedId = {
80
80
  *
81
81
  * Learn more here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
82
82
  */
83
- export declare type DataURL = Brand<`data:${string};base64,${Base64}`, "DataURL">;
83
+ export type DataURL = Brand<`data:${string};base64,${Base64}`, "DataURL">;
84
84
  /**
85
85
  * Base64 is basically a file encoded as a string.
86
86
  *
@@ -88,19 +88,19 @@ export declare type DataURL = Brand<`data:${string};base64,${Base64}`, "DataURL"
88
88
  *
89
89
  * Learn more here: https://developer.mozilla.org/en-US/docs/Glossary/Base64
90
90
  */
91
- export declare type Base64 = Brand<string, "Base64">;
91
+ export type Base64 = Brand<string, "Base64">;
92
92
  /**
93
93
  * The relative or absolute path of a file
94
94
  *
95
95
  * Learn more here: https://www.w3schools.com/html/html_filepaths.asp
96
96
  */
97
- export declare type FilePath = Brand<string, "FilePath">;
97
+ export type FilePath = Brand<string, "FilePath">;
98
98
  /**
99
99
  * A URL of a file used with a GET request
100
100
  */
101
- export declare type GetURL = Brand<string, "GetURL">;
101
+ export type GetURL = Brand<string, "GetURL">;
102
102
  /**
103
103
  * Some file based actions in open-wa are powerful enough to take a dataurl, url or filepath
104
104
  */
105
- export declare type AdvancedFile = DataURL | FilePath | GetURL;
105
+ export type AdvancedFile = DataURL | FilePath | GetURL;
106
106
  export {};
@@ -105,7 +105,7 @@ export interface GroupChat extends BaseChat {
105
105
  */
106
106
  isGroup: true;
107
107
  }
108
- export declare type Chat = SingleChat | GroupChat;
108
+ export type Chat = SingleChat | GroupChat;
109
109
  export interface LiveLocationChangedEvent {
110
110
  id: string;
111
111
  lat: number;
@@ -210,4 +210,4 @@ export interface GroupChatCreationResponse {
210
210
  /**
211
211
  * Ephemeral duration can be 1 day, 7 days or 90 days. The default is 1 day.
212
212
  */
213
- export declare type EphemeralDuration = 86400 | 604800 | 7776000;
213
+ export type EphemeralDuration = 86400 | 604800 | 7776000;
@@ -36,16 +36,16 @@ export declare enum DIRECTORY_STRATEGY {
36
36
  */
37
37
  DATE_CHAT = "DATE_CHAT"
38
38
  }
39
- declare type SessionId = string;
40
- declare type LicenseKey = string;
41
- declare type HostAccountNumber = `${number}`;
42
- declare type HostAccountNumberOrSessionID = HostAccountNumber | SessionId;
43
- declare type LicenseKeyConfigObject = {
39
+ type SessionId = string;
40
+ type LicenseKey = string;
41
+ type HostAccountNumber = `${number}`;
42
+ type HostAccountNumberOrSessionID = HostAccountNumber | SessionId;
43
+ type LicenseKeyConfigObject = {
44
44
  [key: HostAccountNumberOrSessionID]: LicenseKey;
45
45
  };
46
- declare type LicenseKeyConfigFunctionReturn = LicenseKeyConfigObject | LicenseKey;
47
- declare type LicenseKeyConfigFunction = (sessionId?: SessionId, number?: HostAccountNumber) => LicenseKeyConfigFunctionReturn | Promise<LicenseKeyConfigFunctionReturn>;
48
- declare type LicenseKeyConfig = LicenseKeyConfigFunction | LicenseKeyConfigObject | LicenseKey;
46
+ type LicenseKeyConfigFunctionReturn = LicenseKeyConfigObject | LicenseKey;
47
+ type LicenseKeyConfigFunction = (sessionId?: SessionId, number?: HostAccountNumber) => LicenseKeyConfigFunctionReturn | Promise<LicenseKeyConfigFunctionReturn>;
48
+ type LicenseKeyConfig = LicenseKeyConfigFunction | LicenseKeyConfigObject | LicenseKey;
49
49
  /**
50
50
  * The available languages for the host security notification
51
51
  */
@@ -799,7 +799,7 @@ export interface ConfigObject {
799
799
  /**@internal */
800
800
  [x: string]: any;
801
801
  }
802
- export declare type AdvancedConfig = ConfigObject & {
802
+ export type AdvancedConfig = ConfigObject & {
803
803
  licenseKey: LicenseKeyConfig;
804
804
  };
805
805
  export {};
@@ -100,7 +100,7 @@ export declare enum STATE {
100
100
  */
101
101
  DISCONNECTED = "DISCONNECTED"
102
102
  }
103
- export declare type EasyApiResponse = {
103
+ export type EasyApiResponse = {
104
104
  success: boolean;
105
105
  response: any;
106
106
  };
@@ -1,4 +1,4 @@
1
- export declare type StickerMetadata = {
1
+ export type StickerMetadata = {
2
2
  /**
3
3
  * The author of the sticker
4
4
  * @default ``
@@ -53,7 +53,7 @@ export declare type StickerMetadata = {
53
53
  */
54
54
  cornerRadius?: number;
55
55
  };
56
- export declare type Mp4StickerConversionProcessOptions = {
56
+ export type Mp4StickerConversionProcessOptions = {
57
57
  /**
58
58
  * Desired Frames per second of the sticker output
59
59
  * @default `10`
@@ -70,7 +70,8 @@ export interface Message {
70
70
  */
71
71
  to: ChatId;
72
72
  /**
73
- * Indicates whether the message was sent by the host account
73
+ * Indicates whether the message is coming into the session or going out of the session. You can have a message sent by the host account show as `in` when the message was sent from another
74
+ * session or from the host account device itself.
74
75
  */
75
76
  self: "in" | "out";
76
77
  /**
@@ -3,7 +3,7 @@ import { Message, MessageAck } from "./message";
3
3
  /**
4
4
  * A reaction is identified the specific emoji.
5
5
  */
6
- export declare type Reaction = {
6
+ export type Reaction = {
7
7
  /**
8
8
  * The aggregate emoji used for the reaction.
9
9
  */
@@ -24,7 +24,7 @@ export declare type Reaction = {
24
24
  /**
25
25
  * The specific reaction by a user
26
26
  */
27
- export declare type ReactionRecord = {
27
+ export type ReactionRecord = {
28
28
  /**
29
29
  * The acknowledgement of the reaction
30
30
  */
@@ -56,7 +56,7 @@ export declare type ReactionRecord = {
56
56
  /**
57
57
  * Emitted by onReaction
58
58
  */
59
- export declare type ReactionEvent = {
59
+ export type ReactionEvent = {
60
60
  /**
61
61
  * The message being reacted to
62
62
  */
@@ -2,6 +2,6 @@ import { Client } from '../..';
2
2
  import { cliFlags } from '../server';
3
3
  import { Request, Response } from "express";
4
4
  export declare const chatwoot_webhook_check_event_name = "cli.integrations.chatwoot.check";
5
- export declare type expressMiddleware = (req: Request, res: Response) => Promise<Response<any, Record<string, any>>>;
5
+ export type expressMiddleware = (req: Request, res: Response) => Promise<Response<any, Record<string, any>>>;
6
6
  export declare const chatwootMiddleware: (cliConfig: cliFlags, client: Client) => expressMiddleware;
7
7
  export declare const setupChatwootOutgoingMessageHandler: (cliConfig: cliFlags, client: Client) => Promise<void>;
@@ -3,7 +3,7 @@ import http from 'http';
3
3
  import { Client } from '..';
4
4
  export declare const app: import("express-serve-static-core").Express;
5
5
  export declare let server: http.Server;
6
- export declare type cliFlags = {
6
+ export type cliFlags = {
7
7
  [k: string]: number | string | boolean;
8
8
  };
9
9
  export declare const setupHttpServer: (cliConfig: cliFlags) => void;
@@ -4,9 +4,9 @@ import { ConfigObject } from '../api/model';
4
4
  import { QRManager } from './auth';
5
5
  export declare let BROWSER_START_TS: number;
6
6
  export declare function initPage(sessionId?: string, config?: ConfigObject, qrManager?: QRManager, customUserAgent?: string, spinner?: Spin, _page?: Page, skipAuth?: boolean): Promise<Page>;
7
- export declare const deleteSessionData: (config: ConfigObject) => boolean;
8
- export declare const invalidateSesssionData: (config: ConfigObject) => boolean;
9
- export declare const getSessionDataFilePath: (sessionId: string, config: ConfigObject) => string | false;
7
+ export declare const deleteSessionData: (config: ConfigObject) => Promise<boolean>;
8
+ export declare const invalidateSesssionData: (config: ConfigObject) => Promise<boolean>;
9
+ export declare const getSessionDataFilePath: (sessionId: string, config: ConfigObject) => Promise<string | false>;
10
10
  export declare const addScript: (page: Page, js: string) => Promise<unknown>;
11
11
  export declare function injectPreApiScripts(page: Page, spinner?: Spin): Promise<Page>;
12
12
  export declare function injectWapi(page: Page, spinner?: Spin, force?: boolean): Promise<Page>;
@@ -29,7 +29,7 @@ export declare const addRotateFileLogTransport: (options?: any) => void;
29
29
  * @private
30
30
  */
31
31
  export declare const addSysLogTransport: (options?: any) => void;
32
- export declare type ConfigLogTransport = {
32
+ export type ConfigLogTransport = {
33
33
  /**
34
34
  * The type of winston transport. At the moment only `file`, `console`, `ev` and `syslog` are supported.
35
35
  */
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  /**
3
4
  * This code is a copy of the Discord Collector: https://github.com/discordjs/discord.js/blob/stable/src/structures/interfaces/Collector.js
4
5
  *
@@ -16,7 +17,7 @@ export declare class Collection<K, V> extends BaseCollection<K, V> {
16
17
  * @param {Collection} collection The items collected by this collector
17
18
  * @returns {boolean|Promise<boolean>}
18
19
  */
19
- export declare type CollectorFilter<T extends any[]> = (...args: T) => boolean | Promise<boolean>;
20
+ export type CollectorFilter<T extends any[]> = (...args: T) => boolean | Promise<boolean>;
20
21
  /**
21
22
  * Options to be applied to the collector.
22
23
  */
@@ -20,7 +20,7 @@ export interface DialogTemplate {
20
20
  [key: string]: DialogProperty;
21
21
  };
22
22
  }
23
- export declare type CheckFunction = (lastReceivedMessage: Message, currentProps: CurrentDialogProps) => boolean;
23
+ export type CheckFunction = (lastReceivedMessage: Message, currentProps: CurrentDialogProps) => boolean;
24
24
  export interface DialogProperty {
25
25
  "order": number;
26
26
  "key": string;
@@ -1,6 +1,6 @@
1
1
  import { Client } from "../api/Client";
2
2
  import { Message } from "../api/model/message";
3
- export declare type MessagePreProcessor = (message: Message, client?: Client) => Promise<Message>;
3
+ export type MessagePreProcessor = (message: Message, client?: Client) => Promise<Message>;
4
4
  /**
5
5
  * An object that contains all available [[PREPROCESSORS]].
6
6
  *
@@ -47,4 +47,4 @@ export declare enum PREPROCESSORS {
47
47
  /**
48
48
  * The actual type for [config.messagePreprocessor](/docs/api/interfaces/api_model_config.ConfigObject#messagepreprocessor)
49
49
  */
50
- export declare type MPConfigType = PREPROCESSORS | MessagePreProcessor | (PREPROCESSORS | MessagePreProcessor)[];
50
+ export type MPConfigType = PREPROCESSORS | MessagePreProcessor | (PREPROCESSORS | MessagePreProcessor)[];
@@ -1,5 +1,5 @@
1
1
  import { Request, Response } from "express";
2
- declare type CustomResponse = Response & {
2
+ type CustomResponse = Response & {
3
3
  _swsReq: any;
4
4
  };
5
5
  export declare class ElasticEmitter {
@@ -1,7 +1,10 @@
1
1
  /// <reference types="node" />
2
- import { ConfigObject, DataURL } from '../api/model';
3
- import { AxiosRequestConfig } from 'axios';
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import { AdvancedFile, ConfigObject, DataURL } from '../api/model';
5
+ import { AxiosRequestConfig, AxiosResponseHeaders } from 'axios';
4
6
  import { SessionInfo } from '../api/model/sessionInfo';
7
+ import { Readable } from "stream";
5
8
  export declare const timeout: (ms: any) => Promise<unknown>;
6
9
  /**
7
10
  * Use this to generate a more likely valid user agent. It makes sure it has the WA part and replaces any windows or linux os info with mac.
@@ -30,6 +33,13 @@ export declare const isBase64: (str: string) => boolean;
30
33
  * @returns
31
34
  */
32
35
  export declare const isDataURL: (s: string) => boolean;
36
+ /**
37
+ * @internal
38
+ * A convinience method to download the buffer of a downloaded file
39
+ * @param url The url
40
+ * @param optionsOverride You can use this to override the [axios request config](https://github.com/axios/axios#request-config)
41
+ */
42
+ export declare const getBufferFromUrl: (url: string, optionsOverride?: AxiosRequestConfig) => Promise<[Buffer, AxiosResponseHeaders]>;
33
43
  /**
34
44
  * @internal
35
45
  * A convinience method to download the [[DataURL]] of a file
@@ -81,6 +91,54 @@ export declare const generateGHIssueLink: (config: ConfigObject, sessionInfo: Se
81
91
  * download it and convert it to a DataURL. If Base64, returns it.
82
92
  * @param {string} file - The file to be converted to a DataURL.
83
93
  * @param {AxiosRequestConfig} requestConfig - AxiosRequestConfig = {}
94
+ * @param {string} filename - Filename with an extension so a datauri mimetype can be inferred.
84
95
  * @returns A DataURL
85
96
  */
86
- export declare const ensureDUrl: (file: string, requestConfig?: AxiosRequestConfig) => Promise<string>;
97
+ export declare const ensureDUrl: (file: string | Buffer, requestConfig?: AxiosRequestConfig, filename?: string) => Promise<string>;
98
+ export declare const FileInputTypes: {
99
+ VALIDATED_FILE_PATH: string;
100
+ URL: string;
101
+ DATA_URL: string;
102
+ BASE_64: string;
103
+ BUFFER: string;
104
+ READ_STREAM: string;
105
+ };
106
+ export declare const FileOutputTypes: {
107
+ TEMP_FILE_PATH: string;
108
+ VALIDATED_FILE_PATH: string;
109
+ URL: string;
110
+ DATA_URL: string;
111
+ BASE_64: string;
112
+ BUFFER: string;
113
+ READ_STREAM: string;
114
+ };
115
+ /**
116
+ * Remove file asynchronously
117
+ * @param file Filepath
118
+ * @returns
119
+ */
120
+ export declare function rmFileAsync(file: string): Promise<unknown>;
121
+ /**
122
+ * Takes a file parameter and consistently returns the desired type of file.
123
+ * @param file The file path, URL, base64 or DataURL string of the file
124
+ * @param outfileName The ouput filename of the file
125
+ * @param desiredOutputType The type of file output required from this function
126
+ * @param requestConfig optional axios config if file parameter is a url
127
+ */
128
+ export declare const assertFile: (file: AdvancedFile | Buffer, outfileName: string, desiredOutputType: keyof typeof FileOutputTypes, requestConfig?: any) => Promise<string | Buffer | Readable>;
129
+ /**
130
+ * Checks if a given path exists.
131
+ *
132
+ * If exists, returns the resolved absolute path. Otherwise returns false.
133
+ *
134
+ * @param _path a relative, absolute or homedir path to a folder or a file
135
+ * @param failSilent If you're expecting for the file to not exist and just want the `false` response then set this to true to prevent false-positive error messages in the logs.
136
+ * @returns string | false
137
+ */
138
+ export declare const pathExists: (_path: string, failSilent?: boolean) => Promise<string | false>;
139
+ /**
140
+ * Returns an absolute file path reference
141
+ * @param _path a relative, absolute or homedir path to a folder or a file
142
+ * @returns string
143
+ */
144
+ export declare const fixPath: (_path: string) => string;
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate-types-only",
3
- "version": "4.49.1",
3
+ "version": "4.51.5",
4
4
  "description": "Types generated from the @open-wa/wa-automate package",
5
5
  "scripts": {
6
6
  "build": "tsc",
7
+ "deploy": "npm run build && npm version",
8
+ "pub": "npm run build && npm run _ver && npm publish",
9
+ "_ver": "awk -F'\"' '/\"version\": \".+\"/{ print $4; exit; }' ../package.json | xargs -I{} npm version {} --allow-same-version",
7
10
  "test": "echo \"Error: no test specified\" && exit 1"
8
11
  },
9
12
  "types": "dist/index.d.ts",