From fff1b4938bd1e070cebe5e2eb809f96a001bda71 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Sat, 15 Jul 2023 14:21:53 +0200 Subject: Updated 268 files, added 3 files and deleted 2 files (automated) --- .hooks/post-commit | 2 + .hooks/pre-commit | 9 +++ classes/Attachment.ts | 34 ++++++++++++ classes/AttachmentBuilder.ts | 9 +++ classes/AttachmentSize.ts | 10 ++++ classes/CLIDispatcher.ts | 11 ++++ classes/CLIEvent.ts | 5 ++ classes/Channel.ts | 23 ++++++++ classes/Client.ts | 35 +++++++++++- classes/DM.ts | 30 +++++++++- classes/DMDataMessage.ts | 44 ++++++++++++++- classes/DMDeleteMessage.ts | 18 +++++- classes/DMEditMessage.ts | 18 +++++- classes/DMMessage.ts | 18 ++++++ classes/DMReactionMessage.ts | 20 ++++++- classes/DMStickerMessage.ts | 14 ++++- classes/DMTypingMessage.ts | 12 +++- classes/DataMessage.ts | 27 +++++++++ classes/DeleteMessage.ts | 11 ++++ classes/EditMessage.ts | 11 ++++ classes/Emoji.ts | 3 + classes/Group.ts | 64 +++++++++++++++++++++- classes/GroupDataMessage.ts | 66 +++++++++++++++++++++- classes/GroupDeleteMessage.ts | 19 ++++++- classes/GroupEditMessage.ts | 19 ++++++- classes/GroupEditor.ts | 88 ++++++++++++++++++++++++++++++ classes/GroupMessage.ts | 18 ++++++ classes/GroupPermissions.ts | 29 ++++++++++ classes/GroupReactionMessage.ts | 21 ++++++- classes/GroupStickerMessage.ts | 15 ++++- classes/GroupTypingMessage.ts | 16 +++++- classes/MessageFormatting.ts | 16 +++++- classes/MessageFormattingRule.ts | 36 ++++++++++++ classes/ObjectCache.ts | 4 ++ classes/QuoteBuilder.ts | 23 ++++++++ classes/QuoteMessage.ts | 27 +++++++++ classes/ReactionMessage.ts | 15 +++++ classes/ReactionTarget.ts | 9 +++ classes/ReceivedMessage.ts | 48 ++++++++++++++++ classes/ReceivedURLPreview.ts | 25 +++++++++ classes/SentDataMessage.ts | 26 +++++++++ classes/SentMessage.ts | 21 +++++++ classes/SentStickerMessage.ts | 16 ++++++ classes/SignalAPIError.ts | 11 ++++ classes/SignalCLIError.ts | 16 ++++++ classes/Sticker.ts | 21 +++++++ classes/StickerMessage.ts | 7 +++ classes/StickerPack.ts | 31 +++++++++++ classes/TypingMessage.ts | 18 ++++++ classes/User.ts | 56 ++++++++++++++++++- classes/UserMention.ts | 27 +++++++++ dist/classes/Attachment.d.ts | 28 ++++++++++ dist/classes/Attachment.js | 7 +++ dist/classes/Attachment.js.map | 2 +- dist/classes/AttachmentBuilder.d.ts | 9 +++ dist/classes/AttachmentBuilder.js | 6 ++ dist/classes/AttachmentBuilder.js.map | 2 +- dist/classes/AttachmentSize.d.ts | 10 ++++ dist/classes/AttachmentSize.js | 10 ++++ dist/classes/AttachmentSize.js.map | 2 +- dist/classes/CLIDispatcher.d.ts | 11 ++++ dist/classes/CLIDispatcher.js | 11 ++++ dist/classes/CLIDispatcher.js.map | 2 +- dist/classes/CLIEvent.d.ts | 5 ++ dist/classes/CLIEvent.js | 5 ++ dist/classes/CLIEvent.js.map | 2 +- dist/classes/Channel.d.ts | 21 +++++++ dist/classes/Channel.js | 15 +++++ dist/classes/Channel.js.map | 2 +- dist/classes/Client.d.ts | 25 ++++++++- dist/classes/Client.js | 14 ++++- dist/classes/Client.js.map | 2 +- dist/classes/DM.d.ts | 29 +++++++++- dist/classes/DM.js | 25 +++++++++ dist/classes/DM.js.map | 2 +- dist/classes/DMDataMessage.d.ts | 38 ++++++++++++- dist/classes/DMDataMessage.js | 29 +++++++++- dist/classes/DMDataMessage.js.map | 2 +- dist/classes/DMDeleteMessage.d.ts | 16 +++++- dist/classes/DMDeleteMessage.js | 10 +++- dist/classes/DMDeleteMessage.js.map | 2 +- dist/classes/DMEditMessage.d.ts | 16 +++++- dist/classes/DMEditMessage.js | 10 +++- dist/classes/DMEditMessage.js.map | 2 +- dist/classes/DMMessage.d.ts | 17 ++++++ dist/classes/DMMessage.js | 14 +++++ dist/classes/DMMessage.js.map | 2 +- dist/classes/DMReactionMessage.d.ts | 18 +++++- dist/classes/DMReactionMessage.js | 9 ++- dist/classes/DMReactionMessage.js.map | 2 +- dist/classes/DMStickerMessage.d.ts | 12 +++- dist/classes/DMStickerMessage.js | 9 ++- dist/classes/DMStickerMessage.js.map | 2 +- dist/classes/DMTypingMessage.d.ts | 12 +++- dist/classes/DMTypingMessage.js | 9 ++- dist/classes/DMTypingMessage.js.map | 2 +- dist/classes/DataMessage.d.ts | 22 ++++++++ dist/classes/DataMessage.js | 13 +++++ dist/classes/DataMessage.js.map | 2 +- dist/classes/DeleteMessage.d.ts | 10 ++++ dist/classes/DeleteMessage.js | 4 ++ dist/classes/DeleteMessage.js.map | 2 +- dist/classes/EditMessage.d.ts | 10 ++++ dist/classes/EditMessage.js | 4 ++ dist/classes/EditMessage.js.map | 2 +- dist/classes/Emoji.d.ts | 3 + dist/classes/Emoji.js | 3 + dist/classes/Emoji.js.map | 2 +- dist/classes/Group.d.ts | 64 +++++++++++++++++++++- dist/classes/Group.js | 63 +++++++++++++++++++++ dist/classes/Group.js.map | 2 +- dist/classes/GroupDataMessage.d.ts | 43 ++++++++++++++- dist/classes/GroupDataMessage.js | 41 +++++++++++++- dist/classes/GroupDataMessage.js.map | 2 +- dist/classes/GroupDeleteMessage.d.ts | 17 +++++- dist/classes/GroupDeleteMessage.js | 11 +++- dist/classes/GroupDeleteMessage.js.map | 2 +- dist/classes/GroupEditMessage.d.ts | 17 +++++- dist/classes/GroupEditMessage.js | 11 +++- dist/classes/GroupEditMessage.js.map | 2 +- dist/classes/GroupEditor.d.ts | 75 +++++++++++++++++++++++++ dist/classes/GroupEditor.js | 33 +++++++++++ dist/classes/GroupEditor.js.map | 2 +- dist/classes/GroupMessage.d.ts | 17 ++++++ dist/classes/GroupMessage.js | 14 +++++ dist/classes/GroupMessage.js.map | 2 +- dist/classes/GroupPermissions.d.ts | 26 +++++++++ dist/classes/GroupPermissions.js | 14 +++++ dist/classes/GroupPermissions.js.map | 2 +- dist/classes/GroupReactionMessage.d.ts | 19 ++++++- dist/classes/GroupReactionMessage.js | 10 +++- dist/classes/GroupReactionMessage.js.map | 2 +- dist/classes/GroupStickerMessage.d.ts | 15 ++++- dist/classes/GroupStickerMessage.js | 10 +++- dist/classes/GroupStickerMessage.js.map | 2 +- dist/classes/GroupTypingMessage.d.ts | 16 +++++- dist/classes/GroupTypingMessage.js | 10 +++- dist/classes/GroupTypingMessage.js.map | 2 +- dist/classes/MessageFormatting.d.ts | 15 +++++ dist/classes/MessageFormatting.js | 12 ++++ dist/classes/MessageFormatting.js.map | 2 +- dist/classes/MessageFormattingRule.d.ts | 32 +++++++++++ dist/classes/MessageFormattingRule.js | 17 ++++++ dist/classes/MessageFormattingRule.js.map | 2 +- dist/classes/ObjectCache.d.ts | 4 ++ dist/classes/ObjectCache.js | 4 ++ dist/classes/ObjectCache.js.map | 2 +- dist/classes/QuoteBuilder.d.ts | 21 +++++++ dist/classes/QuoteBuilder.js | 12 ++++ dist/classes/QuoteBuilder.js.map | 2 +- dist/classes/QuoteMessage.d.ts | 23 ++++++++ dist/classes/QuoteMessage.js | 8 +++ dist/classes/QuoteMessage.js.map | 2 +- dist/classes/ReactionMessage.d.ts | 13 +++++ dist/classes/ReactionMessage.js | 4 ++ dist/classes/ReactionMessage.js.map | 2 +- dist/classes/ReactionTarget.d.ts | 9 +++ dist/classes/ReactionTarget.js | 9 +++ dist/classes/ReactionTarget.js.map | 2 +- dist/classes/ReceivedMessage.d.ts | 39 +++++++++++++ dist/classes/ReceivedMessage.js | 15 +++++ dist/classes/ReceivedMessage.js.map | 2 +- dist/classes/ReceivedURLPreview.d.ts | 22 ++++++++ dist/classes/ReceivedURLPreview.js | 10 ++++ dist/classes/ReceivedURLPreview.js.map | 2 +- dist/classes/SentDataMessage.d.ts | 25 +++++++++ dist/classes/SentDataMessage.js | 19 +++++++ dist/classes/SentDataMessage.js.map | 2 +- dist/classes/SentMessage.d.ts | 18 ++++++ dist/classes/SentMessage.js | 9 +++ dist/classes/SentMessage.js.map | 2 +- dist/classes/SentStickerMessage.d.ts | 16 ++++++ dist/classes/SentStickerMessage.js | 13 +++++ dist/classes/SentStickerMessage.js.map | 2 +- dist/classes/SignalAPIError.d.ts | 11 ++++ dist/classes/SignalAPIError.js | 8 +++ dist/classes/SignalAPIError.js.map | 2 +- dist/classes/SignalCLIError.d.ts | 15 +++++ dist/classes/SignalCLIError.js | 9 +++ dist/classes/SignalCLIError.js.map | 2 +- dist/classes/Sticker.d.ts | 19 +++++++ dist/classes/Sticker.js | 10 ++++ dist/classes/Sticker.js.map | 2 +- dist/classes/StickerMessage.d.ts | 7 +++ dist/classes/StickerMessage.js | 4 ++ dist/classes/StickerMessage.js.map | 2 +- dist/classes/StickerPack.d.ts | 26 +++++++++ dist/classes/StickerPack.js | 8 +++ dist/classes/StickerPack.js.map | 2 +- dist/classes/TypingMessage.d.ts | 16 +++--- dist/classes/TypingMessage.js | 17 ++---- dist/classes/TypingMessage.js.map | 2 +- dist/classes/User.d.ts | 53 +++++++++++++++++- dist/classes/User.js | 53 +++++++++++++++++- dist/classes/User.js.map | 2 +- dist/classes/UserMention.d.ts | 24 ++++++++ dist/classes/UserMention.js | 15 +++++ dist/classes/UserMention.js.map | 2 +- dist/enums/ConfigEnvironment.d.ts | 6 ++ dist/enums/ConfigEnvironment.js | 6 ++ dist/enums/ConfigEnvironment.js.map | 2 +- dist/enums/ConfigTrustLevel.d.ts | 14 +++++ dist/enums/ConfigTrustLevel.js | 14 +++++ dist/enums/ConfigTrustLevel.js.map | 2 +- dist/enums/GroupLinkStatus.d.ts | 13 +++++ dist/enums/GroupLinkStatus.js | 13 +++++ dist/enums/GroupLinkStatus.js.map | 2 +- dist/enums/GroupPermissionLevel.d.ts | 10 ++++ dist/enums/GroupPermissionLevel.js | 10 ++++ dist/enums/GroupPermissionLevel.js.map | 2 +- dist/enums/GroupPermissionName.d.ts | 12 ++++ dist/enums/GroupPermissionName.js | 12 ++++ dist/enums/GroupPermissionName.js.map | 2 +- dist/enums/MessageFormattingStyle.d.ts | 3 + dist/enums/MessageFormattingStyle.js | 3 + dist/enums/MessageFormattingStyle.js.map | 2 +- dist/enums/MessageReceipt.d.ts | 10 ++++ dist/enums/MessageReceipt.js | 10 ++++ dist/enums/MessageReceipt.js.map | 2 +- dist/enums/StickerSource.d.ts | 9 +++ dist/enums/StickerSource.js | 9 +++ dist/enums/StickerSource.js.map | 2 +- dist/enums/TypingMessageAction.d.ts | 9 +++ dist/enums/TypingMessageAction.js | 9 +++ dist/enums/TypingMessageAction.js.map | 2 +- dist/enums/UserDataType.d.ts | 18 ++++++ dist/enums/UserDataType.js | 18 ++++++ dist/enums/UserDataType.js.map | 2 +- dist/index.d.ts | 3 +- dist/index.js | 10 ++-- dist/index.js.map | 2 +- dist/types/IAttachmentBuilderData.d.ts | 16 ++++++ dist/types/ICLIEvent.d.ts | 28 +++++++++- dist/types/ICLIRequest.d.ts | 19 +++++++ dist/types/ICLIResponse.d.ts | 20 ++++++- dist/types/IChatMessageOptions.d.ts | 34 +++++++++++- dist/types/IChatMessageURLPreview.d.ts | 19 +++++++ dist/types/IConfig.d.ts | 9 +-- dist/types/IDataURI.d.ts | 4 ++ dist/types/IFilePath.d.ts | 3 + dist/types/IMimeType.d.ts | 4 ++ dist/types/IReceivedMessageURLPreview.d.ts | 6 ++ dist/types/ISentMessageURLPreview.d.ts | 6 ++ dist/types/ISystemConfig.d.ts | 3 + dist/types/IUserResolvable.d.ts | 4 ++ enums/ConfigEnvironment.ts | 6 ++ enums/ConfigTrustLevel.ts | 16 ++++++ enums/ConfigVerbosity.ts | 6 -- enums/GroupLinkStatus.ts | 15 +++++ enums/GroupPermissionLevel.ts | 11 ++++ enums/GroupPermissionName.ts | 14 +++++ enums/MessageFormattingFormat.ts | 4 -- enums/MessageFormattingStyle.ts | 3 + enums/MessageReceipt.ts | 11 ++++ enums/StickerSource.ts | 10 ++++ enums/TypingMessageAction.ts | 10 ++++ enums/UserDataType.ts | 22 ++++++++ index.ts | 3 +- package.json | 3 +- types/IAttachmentBuilderData.ts | 18 ++++++ types/ICLIEvent.ts | 32 ++++++++++- types/ICLIRequest.ts | 21 +++++++ types/ICLIResponse.ts | 23 +++++++- types/IChatMessageOptions.ts | 38 ++++++++++++- types/IChatMessageURLPreview.ts | 22 ++++++++ types/IConfig.ts | 10 +--- types/IDataURI.ts | 4 ++ types/IFilePath.ts | 3 + types/IMimeType.ts | 4 ++ types/IReceivedMessageURLPreview.ts | 6 ++ types/ISentMessageURLPreview.ts | 6 ++ types/ISystemConfig.ts | 3 + types/IUserResolvable.ts | 4 ++ 273 files changed, 3537 insertions(+), 188 deletions(-) create mode 100755 .hooks/post-commit create mode 100755 .hooks/pre-commit create mode 100644 classes/TypingMessage.ts delete mode 100644 enums/ConfigVerbosity.ts delete mode 100644 enums/MessageFormattingFormat.ts diff --git a/.hooks/post-commit b/.hooks/post-commit new file mode 100755 index 0000000..330cdbd --- /dev/null +++ b/.hooks/post-commit @@ -0,0 +1,2 @@ +#!/bin/bash +node build.js diff --git a/.hooks/pre-commit b/.hooks/pre-commit new file mode 100755 index 0000000..7b64d1e --- /dev/null +++ b/.hooks/pre-commit @@ -0,0 +1,9 @@ +#!/bin/bash +cp -r .git/hooks .hooks +cd docs +node build.js +git add -A +git commit -m "Update" +git push origin mane +cd .. +node indexgen.js diff --git a/classes/Attachment.ts b/classes/Attachment.ts index a397924..15c364e 100644 --- a/classes/Attachment.ts +++ b/classes/Attachment.ts @@ -1,15 +1,49 @@ import {IMimeType} from "../types/IMimeType"; import {AttachmentSize} from "./AttachmentSize"; +/** + * An attachment added to a message + */ export class Attachment { + /** + * Attachment MIME type + */ public type: IMimeType; + + /** + * Attachment file name + */ public fileName: string; + + /** + * Attachment file ID set by Signal + */ public fileId: string; + + /** + * Attachment size + */ public size: AttachmentSize; + + /** + * If the attachment is an image, its width + */ public width?: number; + + /** + * If the attachment is an image, its height + */ public height?: number; + + /** + * If the attachment is an image, its alternative text + */ public caption?: string; + /** + * @param attachmentData - Data to use to construct the attachment + * @internal + */ constructor(attachmentData: any) { this.type = attachmentData.contentType; this.fileName = attachmentData.filename; diff --git a/classes/AttachmentBuilder.ts b/classes/AttachmentBuilder.ts index a7d4b18..854f3e4 100644 --- a/classes/AttachmentBuilder.ts +++ b/classes/AttachmentBuilder.ts @@ -3,9 +3,18 @@ import {IDataURI} from "../types/IDataURI"; import {IAttachmentBuilderData} from "../types/IAttachmentBuilderData"; import {lstatSync} from "fs"; +/** + * A helper to build an attachment to send to a message + */ export class AttachmentBuilder { + /** + * The rest of the attachment as a URI that can be passed to signal-cli + */ public uri: IFilePath|IDataURI; + /** + * @param data - A file path, data URI, or object to construct an attachment + */ constructor(data: IFilePath|IDataURI|IAttachmentBuilderData) { if (typeof data === "string") { if (!data.startsWith("data:")) { diff --git a/classes/AttachmentSize.ts b/classes/AttachmentSize.ts index 20572a5..7880d59 100644 --- a/classes/AttachmentSize.ts +++ b/classes/AttachmentSize.ts @@ -1,8 +1,18 @@ +/** + * A size to associate with an Attachment + */ export class AttachmentSize extends Number { + /** + * @internal + * @param props + */ constructor(props) { super(props); } + /** + * Convert the size from bytes to bits + */ public toBits(): number { return parseInt(this.toString()) * 8; } diff --git a/classes/CLIDispatcher.ts b/classes/CLIDispatcher.ts index 5a20f3f..50ba9e1 100644 --- a/classes/CLIDispatcher.ts +++ b/classes/CLIDispatcher.ts @@ -4,7 +4,18 @@ import {ICLIRequest} from "../types/ICLIRequest"; import {SignalCLIError} from "./SignalCLIError"; import {SignalAPIError} from "./SignalAPIError"; +/** + * A dispatcher used to send requests to signal-cli and receive a response + */ export class CLIDispatcher { + /** + * Dispatch a request to signal-cli + * @param method - The method to associate with the request. + * Use `signal-cli --help` to get a full list + * @param params - The parameters to pass with the request. + * Use `signal-cli --help` to get a full list for the current method + * @param proc - The signal-cli process to dispatch to + */ static dispatch(method: string, params: any, proc: ChildProcess): Promise { return new Promise((res, rej) => { let id: UUID = randomUUID(); diff --git a/classes/CLIEvent.ts b/classes/CLIEvent.ts index 124dcbb..448409f 100644 --- a/classes/CLIEvent.ts +++ b/classes/CLIEvent.ts @@ -22,6 +22,11 @@ import {Group} from "./Group"; * A signal-cli event */ export class CLIEvent { + /** + * @internal + * @param client + * @param data + */ static fromEvent(client: Client, data: ICLIEvent) { client.emit("cliEvent", data); diff --git a/classes/Channel.ts b/classes/Channel.ts index 8ad70eb..362f9e5 100644 --- a/classes/Channel.ts +++ b/classes/Channel.ts @@ -1,13 +1,36 @@ import {IChatMessageOptions} from "../types/IChatMessageOptions"; import {SentDataMessage} from "./SentDataMessage"; +/** + * A channel (either DM or group) on Signal + */ export class Channel { + /** + * Whether the channel is a group chat + */ public group: boolean; + + /** + * Channel (DM or group) ID + */ public id: string; + /** + * @internal + */ constructor() {} + + /** + * Send a message to the channel + * @param text - The text of the message, or an empty string + * @param options - The optional options used to build the message + */ // @ts-ignore public async send(text: string, options?: IChatMessageOptions): Promise {} + /** + * Set the client's typing status for this channel + * @param typing - Whether the client should be typing or not + */ public async setTyping(typing: boolean): Promise {} } \ No newline at end of file diff --git a/classes/Client.ts b/classes/Client.ts index 7a071bf..f8968c7 100644 --- a/classes/Client.ts +++ b/classes/Client.ts @@ -21,57 +21,89 @@ import {Group} from "./Group"; export declare interface Client { /** + * Emitted when a Signal event, even if unsupported, is received by signal-cli * @event Client#cliEvent */ on(event: "cliEvent", listener: (event: ICLIEvent) => void): this; /** + * Emitted when a typing message is received * @event Client#typingMessage */ on(event: "typingMessage", listener: (message: GroupTypingMessage|DMTypingMessage) => void): this; + /** + * Emitted when a data (text) message is received * @event Client#message */ on(event: "message", listener: (message: GroupDataMessage|DMDataMessage) => void): this; + /** + * Emitted when a message is edited * @event Client#editMessage */ on(event: "editMessage", listener: (message: GroupEditMessage|DMEditMessage) => void): this; + /** + * Emitted when a reaction is added or removed to/from a message * @event Client#reaction */ on(event: "reaction", listener: (message: GroupReactionMessage|DMReactionMessage) => void): this; + /** + * Emitted when a reaction is added to a message * @event Client#reactionAdd */ on(event: "reactionAdd", listener: (message: GroupReactionMessage|DMReactionMessage) => void): this; + /** + * Emitted when a reaction is removed from a message * @event Client#reactionRemove */ on(event: "reactionRemove", listener: (message: GroupReactionMessage|DMReactionMessage) => void): this; + /** + * Emitted when a sticker message is received * @event Client#sticker */ on(event: "sticker", listener: (message: GroupStickerMessage|DMStickerMessage) => void): this; + /** + * Emitted when a message in a channel gets deleted * @event Client#deleteMessage */ on(event: "deleteMessage", listener: (message: GroupDeleteMessage|DMDeleteMessage) => void): this; /** + * Emitted when a group's information gets updated * @event Client#groupUpdate */ on(event: "groupUpdate", listener: (group: Group) => void): this; } /** - * The base signal.js client + * The base Signal.js client interface */ export class Client extends EventEmitter { + /** + * The signal-cli process + */ public process: ChildProcess; + + /** + * An {@link ObjectCache} for the registered sticker packs + * @internal + */ public stickerPacks: ObjectCache = {}; + + /** + * Whether verbose mode (logging events) should be enabled + */ public verbose: boolean = false; + /** + * @param config - The configuration to use with signal-cli + */ constructor(config: IConfig) { super(); @@ -83,7 +115,6 @@ export class Client extends EventEmitter { if (config.scrubLog) parameters.push("--scrub-log"); if (config.configPath) parameters.push("--config", config.configPath); if (config.cliLog) parameters.push("--log-file", config.cliLog); - if (typeof config.verbose === "number") parameters.push(...Array(config.verbose).fill("--verbose")); if (config.environment) parameters.push("--service-environment", config.environment); if (config.trustLevel) parameters.push("--trust-new-identities", config.trustLevel); if (config.logEvents) this.verbose = true; diff --git a/classes/DM.ts b/classes/DM.ts index d49446e..0aebaf3 100644 --- a/classes/DM.ts +++ b/classes/DM.ts @@ -6,12 +6,27 @@ import {SentDataMessage} from "./SentDataMessage"; import {channel} from "diagnostics_channel"; import {Sticker} from "./Sticker"; +/** + * A Signal 1-to-1 chat + */ export class DM extends Channel { + /** + * Whether the channel is a group chat + */ public group: boolean = false; - public id: string; + + /** + * Recipient's phone number + */ public number: string; private client: Client; + /** + * @param userId - The ID of the user + * @param number - The user's phone number + * @param client + * @internal + */ constructor(userId: string|null, number: string, client: Client) { super(); this.id = userId; @@ -19,6 +34,11 @@ export class DM extends Channel { this.client = client; } + /** + * Send a message to the channel + * @param text - The text of the message, or an empty string + * @param options - The optional options used to build the message + */ public async send(text: string, options?: IChatMessageOptions): Promise { let data = await CLIDispatcher.dispatch( "send", @@ -44,6 +64,10 @@ export class DM extends Channel { return new SentDataMessage(timestamp, this, this.client, text, options); } + /** + * Set the client's typing status for this channel + * @param typing - Whether the client should be typing or not + */ public async setTyping(typing: boolean): Promise { await CLIDispatcher.dispatch( "sendTyping", @@ -55,6 +79,10 @@ export class DM extends Channel { ); } + /** + * Send a sticker to this channel + * @param sticker - The sticker to send + */ public async sendSticker(sticker: Sticker): Promise { await CLIDispatcher.dispatch( "send", diff --git a/classes/DMDataMessage.ts b/classes/DMDataMessage.ts index e7d82e8..8215907 100644 --- a/classes/DMDataMessage.ts +++ b/classes/DMDataMessage.ts @@ -8,7 +8,6 @@ import {QuoteMessage} from "./QuoteMessage"; import {CLIDispatcher} from "./CLIDispatcher"; import {MessageReceipt} from "../enums/MessageReceipt"; import {MessageFormatting} from "./MessageFormatting"; -import {MessageFormattingFormat} from "../enums/MessageFormattingFormat"; import {UserMention} from "./UserMention"; import {UserDataType} from "../enums/UserDataType"; import {ReceivedURLPreview} from "./ReceivedURLPreview"; @@ -20,16 +19,46 @@ import {SentDataMessage} from "./SentDataMessage"; import {QuoteBuilder} from "./QuoteBuilder"; /** - * A data message as sent by Signal + * A data (text) message sent in a {@link DM} */ export class DMDataMessage extends DMMessage implements DataMessage { + /** + * Message text + */ public content?: string; + + /** + * {@link Attachment}s associated with the message + */ public attachments: Attachment[] = []; + + /** + * Mentions in the message + */ public mentions: UserMention[] = []; + + /** + * URL previews present in the message + */ public previews: IReceivedMessageURLPreview[] = []; + + /** + * Formatting rules collection for this message + */ public formatting: MessageFormatting; + + /** + * Quoted message, if applicable + */ public quote?: QuoteMessage; + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, client: Client) { super(user, time, new DM(user.uuid, user.number, client), client, data.expiresInSeconds); this.content = data.message && data.message.trim().length > 0 ? data.message : null; @@ -40,6 +69,9 @@ export class DMDataMessage extends DMMessage implements DataMessage { this.previews = data.previews?.map(preview => (new ReceivedURLPreview(preview)).build()); } + /** + * Mark the message as read + */ public async markAsRead() { await CLIDispatcher.dispatch( "sendReceipt", @@ -52,6 +84,9 @@ export class DMDataMessage extends DMMessage implements DataMessage { ) } + /** + * Mark the message as viewed + */ public async markAsViewed() { await CLIDispatcher.dispatch( "sendReceipt", @@ -64,6 +99,11 @@ export class DMDataMessage extends DMMessage implements DataMessage { ) } + /** + * Reply to (quote) the message + * @param text - The text of the reply + * @param options - The options used to build the reply message + */ public async reply(text: string, options?: IChatMessageOptions): Promise { if (options) { options.quote = new QuoteBuilder(this.client, this.createdTimestamp, this.author.number, this.content); diff --git a/classes/DMDeleteMessage.ts b/classes/DMDeleteMessage.ts index 85b1826..18c58d0 100644 --- a/classes/DMDeleteMessage.ts +++ b/classes/DMDeleteMessage.ts @@ -3,17 +3,31 @@ import {DMMessage} from "./DMMessage"; import {DM} from "./DM"; import {Client} from "./Client"; import {Sticker} from "./Sticker"; -import {StickerMessage} from "./StickerMessage"; import {StickerSource} from "../enums/StickerSource"; import {DeleteMessage} from "./DeleteMessage"; /** - * A deletion message as sent by Signal + * A deletion message sent in a {@link DM} */ export class DMDeleteMessage extends DMMessage implements DeleteMessage { + /** + * {@link Date} at which the original message was created + */ public originalCreatedAt: Date; + + /** + * Timestamp at which the original message was created + */ public originalCreatedTimestamp: number; + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param originalTime - The timestamp the original message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, client: Client, originalTime: number) { super(user, time, new DM(user.uuid, user.number, client), client, data.expiresInSeconds); this.originalCreatedAt = new Date(originalTime); diff --git a/classes/DMEditMessage.ts b/classes/DMEditMessage.ts index 5581799..bc38f05 100644 --- a/classes/DMEditMessage.ts +++ b/classes/DMEditMessage.ts @@ -8,17 +8,31 @@ import {QuoteMessage} from "./QuoteMessage"; import {CLIDispatcher} from "./CLIDispatcher"; import {MessageReceipt} from "../enums/MessageReceipt"; import {MessageFormatting} from "./MessageFormatting"; -import {MessageFormattingFormat} from "../enums/MessageFormattingFormat"; import {DMDataMessage} from "./DMDataMessage"; import {EditMessage} from "./EditMessage"; /** - * An edit message as sent by Signal + * An edit message sent in a {@link DM} */ export class DMEditMessage extends DMDataMessage implements EditMessage { + /** + * {@link Date} at which the original message was created + */ public originalCreatedAt: Date; + + /** + * Timestamp at which the original message was created + */ public originalCreatedTimestamp: number; + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param originalTime - The timestamp the original message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, originalTime: number, client: Client) { super(user, data, time, client); this.originalCreatedAt = new Date(originalTime); diff --git a/classes/DMMessage.ts b/classes/DMMessage.ts index 58aa6ef..95bc8de 100644 --- a/classes/DMMessage.ts +++ b/classes/DMMessage.ts @@ -3,10 +3,28 @@ import {User} from "./User"; import {DM} from "./DM"; import {Client} from "./Client"; +/** + * A message sent in a {@link DM} + */ export class DMMessage extends ReceivedMessage { + /** + * {@link DM} the message was sent to + */ public channel: DM; + + /** + * Whether the message was sent in a group channel or not + */ public isGroup: boolean = false; + /** + * @param user - The author of the message + * @param time - The timestamp the message was sent at + * @param dm - The DM the message was sent in + * @param client + * @param expirity - The number of seconds remaining before the message disappears, if applicable + * @internal + */ constructor(user: User, time: number, dm: DM, client: Client, expirity?: number) { super(user, time, dm, client, expirity); } diff --git a/classes/DMReactionMessage.ts b/classes/DMReactionMessage.ts index 8f9a60a..5d40d62 100644 --- a/classes/DMReactionMessage.ts +++ b/classes/DMReactionMessage.ts @@ -10,13 +10,31 @@ import {ReactionTarget} from "./ReactionTarget"; import {ReactionMessage} from "./ReactionMessage"; /** - * A reaction message as sent by Signal + * A reaction message sent in a {@link DM} */ export class DMReactionMessage extends DMMessage implements ReactionMessage { + /** + * Emoji that was used for the reaction + */ public emoji: Emoji; + + /** + * Whether the reaction is a removal + */ public removed: boolean; + + /** + * Message targetted by the reaction + */ public target: ReactionTarget; + /** + * @param user - The author of the message + * @param data - Data associated with the reaction + * @param time - The timestamp the message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, client: Client) { super(user, time, new DM(user.uuid, user.number, client), client, data.expiresInSeconds); this.removed = data.reaction.isRemove; diff --git a/classes/DMStickerMessage.ts b/classes/DMStickerMessage.ts index b15eb39..d1a9a5e 100644 --- a/classes/DMStickerMessage.ts +++ b/classes/DMStickerMessage.ts @@ -3,15 +3,25 @@ import {DMMessage} from "./DMMessage"; import {DM} from "./DM"; import {Client} from "./Client"; import {Sticker} from "./Sticker"; -import {StickerMessage} from "./StickerMessage"; import {StickerSource} from "../enums/StickerSource"; +import {StickerMessage} from "./StickerMessage"; /** - * A sticker message as sent by Signal + * A sticker message sent in a {@link DM} */ export class DMStickerMessage extends DMMessage implements StickerMessage { + /** + * Sticker that was sent + */ public sticker: Sticker; + /** + * @param user - The author of the message + * @param data - Data associated with the sticker + * @param time - The timestamp the message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, client: Client) { super(user, time, new DM(user.uuid, user.number, client), client, data.expiresInSeconds); this.sticker = new Sticker(StickerSource.Received, data.sticker, client); diff --git a/classes/DMTypingMessage.ts b/classes/DMTypingMessage.ts index 82471fb..f2672df 100644 --- a/classes/DMTypingMessage.ts +++ b/classes/DMTypingMessage.ts @@ -8,11 +8,21 @@ import {Client} from "./Client"; import {TypingMessageAction} from "../enums/TypingMessageAction"; /** - * A typing message as sent by Signal + * A typing message sent in a {@link DM} */ export class DMTypingMessage extends DMMessage { + /** + * Action associated with the typing message + */ public action: TypingMessageAction; + /** + * @param user - The author of the message + * @param action - The action associated with the typing message + * @param time - The timestamp the message was sent at + * @param client + * @internal + */ constructor(user: User, action: TypingMessageAction, time: number, client: Client) { super(user, time, new DM(user.uuid, user.number, client), client); this.action = action; diff --git a/classes/DataMessage.ts b/classes/DataMessage.ts index 5f80b0a..97a037a 100644 --- a/classes/DataMessage.ts +++ b/classes/DataMessage.ts @@ -5,11 +5,38 @@ import {UserMention} from "./UserMention"; import {IChatMessageURLPreview} from "../types/IChatMessageURLPreview"; import {IReceivedMessageURLPreview} from "../types/IReceivedMessageURLPreview"; +/** + * A data (text) message sent on Signal + * @internal + */ export class DataMessage { + /** + * Message text + */ public content?: string; + + /** + * {@link Attachment}s associated with the message + */ public attachments: Attachment[] = []; + + /** + * Mentions in the message + */ public mentions: UserMention[] = []; + + /** + * URL previews present in the message + */ public previews: IReceivedMessageURLPreview[] = []; + + /** + * Formatting rules collection for this message + */ public formatting: MessageFormatting; + + /** + * Quoted message, if applicable + */ public quote?: QuoteMessage; } \ No newline at end of file diff --git a/classes/DeleteMessage.ts b/classes/DeleteMessage.ts index c231ec5..3f969a2 100644 --- a/classes/DeleteMessage.ts +++ b/classes/DeleteMessage.ts @@ -4,7 +4,18 @@ import {Emoji} from "./Emoji"; import {ReactionTarget} from "./ReactionTarget"; import {Sticker} from "./Sticker"; +/** + * A deletion message sent on Signal + * @internal + */ export class DeleteMessage { + /** + * {@link Date} at which the original message was created + */ public originalCreatedAt: Date; + + /** + * Timestamp at which the original message was created + */ public originalCreatedTimestamp: number; } \ No newline at end of file diff --git a/classes/EditMessage.ts b/classes/EditMessage.ts index b5fed51..b3d7fff 100644 --- a/classes/EditMessage.ts +++ b/classes/EditMessage.ts @@ -3,7 +3,18 @@ import {QuoteMessage} from "./QuoteMessage"; import {MessageFormatting} from "./MessageFormatting"; import {DataMessage} from "./DataMessage"; +/** + * A message editing an older message + * @internal + */ export class EditMessage extends DataMessage { + /** + * {@link Date} at which the original message was created + */ public originalCreatedAt: Date; + + /** + * Timestamp at which the original message was created + */ public originalCreatedTimestamp: number; } \ No newline at end of file diff --git a/classes/Emoji.ts b/classes/Emoji.ts index 47425d0..45222ae 100644 --- a/classes/Emoji.ts +++ b/classes/Emoji.ts @@ -1,3 +1,6 @@ +/** + * An emoji sent on Signal + */ export class Emoji extends String { constructor(props) { super(props); diff --git a/classes/Group.ts b/classes/Group.ts index cdee7c7..8abdb39 100644 --- a/classes/Group.ts +++ b/classes/Group.ts @@ -7,17 +7,32 @@ import {Sticker} from "./Sticker"; import {GroupEditor} from "./GroupEditor"; import {User} from "./User"; +/** + * A Signal group + */ export class Group extends Channel { + /** + * Whether the channel is a group chat + */ public group: boolean = true; - public id: string; private client: Client; + /** + * @param groupId - The ID of the group + * @param client + * @internal + */ constructor(groupId: string, client: Client) { super(); this.id = groupId; this.client = client; } + /** + * Send a message to the channel + * @param text - The text of the message, or an empty string + * @param options - The optional options used to build the message + */ public async send(text: string, options?: IChatMessageOptions): Promise { let groupData = await CLIDispatcher.dispatch( "listGroups", @@ -50,6 +65,10 @@ export class Group extends Channel { return new SentDataMessage(timestamp, this, this.client, text, options); } + /** + * Set the client's typing status for this channel + * @param typing - Whether the client should be typing or not + */ public async setTyping(typing: boolean): Promise { let groupData = await CLIDispatcher.dispatch( "listGroups", @@ -68,6 +87,10 @@ export class Group extends Channel { ); } + /** + * Send a sticker to this channel + * @param sticker - The sticker to send + */ public async sendSticker(sticker: Sticker): Promise { let groupData = await CLIDispatcher.dispatch( "listGroups", @@ -86,6 +109,10 @@ export class Group extends Channel { ); } + /** + * Block or unblock the group + * @param blocked - Whether the group should be blocked or not + */ public async setBlocked(blocked: boolean) { let groupData = await CLIDispatcher.dispatch( "listGroups", @@ -114,6 +141,9 @@ export class Group extends Channel { } } + /** + * Edit the group's information + */ public async editor() { return new GroupEditor(this, await CLIDispatcher.dispatch( "listGroups", @@ -122,6 +152,10 @@ export class Group extends Channel { ), this.client); } + /** + * Add one or more admins to the group + * @param users - The admin(s) to add + */ public async addAdmin(...users: User[]) { await CLIDispatcher.dispatch( "updateGroup", @@ -133,6 +167,10 @@ export class Group extends Channel { ); } + /** + * Remove one or more admins + * @param users - The admin(s) to remove + */ public async removeAdmin(...users: User[]) { await CLIDispatcher.dispatch( "updateGroup", @@ -144,6 +182,10 @@ export class Group extends Channel { ); } + /** + * Add one or more members to the group + * @param users - The member(s) to add + */ public async addMember(...users: User[]) { await CLIDispatcher.dispatch( "updateGroup", @@ -155,6 +197,10 @@ export class Group extends Channel { ); } + /** + * Remove (kick) one or more members from the group + * @param users - The member(s) to remove + */ public async removeMember(...users: User[]) { await CLIDispatcher.dispatch( "updateGroup", @@ -166,6 +212,10 @@ export class Group extends Channel { ); } + /** + * Permanently ban one or more members from the group + * @param users - The member(s) to ban + */ public async banMember(...users: User[]) { await CLIDispatcher.dispatch( "updateGroup", @@ -177,6 +227,10 @@ export class Group extends Channel { ); } + /** + * Unban one or more permanently banned members from the group + * @param users - The member(s) to unban + */ public async unbanMember(...users: User[]) { await CLIDispatcher.dispatch( "updateGroup", @@ -188,6 +242,14 @@ export class Group extends Channel { ); } + /** + * Leave the group + * + * If the client is an administrator of the group, `successorAdmins` has to be set + * @param deleteLocalData - Whether local client data about the group should be deleted + * @param successorAdmins - One or more member(s) to make group admins after the client + * leaves the group, in case this client is the only admin + */ public async leave(deleteLocalData: boolean = false, successorAdmins?: User[]) { await CLIDispatcher.dispatch( "quitGroup", diff --git a/classes/GroupDataMessage.ts b/classes/GroupDataMessage.ts index 3608c6a..00e1053 100644 --- a/classes/GroupDataMessage.ts +++ b/classes/GroupDataMessage.ts @@ -9,7 +9,6 @@ import {QuoteMessage} from "./QuoteMessage"; import {CLIDispatcher} from "./CLIDispatcher"; import {MessageReceipt} from "../enums/MessageReceipt"; import {MessageFormatting} from "./MessageFormatting"; -import {MessageFormattingFormat} from "../enums/MessageFormattingFormat"; import {UserMention} from "./UserMention"; import {UserDataType} from "../enums/UserDataType"; import {IChatMessageURLPreview} from "../types/IChatMessageURLPreview"; @@ -20,16 +19,47 @@ import {SentDataMessage} from "./SentDataMessage"; import {QuoteBuilder} from "./QuoteBuilder"; /** - * A data message as sent by Signal + * A data (text) message sent in a {@link Group} */ export class GroupDataMessage extends GroupMessage implements DataMessage { + /** + * Message text + */ public content?: string; + + /** + * Attachments associated with the message + */ public attachments: Attachment[] = []; + + /** + * Mentions in the message + */ public mentions: UserMention[] = []; + + /** + * URL previews present in the message + */ public previews: IReceivedMessageURLPreview[] = []; + + /** + * Formatting rules collection for this message + */ public formatting: MessageFormatting; + + /** + * Quoted message, if applicable + */ public quote?: QuoteMessage; + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param client + * @internal + */ constructor(user: User, data: any, time: number, groupId: string, client) { super(user, time, new Group(groupId, client), client, data.expiresInSeconds); this.client = client; @@ -41,6 +71,9 @@ export class GroupDataMessage extends GroupMessage implements DataMessage { this.previews = data.previews?.map(preview => (new ReceivedURLPreview(preview)).build()); } + /** + * Mark the message as read + */ public async markAsRead() { await CLIDispatcher.dispatch( "sendReceipt", @@ -53,6 +86,9 @@ export class GroupDataMessage extends GroupMessage implements DataMessage { ) } + /** + * Mark the message as viewed + */ public async markAsViewed() { await CLIDispatcher.dispatch( "sendReceipt", @@ -65,6 +101,11 @@ export class GroupDataMessage extends GroupMessage implements DataMessage { ) } + /** + * Reply to (quote) the message + * @param text - The text of the reply + * @param options - The options used to build the reply message + */ public async reply(text: string, options?: IChatMessageOptions): Promise { if (options) { options.quote = new QuoteBuilder(this.client, this.createdTimestamp, this.author.number, this.content); @@ -76,4 +117,25 @@ export class GroupDataMessage extends GroupMessage implements DataMessage { return await this.channel.send(text, options); } + + /** + * Delete the message + */ + public async delete(): Promise { + let groupData = await CLIDispatcher.dispatch( + "listGroups", + {}, + this.client.process + ); + + await CLIDispatcher.dispatch( + "remoteDelete", + { + groupId: this.channel.id, + recipient: groupData['result'].filter(i => i.id === this.channel.id)[0].members.map(i => i.number), + targetTimestamp: this.createdTimestamp + }, + this.client.process + ); + } } \ No newline at end of file diff --git a/classes/GroupDeleteMessage.ts b/classes/GroupDeleteMessage.ts index b1e19ff..7d4017d 100644 --- a/classes/GroupDeleteMessage.ts +++ b/classes/GroupDeleteMessage.ts @@ -3,19 +3,34 @@ import {DMMessage} from "./DMMessage"; import {DM} from "./DM"; import {Client} from "./Client"; import {Sticker} from "./Sticker"; -import {StickerMessage} from "./StickerMessage"; import {StickerSource} from "../enums/StickerSource"; import {DeleteMessage} from "./DeleteMessage"; import {GroupMessage} from "./GroupMessage"; import {Group} from "./Group"; /** - * A deletion message as sent by Signal + * A deletion message sent in a {@link Group} */ export class GroupDeleteMessage extends GroupMessage implements DeleteMessage { + /** + * {@link Date} at which the original message was created + */ public originalCreatedAt: Date; + + /** + * Timestamp at which the original message was created + */ public originalCreatedTimestamp: number; + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param originalTime - The timestamp the original message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, groupId: string, client: Client, originalTime: number) { super(user, time, new Group(groupId, client), client, data.expiresInSeconds); this.originalCreatedAt = new Date(originalTime); diff --git a/classes/GroupEditMessage.ts b/classes/GroupEditMessage.ts index 9e1993f..687e918 100644 --- a/classes/GroupEditMessage.ts +++ b/classes/GroupEditMessage.ts @@ -8,18 +8,33 @@ import {QuoteMessage} from "./QuoteMessage"; import {CLIDispatcher} from "./CLIDispatcher"; import {MessageReceipt} from "../enums/MessageReceipt"; import {MessageFormatting} from "./MessageFormatting"; -import {MessageFormattingFormat} from "../enums/MessageFormattingFormat"; import {DMDataMessage} from "./DMDataMessage"; import {EditMessage} from "./EditMessage"; import {GroupDataMessage} from "./GroupDataMessage"; /** - * An edit message as sent by Signal + * An edit message sent in a {@link Group} */ export class GroupEditMessage extends GroupDataMessage implements EditMessage { + /** + * {@link Date} at which the original message was created + */ public originalCreatedAt: Date; + + /** + * Timestamp at which the original message was created + */ public originalCreatedTimestamp: number; + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param originalTime - The timestamp the original message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, groupId: string, originalTime: number, client: Client) { super(user, data, time, groupId, client); this.originalCreatedAt = new Date(originalTime); diff --git a/classes/GroupEditor.ts b/classes/GroupEditor.ts index 5fa5c21..c2662f4 100644 --- a/classes/GroupEditor.ts +++ b/classes/GroupEditor.ts @@ -8,23 +8,87 @@ import {Attachment} from "./Attachment"; import {AttachmentBuilder} from "./AttachmentBuilder"; import {GroupLinkStatus} from "../enums/GroupLinkStatus"; +/** + * A collector and editor of information related to the group + */ export class GroupEditor { + /** + * {@link Group} being worked on + */ public initiator: Group; + + /** + * ID of the group + */ public id: string; + + /** + * Name of the group + */ public name: string; + + /** + * Optional description for the group + */ public description?: string; + + /** + * Whether this client is a member of the group or not + */ public isMember: boolean; + + /** + * Whether this client has blocked the group or not + */ public isBlocked: boolean; + + /** + * If disappearing messages are enabled, amount of seconds before a message disappears + */ public expirationSeconds: number; + + /** + * List of members in the group + */ public members: User[]; + + /** + * List of members pending acceptance + */ public pendingMembers: User[]; + + /** + * List of members pending admin approval + */ public requestingMembers: User[]; + + /** + * List of admins + */ public admins: User[]; + + /** + * List of members banned from the group + */ public bannedMembers: User[]; + + /** + * Permission information + */ public permissions: GroupPermissions; + + /** + * If enabled, link to the group + */ public inviteLink?: string; private client: Client; + /** + * @param initiator - The group being worked on + * @param data - Data from signal-cli + * @param client + * @internal + */ constructor(initiator: Group, data: any, client: Client) { this.initiator = initiator; this.client = client; @@ -46,6 +110,10 @@ export class GroupEditor { this.inviteLink = group.groupInviteLink ?? null; } + /** + * Update the name of the group + * @param name - The new group name + */ public async setName(name: string) { await CLIDispatcher.dispatch( "updateGroup", @@ -59,6 +127,10 @@ export class GroupEditor { this.name = name; } + /** + * Update the description of the group + * @param description - The new group description + */ public async setDescription(description: string) { await CLIDispatcher.dispatch( "updateGroup", @@ -72,6 +144,10 @@ export class GroupEditor { this.description = description; } + /** + * Update the avatar of the group + * @param avatar - The new group avatar + */ public async setAvatar(avatar: AttachmentBuilder) { await CLIDispatcher.dispatch( "updateGroup", @@ -83,6 +159,11 @@ export class GroupEditor { ); } + /** + * Update the disappearing messages setting for the group + * @param seconds - The time (in seconds) before a message gets deleted. + * Use 0 to disable disappearing messages + */ public async setExpirationSeconds(seconds: number) { await CLIDispatcher.dispatch( "updateGroup", @@ -96,6 +177,9 @@ export class GroupEditor { this.expirationSeconds = seconds; } + /** + * Reset the group invite link and create a new one + */ public async resetInviteLink() { await CLIDispatcher.dispatch( "updateGroup", @@ -107,6 +191,10 @@ export class GroupEditor { ); } + /** + * Change the status of the group invite link + * @param status - The new group invite link status + */ public async setLinkStatus(status: GroupLinkStatus) { await CLIDispatcher.dispatch( "updateGroup", diff --git a/classes/GroupMessage.ts b/classes/GroupMessage.ts index e919963..e32328a 100644 --- a/classes/GroupMessage.ts +++ b/classes/GroupMessage.ts @@ -3,10 +3,28 @@ import {User} from "./User"; import {Group} from "./Group"; import {Client} from "./Client"; +/** + * A message sent in a {@link Group} + */ export class GroupMessage extends ReceivedMessage { + /** + * {@link Group} the message was sent to + */ public channel: Group; + + /** + * Whether the message was sent in a group channel or not + */ public isGroup: boolean = true; + /** + * @param user - The author of the message + * @param time - The timestamp the message was sent at + * @param group - The group the message was sent in + * @param client + * @param expirity - The number of seconds remaining before the message disappears, if applicable + * @internal + */ constructor(user: User, time: number, group: Group, client: Client, expirity?: number) { super(user, time, group, client, expirity); } diff --git a/classes/GroupPermissions.ts b/classes/GroupPermissions.ts index 82ca1e2..0d211da 100644 --- a/classes/GroupPermissions.ts +++ b/classes/GroupPermissions.ts @@ -4,13 +4,37 @@ import {GroupPermissionName} from "../enums/GroupPermissionName"; import {CLIDispatcher} from "./CLIDispatcher"; import {GroupEditor} from "./GroupEditor"; +/** + * Permissions associated with a group + */ export class GroupPermissions { + /** + * Current permission level for the "Who can add members" permission + */ public addMember: GroupPermissionLevel; + + /** + * Current permission level for the "Who can edit group info" permission + */ public editDetails: GroupPermissionLevel; + + /** + * Current permission level for the "Who can send messages" permission + */ public sendMessage: GroupPermissionLevel; + + /** + * Originating {@link GroupEditor} + */ public editor: GroupEditor; private client: Client; + /** + * @param groupData - The data associated with this group + * @param editor - The originating GroupEditor + * @param client + * @internal + */ constructor(groupData: any, editor: GroupEditor, client: Client) { this.editor = editor; @@ -33,6 +57,11 @@ export class GroupPermissions { } } + /** + * Change a permission's level + * @param permission - The permission name + * @param level - The permission level + */ public async change(permission: GroupPermissionName, level: GroupPermissionLevel) { if (permission === GroupPermissionName.AddMember) { await CLIDispatcher.dispatch( diff --git a/classes/GroupReactionMessage.ts b/classes/GroupReactionMessage.ts index afc6dd0..63562b0 100644 --- a/classes/GroupReactionMessage.ts +++ b/classes/GroupReactionMessage.ts @@ -8,13 +8,32 @@ import {ReactionTarget} from "./ReactionTarget"; import {ReactionMessage} from "./ReactionMessage"; /** - * A reaction message as sent by Signal + * A reaction message sent in a {@link Group} */ export class GroupReactionMessage extends GroupMessage implements ReactionMessage { + /** + * {@link Emoji} that was used for the reaction + */ public emoji: Emoji; + + /** + * Whether the reaction is a removal + */ public removed: boolean; + + /** + * Message targeted by the reaction + */ public target: ReactionTarget; + /** + * @param user - The author of the message + * @param data - Data associated with the reaction + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param client + * @internal + */ constructor(user: User, data: any, time: number, groupId: string, client: Client) { super(user, time, new Group(groupId, client), client, data.expiresInSeconds); this.removed = data.reaction.isRemove; diff --git a/classes/GroupStickerMessage.ts b/classes/GroupStickerMessage.ts index 6b08f65..92eba2f 100644 --- a/classes/GroupStickerMessage.ts +++ b/classes/GroupStickerMessage.ts @@ -2,16 +2,27 @@ import {User} from "./User"; import {GroupMessage} from "./GroupMessage"; import {Group} from "./Group"; import {Client} from "./Client"; -import {StickerMessage} from "./StickerMessage"; import {Sticker} from "./Sticker"; import {StickerSource} from "../enums/StickerSource"; +import {StickerMessage} from "./StickerMessage"; /** - * A sticker message as sent by Signal + * A sticker message sent in a {@link Group} */ export class GroupStickerMessage extends GroupMessage implements StickerMessage { + /** + * {@link Sticker} that was sent + */ public sticker: Sticker; + /** + * @param user - The author of the message + * @param data - Data associated with the sticker + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param client + * @internal + */ constructor(user: User, data: any, time: number, groupId: string, client: Client) { super(user, time, new Group(groupId, client), client, data.expiresInSeconds); this.sticker = new Sticker(StickerSource.Received, data.sticker, client); diff --git a/classes/GroupTypingMessage.ts b/classes/GroupTypingMessage.ts index 5144df1..d887e08 100644 --- a/classes/GroupTypingMessage.ts +++ b/classes/GroupTypingMessage.ts @@ -4,13 +4,25 @@ import {GroupMessage} from "./GroupMessage"; import {Group} from "./Group"; import {Client} from "./Client"; import {TypingMessageAction} from "../enums/TypingMessageAction"; +import {TypingMessage} from "./TypingMessage"; /** - * A typing message as sent by Signal + * A {@link TypingMessage} sent in a {@link Group} */ -export class GroupTypingMessage extends GroupMessage { +export class GroupTypingMessage extends GroupMessage implements TypingMessage { + /** + * Action associated with the typing message + */ public action: TypingMessageAction; + /** + * @param user - The author of the message + * @param action - The action associated with the typing message + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param client + * @internal + */ constructor(user: User, action: TypingMessageAction, time: number, groupId: string, client: Client) { super(user, time, new Group(groupId, client), client); this.action = action; diff --git a/classes/MessageFormatting.ts b/classes/MessageFormatting.ts index d46867a..88df999 100644 --- a/classes/MessageFormatting.ts +++ b/classes/MessageFormatting.ts @@ -1,9 +1,19 @@ import {MessageFormattingRule} from "./MessageFormattingRule"; -import {MessageFormattingFormat} from "../enums/MessageFormattingFormat"; +/** + * A collection of rules to apply formatting styles to a message + */ export class MessageFormatting { + /** + * Array of {@link MessageFormattingRule} + */ public rules: MessageFormattingRule[]; + /** + * @param plain - Plain text message + * @param data - List of Signal-formatted rules + * @internal + */ constructor(plain?: string, data?: any) { if (data && plain) { this.rules = data.map(i => { @@ -14,6 +24,10 @@ export class MessageFormatting { } } + /** + * Convert from a list of formatting rules + * @param rules + */ public static fromRules(rules: MessageFormattingRule[]): MessageFormatting { let mf = new MessageFormatting(); diff --git a/classes/MessageFormattingRule.ts b/classes/MessageFormattingRule.ts index 7ec061d..0b8590f 100644 --- a/classes/MessageFormattingRule.ts +++ b/classes/MessageFormattingRule.ts @@ -1,12 +1,39 @@ import {MessageFormattingStyle} from "../enums/MessageFormattingStyle"; +/** + * A rule used to apply formatting styles to a message + */ export class MessageFormattingRule { + /** + * Starting position of the rule + */ public start: number; + + /** + * Ending position of the rule + */ public end: number; + + /** + * Length of the rule + */ public length: number; + + /** + * Chunk of text covered by this rule + */ public extract?: string; + + /** + * Style the rule has to apply + */ public styling: MessageFormattingStyle; + /** + * @param data - Data to reconstruct the formatting rule + * @param text - Non-formatted message text + * @internal + */ constructor(data: any, text?: string) { this.styling = data.style; this.start = data.start; @@ -15,6 +42,12 @@ export class MessageFormattingRule { this.extract = text?.substring(this.start, this.end); } + /** + * Build a formatting rule + * @param style - The style to apply + * @param start - The start position + * @param length - The length of the rule + */ public static build(style: MessageFormattingStyle, start: number, length: number) { return new MessageFormattingRule({ style, @@ -23,6 +56,9 @@ export class MessageFormattingRule { }); } + /** + * Convert the formatting rule to a format that can be passed to signal-cli + */ public toCLIFormat(): string { return this.start + ":" + this.length + ":" + this.styling; } diff --git a/classes/ObjectCache.ts b/classes/ObjectCache.ts index 2940e4a..c217ea5 100644 --- a/classes/ObjectCache.ts +++ b/classes/ObjectCache.ts @@ -1,3 +1,7 @@ +/** + * A cache for data to be used later + * @internal + */ export class ObjectCache extends Object { constructor(props) { super(props); diff --git a/classes/QuoteBuilder.ts b/classes/QuoteBuilder.ts index 7fa62bd..d89bcbe 100644 --- a/classes/QuoteBuilder.ts +++ b/classes/QuoteBuilder.ts @@ -1,12 +1,32 @@ import {QuoteMessage} from "./QuoteMessage"; import {Client} from "./Client"; +/** + * A helper class to build a quote to send + */ export class QuoteBuilder { + /** + * Timestamp at which the quoted message was sent + */ public timestamp: number; + + /** + * Number of the author of the quoted message + */ public author: string; + + /** + * Text of the quoted message + */ public content?: string; private client: Client; + /** + * @param client + * @param timestamp - The timestamp at which the quoted message was sent + * @param number - The number of the author of the quoted message + * @param text - The text of the quoted message + */ constructor(client: Client, timestamp: number, number: string, text?: string) { this.client = client; this.timestamp = timestamp; @@ -14,6 +34,9 @@ export class QuoteBuilder { this.content = text; } + /** + * Transform the {@link QuoteBuilder} into a valid {@link QuoteMessage} + */ public build(): QuoteMessage { return new QuoteMessage({ authorNumber: this.author, diff --git a/classes/QuoteMessage.ts b/classes/QuoteMessage.ts index 142ad23..5485ce9 100644 --- a/classes/QuoteMessage.ts +++ b/classes/QuoteMessage.ts @@ -3,13 +3,40 @@ import {Attachment} from "./Attachment"; import {UserDataType} from "../enums/UserDataType"; import {Client} from "./Client"; +/** + * A message constructed from a quote + */ export class QuoteMessage { + /** + * {@link Date} the quoted message was sent at + */ public createdAt: Date; + + /** + * Timestamp the quoted message was sent at + */ public createdTimestamp: number; + + /** + * Author of the quoted message + */ public author: User; + + /** + * Text of the quoted message + */ public content?: string; + + /** + * Attachments in the quoted message + */ public attachments?: Attachment[]; + /** + * @param quoteData - Data to reconstruct the quoted message + * @param client + * @internal + */ constructor(quoteData: any, client: Client) { this.author = new User(quoteData, UserDataType.Quote, client); this.content = quoteData.text && quoteData.text.trim().length > 0 ? quoteData.text : null; diff --git a/classes/ReactionMessage.ts b/classes/ReactionMessage.ts index 22b8fd6..28f1fca 100644 --- a/classes/ReactionMessage.ts +++ b/classes/ReactionMessage.ts @@ -3,8 +3,23 @@ import {QuoteMessage} from "./QuoteMessage"; import {Emoji} from "./Emoji"; import {ReactionTarget} from "./ReactionTarget"; +/** + * A reaction message + * @internal + */ export class ReactionMessage { + /** + * {@link Emoji} that was used for the reaction + */ public emoji: Emoji; + + /** + * Whether the reaction is a removal + */ public removed: boolean; + + /** + * Message targetted by the reaction + */ public target: ReactionTarget; } \ No newline at end of file diff --git a/classes/ReactionTarget.ts b/classes/ReactionTarget.ts index 5a4803d..6a3c33c 100644 --- a/classes/ReactionTarget.ts +++ b/classes/ReactionTarget.ts @@ -5,7 +5,16 @@ import {DM} from "./DM"; import {Group} from "./Group"; import {Client} from "./Client"; +/** + * The target message for a reaction + */ export class ReactionTarget extends ReceivedMessage { + /** + * @param data - The data to reconstruct the target message + * @param channel - The channel the target message is in + * @param client + * @internal + */ constructor(data: any, channel: DM|Group, client: Client) { super(new User(data.reaction, UserDataType.Reaction, client), data.reaction.targetSentTimestamp, channel, client, null); } diff --git a/classes/ReceivedMessage.ts b/classes/ReceivedMessage.ts index 509b06e..fa9d4d8 100644 --- a/classes/ReceivedMessage.ts +++ b/classes/ReceivedMessage.ts @@ -3,18 +3,66 @@ import {Group} from "./Group"; import {DM} from "./DM"; import {Client} from "./Client"; +/** + * A message received from Signal + * @internal + */ export class ReceivedMessage { public client: Client; + + /** + * Author of the message + */ public author: User; + + /** + * {@link Date} the message was sent at + */ public createdAt: Date; + + /** + * Timestamp the message was sent at + */ public createdTimestamp: number; + + /** + * Channel the message was sent in + */ public channel: DM|Group; + + /** + * Whether the message will disappear automatically or not (disappearing messages) + */ public ephemeral: boolean|null = false; + + /** + * {@link Date} at which the message will disappear, if applicable + */ public expiresAt?: Date; + + /** + * Timestamp at which the message will disappear, if applicable + */ public expiresTimestamp?: number; + + /** + * Number of seconds remaining before the message disappears, if applicable + */ public expiresInSeconds?: number; + + /** + * Whether the message was sent in a group channel or not + */ public isGroup: boolean; + /** + * @param user - The author of the message + * @param time - The timestamp the message was sent at + * @param channel - The channel the message was sent it + * @param client + * @param expirity - The number of seconds remaining before the message disappears, if applicable + * @internal + */ constructor(user: User, time: number, channel: DM|Group, client: Client, expirity?: number|null) { this.client = client; this.channel = channel; diff --git a/classes/ReceivedURLPreview.ts b/classes/ReceivedURLPreview.ts index e686984..7acafbb 100644 --- a/classes/ReceivedURLPreview.ts +++ b/classes/ReceivedURLPreview.ts @@ -2,12 +2,34 @@ import {IChatMessageURLPreview} from "../types/IChatMessageURLPreview"; import {IReceivedMessageURLPreview} from "../types/IReceivedMessageURLPreview"; import {Attachment} from "./Attachment"; +/** + * A URL preview in a received message + */ export class ReceivedURLPreview { + /** + * URL for this preview + */ public url: string; + + /** + * Title of the preview + */ public title: string; + + /** + * Optional description of the preview + */ public description?: string; + + /** + * Optional {@link Attachment} of the preview's image + */ public image?: Attachment; + /** + * @param data - Data to reconstruct the {@link ReceivedURLPreview} + * @internal + */ constructor(data: any) { this.url = data.url; this.title = data.title; @@ -15,6 +37,9 @@ export class ReceivedURLPreview { if (data.image) this.image = new Attachment(data.image); } + /** + * Build a URL preview object + */ public build(): IReceivedMessageURLPreview { return { url: this.url, diff --git a/classes/SentDataMessage.ts b/classes/SentDataMessage.ts index 0f7ec37..a7ff686 100644 --- a/classes/SentDataMessage.ts +++ b/classes/SentDataMessage.ts @@ -7,16 +7,39 @@ import {SentMessage} from "./SentMessage"; import {CLIDispatcher} from "./CLIDispatcher"; import {MessageReceipt} from "../enums/MessageReceipt"; +/** + * A text message sent to Signal + */ export class SentDataMessage extends SentMessage { + /** + * Text of the message + */ public content: string; + + /** + * Options used to build the message + */ public options?: IChatMessageOptions; + /** + * @param time - The timestamp at which the message was sent + * @param channel - The channel the message was sent in + * @param client + * @param content - The text of the message + * @param options - The options used to build the message + * @internal + */ constructor(time: number, channel: DM|Group, client: Client, content: string, options?: IChatMessageOptions) { super(time, channel, client); this.content = content; this.options = options; } + /** + * Edit the message + * @param text - The new text of the message + * @param options - The new options used to build the message + */ public async edit(text: string, options?: IChatMessageOptions): Promise { if (options) { options.original = this.createdTimestamp; @@ -29,6 +52,9 @@ export class SentDataMessage extends SentMessage { return await this.channel.send(text, options); } + /** + * Delete the message + */ public async delete(): Promise { if (this.channel instanceof Group) { let groupData = await CLIDispatcher.dispatch( diff --git a/classes/SentMessage.ts b/classes/SentMessage.ts index 91c3568..9875890 100644 --- a/classes/SentMessage.ts +++ b/classes/SentMessage.ts @@ -3,12 +3,33 @@ import {User} from "./User"; import {DM} from "./DM"; import {Group} from "./Group"; +/** + * A message sent to Signal by this client + */ export class SentMessage { public client: Client; + + /** + * {@link Date} at which the message was created + */ public createdAt: Date; + + /** + * Timestamp at which the message was created + */ public createdTimestamp: number; + + /** + * Channel in which the message was created + */ public channel: DM|Group; + /** + * @param time - The timestamp at which the sticker was sent + * @param channel - The channel the sticker was sent at + * @param client + * @internal + */ constructor(time: number, channel: DM|Group, client: Client) { this.client = client; this.channel = channel; diff --git a/classes/SentStickerMessage.ts b/classes/SentStickerMessage.ts index 2b46dca..e9dfdef 100644 --- a/classes/SentStickerMessage.ts +++ b/classes/SentStickerMessage.ts @@ -8,14 +8,30 @@ import {CLIDispatcher} from "./CLIDispatcher"; import {MessageReceipt} from "../enums/MessageReceipt"; import {Sticker} from "./Sticker"; +/** + * A sticker as sent to Signal + */ export class SentStickerMessage extends SentMessage { + /** + * {@link Sticker} that was sent + */ public sticker: Sticker; + /** + * @param time - The timestamp at which the sticker was sent + * @param channel - The channel the sticker was sent at + * @param client + * @param sticker - The sticker that was sent + * @internal + */ constructor(time: number, channel: DM|Group, client: Client, sticker: Sticker) { super(time, channel, client); this.sticker = sticker; } + /** + * Delete the sticker message + */ public async delete(): Promise { if (this.channel instanceof Group) { let groupData = await CLIDispatcher.dispatch( diff --git a/classes/SignalAPIError.ts b/classes/SignalAPIError.ts index fc14b47..4352235 100644 --- a/classes/SignalAPIError.ts +++ b/classes/SignalAPIError.ts @@ -1,6 +1,17 @@ +/** + * An error in the Signal API + */ export class SignalAPIError extends Error { + /** + * Internal error code for this error or category of errors + */ public code: number; + /** + * @param message - The error message + * @param code - The internal error code for this error or category of errors + * @internal + */ constructor(message: string, code?: number) { const errorCodes = { '-1': "USER_ERROR", diff --git a/classes/SignalCLIError.ts b/classes/SignalCLIError.ts index 2865b75..d805dc1 100644 --- a/classes/SignalCLIError.ts +++ b/classes/SignalCLIError.ts @@ -1,7 +1,23 @@ +/** + * An error in signal-cli + */ export class SignalCLIError extends Error { + /** + * Full path to the signal-cli executable + */ public executable: string; + + /** + * List of all the command parameters used with signal-cli + */ public arguments: string[]; + /** + * @param message - The error message + * @param executable - The full path to the signal-cli executable + * @param args - The list of all the command parameters used with signal-cli + * @internal + */ constructor(message: string, executable?: string, args?: string[]) { super(message); this.name = "SignalCLIError"; diff --git a/classes/Sticker.ts b/classes/Sticker.ts index 0e319f1..7e99477 100644 --- a/classes/Sticker.ts +++ b/classes/Sticker.ts @@ -3,11 +3,32 @@ import {Client} from "./Client"; import {Emoji} from "./Emoji"; import {StickerSource} from "../enums/StickerSource"; +/** + * A Signal sticker + */ export class Sticker { + /** + * Pack this sticker is part of + */ public pack: StickerPack; + + /** + * ID to the sticker relative to the pack + */ public id: number; + + /** + * {@link Emoji} representing this sticker, if applicable + */ public emoji?: Emoji; + /** + * @param source - The source of this sticker + * @param data - Data representing the sticker + * @param client + * @param pack - The pack the sticker is part of + * @internal + */ constructor(source: StickerSource, data: any, client: Client, pack?: StickerPack) { if (source === StickerSource.Received) { this.pack = new StickerPack(data.packId, client); diff --git a/classes/StickerMessage.ts b/classes/StickerMessage.ts index 435b2b2..e098bcf 100644 --- a/classes/StickerMessage.ts +++ b/classes/StickerMessage.ts @@ -4,6 +4,13 @@ import {Emoji} from "./Emoji"; import {ReactionTarget} from "./ReactionTarget"; import {Sticker} from "./Sticker"; +/** + * A message containing a sticker + * @internal + */ export class StickerMessage { + /** + * {@link Sticker} the message contains + */ public sticker: Sticker; } \ No newline at end of file diff --git a/classes/StickerPack.ts b/classes/StickerPack.ts index 31a2a1d..e250bc0 100644 --- a/classes/StickerPack.ts +++ b/classes/StickerPack.ts @@ -2,14 +2,45 @@ import {Client} from "./Client"; import {Sticker} from "./Sticker"; import {StickerSource} from "../enums/StickerSource"; +/** + * A Signal sticker pack + */ export class StickerPack { + /** + * Sticker pack ID + */ public id: string; + + /** + * Sticker pack name + */ public title: string; + + /** + * Sticker pack author + */ public author: string; + + /** + * URL to install the sticker pack + */ public url: string; + + /** + * Sticker used as a cover for this pack + */ public cover: Sticker; + + /** + * Stickers the pack contents + */ public items: Sticker[]; + /** + * @param id - The sticker pack's ID + * @param client + * @internal + */ constructor(id: string, client: Client) { let cacheData = client.stickerPacks['list'].filter(i => i.packId === id)[0]; diff --git a/classes/TypingMessage.ts b/classes/TypingMessage.ts new file mode 100644 index 0000000..6ad1de1 --- /dev/null +++ b/classes/TypingMessage.ts @@ -0,0 +1,18 @@ +import {Attachment} from "./Attachment"; +import {QuoteMessage} from "./QuoteMessage"; +import {MessageFormatting} from "./MessageFormatting"; +import {UserMention} from "./UserMention"; +import {IChatMessageURLPreview} from "../types/IChatMessageURLPreview"; +import {IReceivedMessageURLPreview} from "../types/IReceivedMessageURLPreview"; +import {TypingMessageAction} from "../enums/TypingMessageAction"; + +/** + * A typing message sent on Signal + * @internal + */ +export class TypingMessage { + /** + * Action associated with the typing message + */ + public action: TypingMessageAction; +} \ No newline at end of file diff --git a/classes/User.ts b/classes/User.ts index 577f951..a94e0d4 100644 --- a/classes/User.ts +++ b/classes/User.ts @@ -3,13 +3,37 @@ import {CLIDispatcher} from "./CLIDispatcher"; import {Client} from "./Client"; import {DM} from "./DM"; +/** + * A Signal user + */ export class User { + /** + * The user's phone number + */ public number?: string = null; + + /** + * The user's nickname they set + */ public nickName?: string = null; + + /** + * The user's UUID + */ public uuid?: string = null; + + /** + * The ID of the device the user is on + */ public device?: number = null; private client: Client; + /** + * @param data - Sufficient data to create a {@link User} + * @param dataType - The type of data used to create the {@link User} + * @param client + * @internal + */ constructor(data: any, dataType: UserDataType, client: Client) { this.client = client; @@ -32,14 +56,26 @@ export class User { } } + /** + * Create a {@link DM} with this user + */ public createDM() { return new DM(this.uuid ?? null, this.number, this.client); } + /** + * Create a new {@link User} from a phone number + * @param number - The phone number to use + * @param client + */ public static fromNumber(number: string, client: Client) { return new User(number, UserDataType.Number, client); } + /** + * Block or unblock this user + * @param blocked - Whether the user should be blocked or not + */ public async setBlocked(blocked: boolean) { if (blocked) { await CLIDispatcher.dispatch( @@ -60,6 +96,12 @@ export class User { } } + /** + * Verify the user's safety number + * + * @param safetyNumber - The user's safety number. + * If not present, all known keys will be trusted + */ public async verify(safetyNumber?: string) { if (safetyNumber) { await CLIDispatcher.dispatch( @@ -82,7 +124,11 @@ export class User { } } - public async addToContacts(name?: string, disappearingMessagesTime?: number) { + /** + * Add the user to the contacts list + * @param name - The name to give the user + */ + public async addToContacts(name?: string) { await CLIDispatcher.dispatch( "updateContact", { @@ -99,6 +145,9 @@ export class User { ); } + /** + * Remove the user from the contact list + */ public async removeFromContacts() { await CLIDispatcher.dispatch( "removeContact", @@ -115,6 +164,11 @@ export class User { ); } + /** + * Change the disappearing messages expiration time + * @param time - The time (in seconds) before a message gets deleted. + * Use 0 to disable disappearing messages + */ public async setDisappearingMessagesTime(time?: number) { await CLIDispatcher.dispatch( "updateContact", diff --git a/classes/UserMention.ts b/classes/UserMention.ts index 0bcbfd6..0f40495 100644 --- a/classes/UserMention.ts +++ b/classes/UserMention.ts @@ -1,18 +1,45 @@ import {User} from "./User"; import {IUserResolvable} from "../types/IUserResolvable"; +/** + * A mention of a user in a message + */ export class UserMention { + /** + * The user's phone number + */ public number: string; + + /** + * The user's UUID + */ public uuid?: string; + + /** + * The start of the mention in the message + */ public start: number; + + /** + * The length of the mention in the message + */ public length?: number = 1; + /** + * @param user - The {@link User} (or {@link IUserResolvable}) to mention + * @param start - Where the mention should start in the message + * @param length - How long the mention should be in the message + * @internal + */ constructor(user: User|IUserResolvable, start?: number, length?: number) { this.number = user instanceof User ? user.number : user; this.start = start ?? 0; this.length = length ?? 1; } + /** + * Convert the mention to a format that can be passed to signal-cli + */ public toCLIFormat(): string { return this.start + ":" + this.length + ":" + this.number; } diff --git a/dist/classes/Attachment.d.ts b/dist/classes/Attachment.d.ts index 1b350a0..cbb4ee2 100644 --- a/dist/classes/Attachment.d.ts +++ b/dist/classes/Attachment.d.ts @@ -1,12 +1,40 @@ import { IMimeType } from "../types/IMimeType"; import { AttachmentSize } from "./AttachmentSize"; +/** + * An attachment added to a message + */ export declare class Attachment { + /** + * Attachment MIME type + */ type: IMimeType; + /** + * Attachment file name + */ fileName: string; + /** + * Attachment file ID set by Signal + */ fileId: string; + /** + * Attachment size + */ size: AttachmentSize; + /** + * If the attachment is an image, its width + */ width?: number; + /** + * If the attachment is an image, its height + */ height?: number; + /** + * If the attachment is an image, its alternative text + */ caption?: string; + /** + * @param attachmentData - Data to use to construct the attachment + * @internal + */ constructor(attachmentData: any); } diff --git a/dist/classes/Attachment.js b/dist/classes/Attachment.js index 0b4ad91..6b339b8 100644 --- a/dist/classes/Attachment.js +++ b/dist/classes/Attachment.js @@ -2,7 +2,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Attachment = void 0; const AttachmentSize_1 = require("./AttachmentSize"); +/** + * An attachment added to a message + */ class Attachment { + /** + * @param attachmentData - Data to use to construct the attachment + * @internal + */ constructor(attachmentData) { this.type = attachmentData.contentType; this.fileName = attachmentData.filename; diff --git a/dist/classes/Attachment.js.map b/dist/classes/Attachment.js.map index 242b891..8583de1 100644 --- a/dist/classes/Attachment.js.map +++ b/dist/classes/Attachment.js.map @@ -1 +1 @@ -{"version":3,"file":"Attachment.js","sourceRoot":"","sources":["../../classes/Attachment.ts"],"names":[],"mappings":";;;AACA,qDAAgD;AAEhD,MAAa,UAAU;IASnB,YAAY,cAAmB;QAC3B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,+BAAc,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;QACpC,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC;IAC1C,CAAC;CACJ;AAlBD,gCAkBC"} \ No newline at end of file +{"version":3,"file":"Attachment.js","sourceRoot":"","sources":["../../classes/Attachment.ts"],"names":[],"mappings":";;;AACA,qDAAgD;AAEhD;;GAEG;AACH,MAAa,UAAU;IAoCnB;;;OAGG;IACH,YAAY,cAAmB;QAC3B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,+BAAc,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;QACpC,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC;IAC1C,CAAC;CACJ;AAjDD,gCAiDC"} \ No newline at end of file diff --git a/dist/classes/AttachmentBuilder.d.ts b/dist/classes/AttachmentBuilder.d.ts index de106ff..48af8c7 100644 --- a/dist/classes/AttachmentBuilder.d.ts +++ b/dist/classes/AttachmentBuilder.d.ts @@ -1,7 +1,16 @@ import { IFilePath } from "../types/IFilePath"; import { IDataURI } from "../types/IDataURI"; import { IAttachmentBuilderData } from "../types/IAttachmentBuilderData"; +/** + * A helper to build an attachment to send to a message + */ export declare class AttachmentBuilder { + /** + * The rest of the attachment as a URI that can be passed to signal-cli + */ uri: IFilePath | IDataURI; + /** + * @param data - A file path, data URI, or object to construct an attachment + */ constructor(data: IFilePath | IDataURI | IAttachmentBuilderData); } diff --git a/dist/classes/AttachmentBuilder.js b/dist/classes/AttachmentBuilder.js index 169b01f..871b1c3 100644 --- a/dist/classes/AttachmentBuilder.js +++ b/dist/classes/AttachmentBuilder.js @@ -2,7 +2,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.AttachmentBuilder = void 0; const fs_1 = require("fs"); +/** + * A helper to build an attachment to send to a message + */ class AttachmentBuilder { + /** + * @param data - A file path, data URI, or object to construct an attachment + */ constructor(data) { if (typeof data === "string") { if (!data.startsWith("data:")) { diff --git a/dist/classes/AttachmentBuilder.js.map b/dist/classes/AttachmentBuilder.js.map index 4d17fb0..e3ce006 100644 --- a/dist/classes/AttachmentBuilder.js.map +++ b/dist/classes/AttachmentBuilder.js.map @@ -1 +1 @@ -{"version":3,"file":"AttachmentBuilder.js","sourceRoot":"","sources":["../../classes/AttachmentBuilder.ts"],"names":[],"mappings":";;;AAGA,2BAA6B;AAE7B,MAAa,iBAAiB;IAG1B,YAAY,IAA+C;QACvD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC1B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;gBAC3B,IAAA,cAAS,EAAC,IAAI,CAAC,CAAC;aACnB;YAED,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;SACnB;aAAM;YACH,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,0BAA0B,CAAC;YAEnD,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACf,IAAI,CAAC,GAAG,GAAG,QAAQ,IAAI,aAAa,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;aACrH;iBAAM;gBACH,IAAI,CAAC,GAAG,GAAG,QAAQ,IAAI,WAAW,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;aACpE;SACJ;IACL,CAAC;CACJ;AApBD,8CAoBC"} \ No newline at end of file +{"version":3,"file":"AttachmentBuilder.js","sourceRoot":"","sources":["../../classes/AttachmentBuilder.ts"],"names":[],"mappings":";;;AAGA,2BAA6B;AAE7B;;GAEG;AACH,MAAa,iBAAiB;IAM1B;;OAEG;IACH,YAAY,IAA+C;QACvD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC1B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;gBAC3B,IAAA,cAAS,EAAC,IAAI,CAAC,CAAC;aACnB;YAED,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;SACnB;aAAM;YACH,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,0BAA0B,CAAC;YAEnD,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACf,IAAI,CAAC,GAAG,GAAG,QAAQ,IAAI,aAAa,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;aACrH;iBAAM;gBACH,IAAI,CAAC,GAAG,GAAG,QAAQ,IAAI,WAAW,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;aACpE;SACJ;IACL,CAAC;CACJ;AA1BD,8CA0BC"} \ No newline at end of file diff --git a/dist/classes/AttachmentSize.d.ts b/dist/classes/AttachmentSize.d.ts index cb01288..c628b0e 100644 --- a/dist/classes/AttachmentSize.d.ts +++ b/dist/classes/AttachmentSize.d.ts @@ -1,4 +1,14 @@ +/** + * A size to associate with an Attachment + */ export declare class AttachmentSize extends Number { + /** + * @internal + * @param props + */ constructor(props: any); + /** + * Convert the size from bytes to bits + */ toBits(): number; } diff --git a/dist/classes/AttachmentSize.js b/dist/classes/AttachmentSize.js index f531248..e21c6e1 100644 --- a/dist/classes/AttachmentSize.js +++ b/dist/classes/AttachmentSize.js @@ -1,10 +1,20 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AttachmentSize = void 0; +/** + * A size to associate with an Attachment + */ class AttachmentSize extends Number { + /** + * @internal + * @param props + */ constructor(props) { super(props); } + /** + * Convert the size from bytes to bits + */ toBits() { return parseInt(this.toString()) * 8; } diff --git a/dist/classes/AttachmentSize.js.map b/dist/classes/AttachmentSize.js.map index d79782a..0f9ce45 100644 --- a/dist/classes/AttachmentSize.js.map +++ b/dist/classes/AttachmentSize.js.map @@ -1 +1 @@ -{"version":3,"file":"AttachmentSize.js","sourceRoot":"","sources":["../../classes/AttachmentSize.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAe,SAAQ,MAAM;IACtC,YAAY,KAAK;QACb,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEM,MAAM;QACT,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;CACJ;AARD,wCAQC"} \ No newline at end of file +{"version":3,"file":"AttachmentSize.js","sourceRoot":"","sources":["../../classes/AttachmentSize.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,cAAe,SAAQ,MAAM;IACtC;;;OAGG;IACH,YAAY,KAAK;QACb,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED;;OAEG;IACI,MAAM;QACT,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;CACJ;AAfD,wCAeC"} \ No newline at end of file diff --git a/dist/classes/CLIDispatcher.d.ts b/dist/classes/CLIDispatcher.d.ts index 62cc284..4c526be 100644 --- a/dist/classes/CLIDispatcher.d.ts +++ b/dist/classes/CLIDispatcher.d.ts @@ -1,5 +1,16 @@ /// import { ChildProcess } from "child_process"; +/** + * A dispatcher used to send requests to signal-cli and receive a response + */ export declare class CLIDispatcher { + /** + * Dispatch a request to signal-cli + * @param method - The method to associate with the request. + * Use `signal-cli --help` to get a full list + * @param params - The parameters to pass with the request. + * Use `signal-cli --help` to get a full list for the current method + * @param proc - The signal-cli process to dispatch to + */ static dispatch(method: string, params: any, proc: ChildProcess): Promise; } diff --git a/dist/classes/CLIDispatcher.js b/dist/classes/CLIDispatcher.js index 7510ac5..ae8a320 100644 --- a/dist/classes/CLIDispatcher.js +++ b/dist/classes/CLIDispatcher.js @@ -3,7 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.CLIDispatcher = void 0; const crypto_1 = require("crypto"); const SignalAPIError_1 = require("./SignalAPIError"); +/** + * A dispatcher used to send requests to signal-cli and receive a response + */ class CLIDispatcher { + /** + * Dispatch a request to signal-cli + * @param method - The method to associate with the request. + * Use `signal-cli --help` to get a full list + * @param params - The parameters to pass with the request. + * Use `signal-cli --help` to get a full list for the current method + * @param proc - The signal-cli process to dispatch to + */ static dispatch(method, params, proc) { return new Promise((res, rej) => { let id = (0, crypto_1.randomUUID)(); diff --git a/dist/classes/CLIDispatcher.js.map b/dist/classes/CLIDispatcher.js.map index 3b5e205..4409a2b 100644 --- a/dist/classes/CLIDispatcher.js.map +++ b/dist/classes/CLIDispatcher.js.map @@ -1 +1 @@ -{"version":3,"file":"CLIDispatcher.js","sourceRoot":"","sources":["../../classes/CLIDispatcher.ts"],"names":[],"mappings":";;;AACA,mCAAwC;AAGxC,qDAAgD;AAEhD,MAAa,aAAa;IACtB,MAAM,CAAC,QAAQ,CAAC,MAAc,EAAE,MAAW,EAAE,IAAkB;QAC3D,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC5B,IAAI,EAAE,GAAS,IAAA,mBAAU,GAAE,CAAC;YAC5B,IAAI,OAAO,GAAgB;gBACvB,OAAO,EAAE,KAAK;gBACd,MAAM;gBACN,MAAM;gBACN,EAAE;aACL,CAAA;YAED,IAAI,QAAQ,GAAkB,CAAC,GAAG,EAAQ,EAAE;gBACxC,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE;oBAAE,OAAO;gBACzC,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAEtC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AAG,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAEtC,IAAI,IAAI,CAAC,KAAK,EAAE;oBACZ,GAAG,CAAC,IAAI,+BAAc,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC;iBAChF;gBAED,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;oBAChB,GAAG,CAAC,IAAI,CAAC,CAAC;oBACV,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;iBAChD;YACL,CAAC,CAAA;YAED,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAC1C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AArCD,sCAqCC"} \ No newline at end of file diff --git a/dist/classes/CLIEvent.d.ts b/dist/classes/CLIEvent.d.ts index b08a161..c85022c 100644 --- a/dist/classes/CLIEvent.d.ts +++ b/dist/classes/CLIEvent.d.ts @@ -4,5 +4,10 @@ import { ICLIEvent } from "../types/ICLIEvent"; * A signal-cli event */ export declare class CLIEvent { + /** + * @internal + * @param client + * @param data + */ static fromEvent(client: Client, data: ICLIEvent): void; } diff --git a/dist/classes/CLIEvent.js b/dist/classes/CLIEvent.js index 15660da..760cdef 100644 --- a/dist/classes/CLIEvent.js +++ b/dist/classes/CLIEvent.js @@ -21,6 +21,11 @@ const Group_1 = require("./Group"); * A signal-cli event */ class CLIEvent { + /** + * @internal + * @param client + * @param data + */ static fromEvent(client, data) { client.emit("cliEvent", data); if (data.method === "receive") { diff --git a/dist/classes/CLIEvent.js.map b/dist/classes/CLIEvent.js.map index c3a3cf8..d84ed4d 100644 --- a/dist/classes/CLIEvent.js.map +++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yBACnC;oBACL,CAAC,CAAC,CAAA;iBACL;qBAAM;oBACH,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,EAAE;wBAC5C,IAAI,OAAO,GAAqB,IAAI,mCAAgB,CAChD,IAAI,WAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,2BAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,EAC7D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAChC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,EAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,EAClD,MAAM,CACT,CAAC;wBAEF,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;qBACnC;yBAAM;wBACH,IAAI,OAAO,GAAkB,IAAI,6BAAa,CAC1C,IAAI,WAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,2BAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,EAC7D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAChC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,EAC1C,MAAM,CACT,CAAC;wBAEF,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;qBACnC;iBACJ;aACJ;SACJ;IACL,CAAC;CACJ;AA3KD,4BA2KC"} \ No newline at end of file diff --git a/dist/classes/Channel.d.ts b/dist/classes/Channel.d.ts index 50335f4..e9aa51b 100644 --- a/dist/classes/Channel.d.ts +++ b/dist/classes/Channel.d.ts @@ -1,9 +1,30 @@ import { IChatMessageOptions } from "../types/IChatMessageOptions"; import { SentDataMessage } from "./SentDataMessage"; +/** + * A channel (either DM or group) on Signal + */ export declare class Channel { + /** + * Whether the channel is a group chat + */ group: boolean; + /** + * Channel (DM or group) ID + */ id: string; + /** + * @internal + */ constructor(); + /** + * Send a message to the channel + * @param text - The text of the message, or an empty string + * @param options - The optional options used to build the message + */ send(text: string, options?: IChatMessageOptions): Promise; + /** + * Set the client's typing status for this channel + * @param typing - Whether the client should be typing or not + */ setTyping(typing: boolean): Promise; } diff --git a/dist/classes/Channel.js b/dist/classes/Channel.js index 385102f..3b3c0f4 100644 --- a/dist/classes/Channel.js +++ b/dist/classes/Channel.js @@ -1,10 +1,25 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Channel = void 0; +/** + * A channel (either DM or group) on Signal + */ class Channel { + /** + * @internal + */ constructor() { } + /** + * Send a message to the channel + * @param text - The text of the message, or an empty string + * @param options - The optional options used to build the message + */ // @ts-ignore async send(text, options) { } + /** + * Set the client's typing status for this channel + * @param typing - Whether the client should be typing or not + */ async setTyping(typing) { } } exports.Channel = Channel; diff --git a/dist/classes/Channel.js.map b/dist/classes/Channel.js.map index 00f828b..819e862 100644 --- a/dist/classes/Channel.js.map +++ b/dist/classes/Channel.js.map @@ -1 +1 @@ -{"version":3,"file":"Channel.js","sourceRoot":"","sources":["../../classes/Channel.ts"],"names":[],"mappings":";;;AAGA,MAAa,OAAO;IAIhB,gBAAe,CAAC;IAChB,aAAa;IACN,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,OAA6B,IAA6B,CAAC;IAEpF,KAAK,CAAC,SAAS,CAAC,MAAe,IAAkB,CAAC;CAC5D;AATD,0BASC"} \ No newline at end of file +{"version":3,"file":"Channel.js","sourceRoot":"","sources":["../../classes/Channel.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,MAAa,OAAO;IAWhB;;OAEG;IACH,gBAAe,CAAC;IAEhB;;;;OAIG;IACH,aAAa;IACN,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,OAA6B,IAA6B,CAAC;IAE3F;;;OAGG;IACI,KAAK,CAAC,SAAS,CAAC,MAAe,IAAkB,CAAC;CAC5D;AA7BD,0BA6BC"} \ No newline at end of file diff --git a/dist/classes/Client.d.ts b/dist/classes/Client.d.ts index 519f84f..0e50f71 100644 --- a/dist/classes/Client.d.ts +++ b/dist/classes/Client.d.ts @@ -20,52 +20,75 @@ import { DMDeleteMessage } from "./DMDeleteMessage"; import { Group } from "./Group"; export declare interface Client { /** + * Emitted when a Signal event, even if unsupported, is received by signal-cli * @event Client#cliEvent */ on(event: "cliEvent", listener: (event: ICLIEvent) => void): this; /** + * Emitted when a typing message is received * @event Client#typingMessage */ on(event: "typingMessage", listener: (message: GroupTypingMessage | DMTypingMessage) => void): this; /** + * Emitted when a data (text) message is received * @event Client#message */ on(event: "message", listener: (message: GroupDataMessage | DMDataMessage) => void): this; /** + * Emitted when a message is edited * @event Client#editMessage */ on(event: "editMessage", listener: (message: GroupEditMessage | DMEditMessage) => void): this; /** + * Emitted when a reaction is added or removed to/from a message * @event Client#reaction */ on(event: "reaction", listener: (message: GroupReactionMessage | DMReactionMessage) => void): this; /** + * Emitted when a reaction is added to a message * @event Client#reactionAdd */ on(event: "reactionAdd", listener: (message: GroupReactionMessage | DMReactionMessage) => void): this; /** + * Emitted when a reaction is removed from a message * @event Client#reactionRemove */ on(event: "reactionRemove", listener: (message: GroupReactionMessage | DMReactionMessage) => void): this; /** + * Emitted when a sticker message is received * @event Client#sticker */ on(event: "sticker", listener: (message: GroupStickerMessage | DMStickerMessage) => void): this; /** + * Emitted when a message in a channel gets deleted * @event Client#deleteMessage */ on(event: "deleteMessage", listener: (message: GroupDeleteMessage | DMDeleteMessage) => void): this; /** + * Emitted when a group's information gets updated * @event Client#groupUpdate */ on(event: "groupUpdate", listener: (group: Group) => void): this; } /** - * The base signal.js client + * The base Signal.js client interface */ export declare class Client extends EventEmitter { + /** + * The signal-cli process + */ process: ChildProcess; + /** + * An {@link ObjectCache} for the registered sticker packs + * @internal + */ stickerPacks: ObjectCache; + /** + * Whether verbose mode (logging events) should be enabled + */ verbose: boolean; + /** + * @param config - The configuration to use with signal-cli + */ constructor(config: IConfig); } diff --git a/dist/classes/Client.js b/dist/classes/Client.js index 07c13dc..f7b6f4a 100644 --- a/dist/classes/Client.js +++ b/dist/classes/Client.js @@ -6,12 +6,22 @@ const CLIEvent_1 = require("./CLIEvent"); const SignalCLIError_1 = require("./SignalCLIError"); const events_1 = require("events"); /** - * The base signal.js client + * The base Signal.js client interface */ class Client extends events_1.EventEmitter { + /** + * @param config - The configuration to use with signal-cli + */ constructor(config) { super(); + /** + * An {@link ObjectCache} for the registered sticker packs + * @internal + */ this.stickerPacks = {}; + /** + * Whether verbose mode (logging events) should be enabled + */ this.verbose = false; let command = config.signalCli ?? "signal-cli"; let parameters = []; @@ -23,8 +33,6 @@ class Client extends events_1.EventEmitter { parameters.push("--config", config.configPath); if (config.cliLog) parameters.push("--log-file", config.cliLog); - if (typeof config.verbose === "number") - parameters.push(...Array(config.verbose).fill("--verbose")); if (config.environment) parameters.push("--service-environment", config.environment); if (config.trustLevel) diff --git a/dist/classes/Client.js.map b/dist/classes/Client.js.map index 120a7a5..c2202a3 100644 --- a/dist/classes/Client.js.map +++ b/dist/classes/Client.js.map @@ -1 +1 @@ -{"version":3,"file":"Client.js","sourceRoot":"","sources":["../../classes/Client.ts"],"names":[],"mappings":";;;AACA,iDAAkD;AAElD,yCAAoC;AACpC,qDAAgD;AAChD,mCAAoC;AA6DpC;;GAEG;AACH,MAAa,MAAO,SAAQ,qBAAY;IAKpC,YAAY,MAAe;QACvB,KAAK,EAAE,CAAC;QAJL,iBAAY,GAAgB,EAAE,CAAC;QAC/B,YAAO,GAAY,KAAK,CAAC;QAK5B,IAAI,OAAO,GAAW,MAAM,CAAC,SAAS,IAAI,YAAY,CAAC;QACvD,IAAI,UAAU,GAAa,EAAE,CAAC;QAE9B,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI;YAAE,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEhE,IAAI,MAAM,CAAC,QAAQ;YAAE,UAAU,CAAC,IAA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EAAE,CAAC,CAAC;gBACnD,IAAI,MAAM,CAAC,SAAS;oBAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACxC,mBAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;aAClC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YACrC,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;gBAAE,OAAO;YACzD,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;gBAAE,OAAO;YACzD,MAAM,IAAI,+BAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;QACnE,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA3DD,wBA2DC"} \ No newline at end of file diff --git a/dist/classes/DM.d.ts b/dist/classes/DM.d.ts index f81d089..09cbc3d 100644 --- a/dist/classes/DM.d.ts +++ b/dist/classes/DM.d.ts @@ -3,13 +3,40 @@ import { Client } from "./Client"; import { IChatMessageOptions } from "../types/IChatMessageOptions"; import { SentDataMessage } from "./SentDataMessage"; import { Sticker } from "./Sticker"; +/** + * A Signal 1-to-1 chat + */ export declare class DM extends Channel { + /** + * Whether the channel is a group chat + */ group: boolean; - id: string; + /** + * Recipient's phone number + */ number: string; private client; + /** + * @param userId - The ID of the user + * @param number - The user's phone number + * @param client + * @internal + */ constructor(userId: string | null, number: string, client: Client); + /** + * Send a message to the channel + * @param text - The text of the message, or an empty string + * @param options - The optional options used to build the message + */ send(text: string, options?: IChatMessageOptions): Promise; + /** + * Set the client's typing status for this channel + * @param typing - Whether the client should be typing or not + */ setTyping(typing: boolean): Promise; + /** + * Send a sticker to this channel + * @param sticker - The sticker to send + */ sendSticker(sticker: Sticker): Promise; } diff --git a/dist/classes/DM.js b/dist/classes/DM.js index e6839b8..59f7bfc 100644 --- a/dist/classes/DM.js +++ b/dist/classes/DM.js @@ -4,14 +4,31 @@ exports.DM = void 0; const Channel_1 = require("./Channel"); const CLIDispatcher_1 = require("./CLIDispatcher"); const SentDataMessage_1 = require("./SentDataMessage"); +/** + * A Signal 1-to-1 chat + */ class DM extends Channel_1.Channel { + /** + * @param userId - The ID of the user + * @param number - The user's phone number + * @param client + * @internal + */ constructor(userId, number, client) { super(); + /** + * Whether the channel is a group chat + */ this.group = false; this.id = userId; this.number = number; this.client = client; } + /** + * Send a message to the channel + * @param text - The text of the message, or an empty string + * @param options - The optional options used to build the message + */ async send(text, options) { let data = await CLIDispatcher_1.CLIDispatcher.dispatch("send", { recipient: [this.number], @@ -31,12 +48,20 @@ class DM extends Channel_1.Channel { let timestamp = data.result?.timestamp; return new SentDataMessage_1.SentDataMessage(timestamp, this, this.client, text, options); } + /** + * Set the client's typing status for this channel + * @param typing - Whether the client should be typing or not + */ async setTyping(typing) { await CLIDispatcher_1.CLIDispatcher.dispatch("sendTyping", { recipient: [this.number], stop: !typing }, this.client.process); } + /** + * Send a sticker to this channel + * @param sticker - The sticker to send + */ async sendSticker(sticker) { await CLIDispatcher_1.CLIDispatcher.dispatch("send", { recipient: [this.number], diff --git a/dist/classes/DM.js.map b/dist/classes/DM.js.map index 8dd3578..1e47d17 100644 --- a/dist/classes/DM.js.map +++ b/dist/classes/DM.js.map @@ -1 +1 @@ -{"version":3,"file":"DM.js","sourceRoot":"","sources":["../../classes/DM.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAClC,mDAA8C;AAG9C,uDAAkD;AAIlD,MAAa,EAAG,SAAQ,iBAAO;IAM3B,YAAY,MAAmB,EAAE,MAAc,EAAE,MAAc;QAC3D,KAAK,EAAE,CAAC;QANL,UAAK,GAAY,KAAK,CAAC;QAO1B,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC;QACjB,IAAI,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AM,CAAC,OAAO,CACtB,CAAC;IACN,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,WAAW,CAAC,OAAgB;QACrC,MAAM,6BAAa,CAAC,QAAQ,CACxB,MAAM,EACN;YACI,SAAS,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC;YACxB,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC,EAAE;SAC9C,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;IACN,CAAC;CACJ;AApFD,gBAoFC"} \ No newline at end of file diff --git a/dist/classes/DMDataMessage.d.ts b/dist/classes/DMDataMessage.d.ts index 4ce959a..c865488 100644 --- a/dist/classes/DMDataMessage.d.ts +++ b/dist/classes/DMDataMessage.d.ts @@ -10,17 +10,53 @@ import { IReceivedMessageURLPreview } from "../types/IReceivedMessageURLPreview" import { IChatMessageOptions } from "../types/IChatMessageOptions"; import { SentDataMessage } from "./SentDataMessage"; /** - * A data message as sent by Signal + * A data (text) message sent in a {@link DM} */ export declare class DMDataMessage extends DMMessage implements DataMessage { + /** + * Message text + */ content?: string; + /** + * {@link Attachment}s associated with the message + */ attachments: Attachment[]; + /** + * Mentions in the message + */ mentions: UserMention[]; + /** + * URL previews present in the message + */ previews: IReceivedMessageURLPreview[]; + /** + * Formatting rules collection for this message + */ formatting: MessageFormatting; + /** + * Quoted message, if applicable + */ quote?: QuoteMessage; + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, client: Client); + /** + * Mark the message as read + */ markAsRead(): Promise; + /** + * Mark the message as viewed + */ markAsViewed(): Promise; + /** + * Reply to (quote) the message + * @param text - The text of the reply + * @param options - The options used to build the reply message + */ reply(text: string, options?: IChatMessageOptions): Promise; } diff --git a/dist/classes/DMDataMessage.js b/dist/classes/DMDataMessage.js index 56371a0..b55e1cb 100644 --- a/dist/classes/DMDataMessage.js +++ b/dist/classes/DMDataMessage.js @@ -14,13 +14,29 @@ const UserDataType_1 = require("../enums/UserDataType"); const ReceivedURLPreview_1 = require("./ReceivedURLPreview"); const QuoteBuilder_1 = require("./QuoteBuilder"); /** - * A data message as sent by Signal + * A data (text) message sent in a {@link DM} */ class DMDataMessage extends DMMessage_1.DMMessage { + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param client + * @internal + */ constructor(user, data, time, client) { super(user, time, new DM_1.DM(user.uuid, user.number, client), client, data.expiresInSeconds); + /** + * {@link Attachment}s associated with the message + */ this.attachments = []; + /** + * Mentions in the message + */ this.mentions = []; + /** + * URL previews present in the message + */ this.previews = []; this.content = data.message && data.message.trim().length > 0 ? data.message : null; if (data.quote) @@ -30,6 +46,9 @@ class DMDataMessage extends DMMessage_1.DMMessage { this.mentions = data.mentions?.map(mention => new UserMention_1.UserMention(new User_1.User(UserDataType_1.UserDataType.MentionOrGroup, mention, client), mention.start, mention.length)); this.previews = data.previews?.map(preview => (new ReceivedURLPreview_1.ReceivedURLPreview(preview)).build()); } + /** + * Mark the message as read + */ async markAsRead() { await CLIDispatcher_1.CLIDispatcher.dispatch("sendReceipt", { recipient: this.author.number, @@ -37,6 +56,9 @@ class DMDataMessage extends DMMessage_1.DMMessage { type: MessageReceipt_1.MessageReceipt.Read }, this.client.process); } + /** + * Mark the message as viewed + */ async markAsViewed() { await CLIDispatcher_1.CLIDispatcher.dispatch("sendReceipt", { recipient: this.author.number, @@ -44,6 +66,11 @@ class DMDataMessage extends DMMessage_1.DMMessage { type: MessageReceipt_1.MessageReceipt.Viewed }, this.client.process); } + /** + * Reply to (quote) the message + * @param text - The text of the reply + * @param options - The options used to build the reply message + */ async reply(text, options) { if (options) { options.quote = new QuoteBuilder_1.QuoteBuilder(this.client, this.createdTimestamp, this.author.number, this.content); diff --git a/dist/classes/DMDataMessage.js.map b/dist/classes/DMDataMessage.js.map index 35ab0c9..148d133 100644 --- a/dist/classes/DMDataMessage.js.map +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I,KAAK,CAAC,YAAY;QACrB,MAAM,6BAAa,CAAC,QAAQ,CACxB,aAAa,EACb;YACI,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC7B,eAAe,EAAE,IAAI,CAAC,gBAAgB;YACtC,IAAI,EAAE,+BAAc,CAAC,MAAM;SAC9B,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAA;IACL,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,OAA6B;QAC1D,IAAI,OAAO,EAAE;YACT,OAAO,CAAC,KAAK,GAAG,IAAI,2BAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;SAC1G;aAAM;YACH,OAAO,GAAG;gBACN,KAAK,EAAE,IAAI,2BAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;aAChG,CAAA;SACJ;QAED,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;CACJ;AA9FD,sCA8FC"} \ No newline at end of file diff --git a/dist/classes/DMDeleteMessage.d.ts b/dist/classes/DMDeleteMessage.d.ts index 640e201..b2d787f 100644 --- a/dist/classes/DMDeleteMessage.d.ts +++ b/dist/classes/DMDeleteMessage.d.ts @@ -3,10 +3,24 @@ import { DMMessage } from "./DMMessage"; import { Client } from "./Client"; import { DeleteMessage } from "./DeleteMessage"; /** - * A deletion message as sent by Signal + * A deletion message sent in a {@link DM} */ export declare class DMDeleteMessage extends DMMessage implements DeleteMessage { + /** + * {@link Date} at which the original message was created + */ originalCreatedAt: Date; + /** + * Timestamp at which the original message was created + */ originalCreatedTimestamp: number; + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param originalTime - The timestamp the original message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, client: Client, originalTime: number); } diff --git a/dist/classes/DMDeleteMessage.js b/dist/classes/DMDeleteMessage.js index 3295193..b4b92b2 100644 --- a/dist/classes/DMDeleteMessage.js +++ b/dist/classes/DMDeleteMessage.js @@ -4,9 +4,17 @@ exports.DMDeleteMessage = void 0; const DMMessage_1 = require("./DMMessage"); const DM_1 = require("./DM"); /** - * A deletion message as sent by Signal + * A deletion message sent in a {@link DM} */ class DMDeleteMessage extends DMMessage_1.DMMessage { + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param originalTime - The timestamp the original message was sent at + * @param client + * @internal + */ constructor(user, data, time, client, originalTime) { super(user, time, new DM_1.DM(user.uuid, user.number, client), client, data.expiresInSeconds); this.originalCreatedAt = new Date(originalTime); diff --git a/dist/classes/DMDeleteMessage.js.map b/dist/classes/DMDeleteMessage.js.map index 6c14c3d..08ffb27 100644 --- a/dist/classes/DMDeleteMessage.js.map +++ b/dist/classes/DMDeleteMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"DMDeleteMessage.js","sourceRoot":"","sources":["../../classes/DMDeleteMessage.ts"],"names":[],"mappings":";;;AACA,2CAAsC;AACtC,6BAAwB;AAOxB;;GAEG;AACH,MAAa,eAAgB,SAAQ,qBAAS;IAI1C,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,MAAc,EAAE,YAAoB;QACjF,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,OAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzF,IAAI,CAAC,iBAAiB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,CAAC,wBAAwB,GAAG,YAAY,CAAC;IACjD,CAAC;CACJ;AATD,0CASC"} \ No newline at end of file +{"version":3,"file":"DMDeleteMessage.js","sourceRoot":"","sources":["../../classes/DMDeleteMessage.ts"],"names":[],"mappings":";;;AACA,2CAAsC;AACtC,6BAAwB;AAMxB;;GAEG;AACH,MAAa,eAAgB,SAAQ,qBAAS;IAW1C;;;;;;;OAOG;IACH,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,MAAc,EAAE,YAAoB;QACjF,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,OAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzF,IAAI,CAAC,iBAAiB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,CAAC,wBAAwB,GAAG,YAAY,CAAC;IACjD,CAAC;CACJ;AAxBD,0CAwBC"} \ No newline at end of file diff --git a/dist/classes/DMEditMessage.d.ts b/dist/classes/DMEditMessage.d.ts index fc2f85d..e692c11 100644 --- a/dist/classes/DMEditMessage.d.ts +++ b/dist/classes/DMEditMessage.d.ts @@ -3,10 +3,24 @@ import { Client } from "./Client"; import { DMDataMessage } from "./DMDataMessage"; import { EditMessage } from "./EditMessage"; /** - * An edit message as sent by Signal + * An edit message sent in a {@link DM} */ export declare class DMEditMessage extends DMDataMessage implements EditMessage { + /** + * {@link Date} at which the original message was created + */ originalCreatedAt: Date; + /** + * Timestamp at which the original message was created + */ originalCreatedTimestamp: number; + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param originalTime - The timestamp the original message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, originalTime: number, client: Client); } diff --git a/dist/classes/DMEditMessage.js b/dist/classes/DMEditMessage.js index ef69b98..6b6dc4c 100644 --- a/dist/classes/DMEditMessage.js +++ b/dist/classes/DMEditMessage.js @@ -3,9 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.DMEditMessage = void 0; const DMDataMessage_1 = require("./DMDataMessage"); /** - * An edit message as sent by Signal + * An edit message sent in a {@link DM} */ class DMEditMessage extends DMDataMessage_1.DMDataMessage { + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param originalTime - The timestamp the original message was sent at + * @param client + * @internal + */ constructor(user, data, time, originalTime, client) { super(user, data, time, client); this.originalCreatedAt = new Date(originalTime); diff --git a/dist/classes/DMEditMessage.js.map b/dist/classes/DMEditMessage.js.map index 2cafc17..ff9291b 100644 --- a/dist/classes/DMEditMessage.js.map +++ b/dist/classes/DMEditMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"DMEditMessage.js","sourceRoot":"","sources":["../../classes/DMEditMessage.ts"],"names":[],"mappings":";;;AAWA,mDAA8C;AAG9C;;GAEG;AACH,MAAa,aAAc,SAAQ,6BAAa;IAI5C,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,YAAoB,EAAE,MAAc;QACjF,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,CAAC,wBAAwB,GAAG,YAAY,CAAC;IACjD,CAAC;CACJ;AATD,sCASC"} \ No newline at end of file +{"version":3,"file":"DMEditMessage.js","sourceRoot":"","sources":["../../classes/DMEditMessage.ts"],"names":[],"mappings":";;;AAUA,mDAA8C;AAG9C;;GAEG;AACH,MAAa,aAAc,SAAQ,6BAAa;IAW5C;;;;;;;OAOG;IACH,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,YAAoB,EAAE,MAAc;QACjF,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,CAAC,wBAAwB,GAAG,YAAY,CAAC;IACjD,CAAC;CACJ;AAxBD,sCAwBC"} \ No newline at end of file diff --git a/dist/classes/DMMessage.d.ts b/dist/classes/DMMessage.d.ts index 1226cef..2c78468 100644 --- a/dist/classes/DMMessage.d.ts +++ b/dist/classes/DMMessage.d.ts @@ -2,8 +2,25 @@ import { ReceivedMessage } from "./ReceivedMessage"; import { User } from "./User"; import { DM } from "./DM"; import { Client } from "./Client"; +/** + * A message sent in a {@link DM} + */ export declare class DMMessage extends ReceivedMessage { + /** + * {@link DM} the message was sent to + */ channel: DM; + /** + * Whether the message was sent in a group channel or not + */ isGroup: boolean; + /** + * @param user - The author of the message + * @param time - The timestamp the message was sent at + * @param dm - The DM the message was sent in + * @param client + * @param expirity - The number of seconds remaining before the message disappears, if applicable + * @internal + */ constructor(user: User, time: number, dm: DM, client: Client, expirity?: number); } diff --git a/dist/classes/DMMessage.js b/dist/classes/DMMessage.js index 8d3a8d6..212dfd7 100644 --- a/dist/classes/DMMessage.js +++ b/dist/classes/DMMessage.js @@ -2,9 +2,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.DMMessage = void 0; const ReceivedMessage_1 = require("./ReceivedMessage"); +/** + * A message sent in a {@link DM} + */ class DMMessage extends ReceivedMessage_1.ReceivedMessage { + /** + * @param user - The author of the message + * @param time - The timestamp the message was sent at + * @param dm - The DM the message was sent in + * @param client + * @param expirity - The number of seconds remaining before the message disappears, if applicable + * @internal + */ constructor(user, time, dm, client, expirity) { super(user, time, dm, client, expirity); + /** + * Whether the message was sent in a group channel or not + */ this.isGroup = false; } } diff --git a/dist/classes/DMMessage.js.map b/dist/classes/DMMessage.js.map index bf3e4b6..938172d 100644 --- a/dist/classes/DMMessage.js.map +++ b/dist/classes/DMMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"DMMessage.js","sourceRoot":"","sources":["../../classes/DMMessage.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAKlD,MAAa,SAAU,SAAQ,iCAAe;IAI1C,YAAY,IAAU,EAAE,IAAY,EAAE,EAAM,EAAE,MAAc,EAAE,QAAiB;QAC3E,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAHrC,YAAO,GAAY,KAAK,CAAC;IAIhC,CAAC;CACJ;AAPD,8BAOC"} \ No newline at end of file +{"version":3,"file":"DMMessage.js","sourceRoot":"","sources":["../../classes/DMMessage.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAKlD;;GAEG;AACH,MAAa,SAAU,SAAQ,iCAAe;IAW1C;;;;;;;OAOG;IACH,YAAY,IAAU,EAAE,IAAY,EAAE,EAAM,EAAE,MAAc,EAAE,QAAiB;QAC3E,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAd5C;;WAEG;QACI,YAAO,GAAY,KAAK,CAAC;IAYhC,CAAC;CACJ;AAtBD,8BAsBC"} \ No newline at end of file diff --git a/dist/classes/DMReactionMessage.d.ts b/dist/classes/DMReactionMessage.d.ts index e53bdbc..db9ad75 100644 --- a/dist/classes/DMReactionMessage.d.ts +++ b/dist/classes/DMReactionMessage.d.ts @@ -5,11 +5,27 @@ import { Emoji } from "./Emoji"; import { ReactionTarget } from "./ReactionTarget"; import { ReactionMessage } from "./ReactionMessage"; /** - * A reaction message as sent by Signal + * A reaction message sent in a {@link DM} */ export declare class DMReactionMessage extends DMMessage implements ReactionMessage { + /** + * Emoji that was used for the reaction + */ emoji: Emoji; + /** + * Whether the reaction is a removal + */ removed: boolean; + /** + * Message targetted by the reaction + */ target: ReactionTarget; + /** + * @param user - The author of the message + * @param data - Data associated with the reaction + * @param time - The timestamp the message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, client: Client); } diff --git a/dist/classes/DMReactionMessage.js b/dist/classes/DMReactionMessage.js index fe24252..546eabd 100644 --- a/dist/classes/DMReactionMessage.js +++ b/dist/classes/DMReactionMessage.js @@ -6,9 +6,16 @@ const DM_1 = require("./DM"); const Emoji_1 = require("./Emoji"); const ReactionTarget_1 = require("./ReactionTarget"); /** - * A reaction message as sent by Signal + * A reaction message sent in a {@link DM} */ class DMReactionMessage extends DMMessage_1.DMMessage { + /** + * @param user - The author of the message + * @param data - Data associated with the reaction + * @param time - The timestamp the message was sent at + * @param client + * @internal + */ constructor(user, data, time, client) { super(user, time, new DM_1.DM(user.uuid, user.number, client), client, data.expiresInSeconds); this.removed = data.reaction.isRemove; diff --git a/dist/classes/DMReactionMessage.js.map b/dist/classes/DMReactionMessage.js.map index 773b688..7cf8227 100644 --- a/dist/classes/DMReactionMessage.js.map +++ b/dist/classes/DMReactionMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"DMReactionMessage.js","sourceRoot":"","sources":["../../classes/DMReactionMessage.ts"],"names":[],"mappings":";;;AAIA,2CAAsC;AACtC,6BAAwB;AAExB,mCAA8B;AAC9B,qDAAgD;AAGhD;;GAEG;AACH,MAAa,iBAAkB,SAAQ,qBAAS;IAK5C,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,MAAc;QAC3D,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,OAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,+BAAc,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC;CACJ;AAXD,8CAWC"} \ No newline at end of file +{"version":3,"file":"DMReactionMessage.js","sourceRoot":"","sources":["../../classes/DMReactionMessage.ts"],"names":[],"mappings":";;;AAIA,2CAAsC;AACtC,6BAAwB;AAExB,mCAA8B;AAC9B,qDAAgD;AAGhD;;GAEG;AACH,MAAa,iBAAkB,SAAQ,qBAAS;IAgB5C;;;;;;OAMG;IACH,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,MAAc;QAC3D,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,OAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,+BAAc,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC;CACJ;AA7BD,8CA6BC"} \ No newline at end of file diff --git a/dist/classes/DMStickerMessage.d.ts b/dist/classes/DMStickerMessage.d.ts index 8d26455..5af6d17 100644 --- a/dist/classes/DMStickerMessage.d.ts +++ b/dist/classes/DMStickerMessage.d.ts @@ -4,9 +4,19 @@ import { Client } from "./Client"; import { Sticker } from "./Sticker"; import { StickerMessage } from "./StickerMessage"; /** - * A sticker message as sent by Signal + * A sticker message sent in a {@link DM} */ export declare class DMStickerMessage extends DMMessage implements StickerMessage { + /** + * Sticker that was sent + */ sticker: Sticker; + /** + * @param user - The author of the message + * @param data - Data associated with the sticker + * @param time - The timestamp the message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, client: Client); } diff --git a/dist/classes/DMStickerMessage.js b/dist/classes/DMStickerMessage.js index d1bf083..c5c757e 100644 --- a/dist/classes/DMStickerMessage.js +++ b/dist/classes/DMStickerMessage.js @@ -6,9 +6,16 @@ const DM_1 = require("./DM"); const Sticker_1 = require("./Sticker"); const StickerSource_1 = require("../enums/StickerSource"); /** - * A sticker message as sent by Signal + * A sticker message sent in a {@link DM} */ class DMStickerMessage extends DMMessage_1.DMMessage { + /** + * @param user - The author of the message + * @param data - Data associated with the sticker + * @param time - The timestamp the message was sent at + * @param client + * @internal + */ constructor(user, data, time, client) { super(user, time, new DM_1.DM(user.uuid, user.number, client), client, data.expiresInSeconds); this.sticker = new Sticker_1.Sticker(StickerSource_1.StickerSource.Received, data.sticker, client); diff --git a/dist/classes/DMStickerMessage.js.map b/dist/classes/DMStickerMessage.js.map index 9bfd8a1..2782140 100644 --- a/dist/classes/DMStickerMessage.js.map +++ b/dist/classes/DMStickerMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"DMStickerMessage.js","sourceRoot":"","sources":["../../classes/DMStickerMessage.ts"],"names":[],"mappings":";;;AACA,2CAAsC;AACtC,6BAAwB;AAExB,uCAAkC;AAElC,0DAAqD;AAErD;;GAEG;AACH,MAAa,gBAAiB,SAAQ,qBAAS;IAG3C,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,MAAc;QAC3D,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,OAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzF,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,6BAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7E,CAAC;CACJ;AAPD,4CAOC"} \ No newline at end of file +{"version":3,"file":"DMStickerMessage.js","sourceRoot":"","sources":["../../classes/DMStickerMessage.ts"],"names":[],"mappings":";;;AACA,2CAAsC;AACtC,6BAAwB;AAExB,uCAAkC;AAClC,0DAAqD;AAGrD;;GAEG;AACH,MAAa,gBAAiB,SAAQ,qBAAS;IAM3C;;;;;;OAMG;IACH,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,MAAc;QAC3D,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,OAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzF,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,6BAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7E,CAAC;CACJ;AAjBD,4CAiBC"} \ No newline at end of file diff --git a/dist/classes/DMTypingMessage.d.ts b/dist/classes/DMTypingMessage.d.ts index cce0ddd..be9749b 100644 --- a/dist/classes/DMTypingMessage.d.ts +++ b/dist/classes/DMTypingMessage.d.ts @@ -3,9 +3,19 @@ import { DMMessage } from "./DMMessage"; import { Client } from "./Client"; import { TypingMessageAction } from "../enums/TypingMessageAction"; /** - * A typing message as sent by Signal + * A typing message sent in a {@link DM} */ export declare class DMTypingMessage extends DMMessage { + /** + * Action associated with the typing message + */ action: TypingMessageAction; + /** + * @param user - The author of the message + * @param action - The action associated with the typing message + * @param time - The timestamp the message was sent at + * @param client + * @internal + */ constructor(user: User, action: TypingMessageAction, time: number, client: Client); } diff --git a/dist/classes/DMTypingMessage.js b/dist/classes/DMTypingMessage.js index f715fa5..153ce13 100644 --- a/dist/classes/DMTypingMessage.js +++ b/dist/classes/DMTypingMessage.js @@ -4,9 +4,16 @@ exports.DMTypingMessage = void 0; const DMMessage_1 = require("./DMMessage"); const DM_1 = require("./DM"); /** - * A typing message as sent by Signal + * A typing message sent in a {@link DM} */ class DMTypingMessage extends DMMessage_1.DMMessage { + /** + * @param user - The author of the message + * @param action - The action associated with the typing message + * @param time - The timestamp the message was sent at + * @param client + * @internal + */ constructor(user, action, time, client) { super(user, time, new DM_1.DM(user.uuid, user.number, client), client); this.action = action; diff --git a/dist/classes/DMTypingMessage.js.map b/dist/classes/DMTypingMessage.js.map index fbad35e..a478fb3 100644 --- a/dist/classes/DMTypingMessage.js.map +++ b/dist/classes/DMTypingMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"DMTypingMessage.js","sourceRoot":"","sources":["../../classes/DMTypingMessage.ts"],"names":[],"mappings":";;;AAIA,2CAAsC;AACtC,6BAAwB;AAIxB;;GAEG;AACH,MAAa,eAAgB,SAAQ,qBAAS;IAG1C,YAAY,IAAU,EAAE,MAA2B,EAAE,IAAY,EAAE,MAAc;QAC7E,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,OAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;QAClE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AAPD,0CAOC"} \ No newline at end of file +{"version":3,"file":"DMTypingMessage.js","sourceRoot":"","sources":["../../classes/DMTypingMessage.ts"],"names":[],"mappings":";;;AAIA,2CAAsC;AACtC,6BAAwB;AAIxB;;GAEG;AACH,MAAa,eAAgB,SAAQ,qBAAS;IAM1C;;;;;;OAMG;IACH,YAAY,IAAU,EAAE,MAA2B,EAAE,IAAY,EAAE,MAAc;QAC7E,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,OAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;QAClE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AAjBD,0CAiBC"} \ No newline at end of file diff --git a/dist/classes/DataMessage.d.ts b/dist/classes/DataMessage.d.ts index 8851714..7115b07 100644 --- a/dist/classes/DataMessage.d.ts +++ b/dist/classes/DataMessage.d.ts @@ -3,11 +3,33 @@ import { QuoteMessage } from "./QuoteMessage"; import { MessageFormatting } from "./MessageFormatting"; import { UserMention } from "./UserMention"; import { IReceivedMessageURLPreview } from "../types/IReceivedMessageURLPreview"; +/** + * A data (text) message sent on Signal + * @internal + */ export declare class DataMessage { + /** + * Message text + */ content?: string; + /** + * {@link Attachment}s associated with the message + */ attachments: Attachment[]; + /** + * Mentions in the message + */ mentions: UserMention[]; + /** + * URL previews present in the message + */ previews: IReceivedMessageURLPreview[]; + /** + * Formatting rules collection for this message + */ formatting: MessageFormatting; + /** + * Quoted message, if applicable + */ quote?: QuoteMessage; } diff --git a/dist/classes/DataMessage.js b/dist/classes/DataMessage.js index 4977839..7c1f0fa 100644 --- a/dist/classes/DataMessage.js +++ b/dist/classes/DataMessage.js @@ -1,10 +1,23 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DataMessage = void 0; +/** + * A data (text) message sent on Signal + * @internal + */ class DataMessage { constructor() { + /** + * {@link Attachment}s associated with the message + */ this.attachments = []; + /** + * Mentions in the message + */ this.mentions = []; + /** + * URL previews present in the message + */ this.previews = []; } } diff --git a/dist/classes/DataMessage.js.map b/dist/classes/DataMessage.js.map index c4583ae..4f36423 100644 --- a/dist/classes/DataMessage.js.map +++ b/dist/classes/DataMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"DataMessage.js","sourceRoot":"","sources":["../../classes/DataMessage.ts"],"names":[],"mappings":";;;AAOA,MAAa,WAAW;IAAxB;QAEW,gBAAW,GAAiB,EAAE,CAAC;QAC/B,aAAQ,GAAkB,EAAE,CAAC;QAC7B,aAAQ,GAAiC,EAAE,CAAC;IAGvD,CAAC;CAAA;AAPD,kCAOC"} \ No newline at end of file +{"version":3,"file":"DataMessage.js","sourceRoot":"","sources":["../../classes/DataMessage.ts"],"names":[],"mappings":";;;AAOA;;;GAGG;AACH,MAAa,WAAW;IAAxB;QAMI;;WAEG;QACI,gBAAW,GAAiB,EAAE,CAAC;QAEtC;;WAEG;QACI,aAAQ,GAAkB,EAAE,CAAC;QAEpC;;WAEG;QACI,aAAQ,GAAiC,EAAE,CAAC;IAWvD,CAAC;CAAA;AA9BD,kCA8BC"} \ No newline at end of file diff --git a/dist/classes/DeleteMessage.d.ts b/dist/classes/DeleteMessage.d.ts index 8ae14fa..1110ed6 100644 --- a/dist/classes/DeleteMessage.d.ts +++ b/dist/classes/DeleteMessage.d.ts @@ -1,4 +1,14 @@ +/** + * A deletion message sent on Signal + * @internal + */ export declare class DeleteMessage { + /** + * {@link Date} at which the original message was created + */ originalCreatedAt: Date; + /** + * Timestamp at which the original message was created + */ originalCreatedTimestamp: number; } diff --git a/dist/classes/DeleteMessage.js b/dist/classes/DeleteMessage.js index 9c22a98..735f156 100644 --- a/dist/classes/DeleteMessage.js +++ b/dist/classes/DeleteMessage.js @@ -1,6 +1,10 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DeleteMessage = void 0; +/** + * A deletion message sent on Signal + * @internal + */ class DeleteMessage { } exports.DeleteMessage = DeleteMessage; diff --git a/dist/classes/DeleteMessage.js.map b/dist/classes/DeleteMessage.js.map index f859e24..b1d8a6c 100644 --- a/dist/classes/DeleteMessage.js.map +++ b/dist/classes/DeleteMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"DeleteMessage.js","sourceRoot":"","sources":["../../classes/DeleteMessage.ts"],"names":[],"mappings":";;;AAMA,MAAa,aAAa;CAGzB;AAHD,sCAGC"} \ No newline at end of file +{"version":3,"file":"DeleteMessage.js","sourceRoot":"","sources":["../../classes/DeleteMessage.ts"],"names":[],"mappings":";;;AAMA;;;GAGG;AACH,MAAa,aAAa;CAUzB;AAVD,sCAUC"} \ No newline at end of file diff --git a/dist/classes/EditMessage.d.ts b/dist/classes/EditMessage.d.ts index bf2bd9a..872eef8 100644 --- a/dist/classes/EditMessage.d.ts +++ b/dist/classes/EditMessage.d.ts @@ -1,5 +1,15 @@ import { DataMessage } from "./DataMessage"; +/** + * A message editing an older message + * @internal + */ export declare class EditMessage extends DataMessage { + /** + * {@link Date} at which the original message was created + */ originalCreatedAt: Date; + /** + * Timestamp at which the original message was created + */ originalCreatedTimestamp: number; } diff --git a/dist/classes/EditMessage.js b/dist/classes/EditMessage.js index 54bc389..6408c4a 100644 --- a/dist/classes/EditMessage.js +++ b/dist/classes/EditMessage.js @@ -2,6 +2,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.EditMessage = void 0; const DataMessage_1 = require("./DataMessage"); +/** + * A message editing an older message + * @internal + */ class EditMessage extends DataMessage_1.DataMessage { } exports.EditMessage = EditMessage; diff --git a/dist/classes/EditMessage.js.map b/dist/classes/EditMessage.js.map index 66c122d..26de0d0 100644 --- a/dist/classes/EditMessage.js.map +++ b/dist/classes/EditMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"EditMessage.js","sourceRoot":"","sources":["../../classes/EditMessage.ts"],"names":[],"mappings":";;;AAGA,+CAA0C;AAE1C,MAAa,WAAY,SAAQ,yBAAW;CAG3C;AAHD,kCAGC"} \ No newline at end of file +{"version":3,"file":"EditMessage.js","sourceRoot":"","sources":["../../classes/EditMessage.ts"],"names":[],"mappings":";;;AAGA,+CAA0C;AAE1C;;;GAGG;AACH,MAAa,WAAY,SAAQ,yBAAW;CAU3C;AAVD,kCAUC"} \ No newline at end of file diff --git a/dist/classes/Emoji.d.ts b/dist/classes/Emoji.d.ts index a09baf3..560d1cd 100644 --- a/dist/classes/Emoji.d.ts +++ b/dist/classes/Emoji.d.ts @@ -1,3 +1,6 @@ +/** + * An emoji sent on Signal + */ export declare class Emoji extends String { constructor(props: any); } diff --git a/dist/classes/Emoji.js b/dist/classes/Emoji.js index 9f4aad6..6420279 100644 --- a/dist/classes/Emoji.js +++ b/dist/classes/Emoji.js @@ -1,6 +1,9 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Emoji = void 0; +/** + * An emoji sent on Signal + */ class Emoji extends String { constructor(props) { super(props); diff --git a/dist/classes/Emoji.js.map b/dist/classes/Emoji.js.map index 34062d4..e83408e 100644 --- a/dist/classes/Emoji.js.map +++ b/dist/classes/Emoji.js.map @@ -1 +1 @@ -{"version":3,"file":"Emoji.js","sourceRoot":"","sources":["../../classes/Emoji.ts"],"names":[],"mappings":";;;AAAA,MAAa,KAAM,SAAQ,MAAM;IAC7B,YAAY,KAAK;QACb,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;CACJ;AAJD,sBAIC"} \ No newline at end of file +{"version":3,"file":"Emoji.js","sourceRoot":"","sources":["../../classes/Emoji.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,KAAM,SAAQ,MAAM;IAC7B,YAAY,KAAK;QACb,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;CACJ;AAJD,sBAIC"} \ No newline at end of file diff --git a/dist/classes/Group.d.ts b/dist/classes/Group.d.ts index f415d09..db44e59 100644 --- a/dist/classes/Group.d.ts +++ b/dist/classes/Group.d.ts @@ -5,21 +5,83 @@ import { SentDataMessage } from "./SentDataMessage"; import { Sticker } from "./Sticker"; import { GroupEditor } from "./GroupEditor"; import { User } from "./User"; +/** + * A Signal group + */ export declare class Group extends Channel { + /** + * Whether the channel is a group chat + */ group: boolean; - id: string; private client; + /** + * @param groupId - The ID of the group + * @param client + * @internal + */ constructor(groupId: string, client: Client); + /** + * Send a message to the channel + * @param text - The text of the message, or an empty string + * @param options - The optional options used to build the message + */ send(text: string, options?: IChatMessageOptions): Promise; + /** + * Set the client's typing status for this channel + * @param typing - Whether the client should be typing or not + */ setTyping(typing: boolean): Promise; + /** + * Send a sticker to this channel + * @param sticker - The sticker to send + */ sendSticker(sticker: Sticker): Promise; + /** + * Block or unblock the group + * @param blocked - Whether the group should be blocked or not + */ setBlocked(blocked: boolean): Promise; + /** + * Edit the group's information + */ editor(): Promise; + /** + * Add one or more admins to the group + * @param users - The admin(s) to add + */ addAdmin(...users: User[]): Promise; + /** + * Remove one or more admins + * @param users - The admin(s) to remove + */ removeAdmin(...users: User[]): Promise; + /** + * Add one or more members to the group + * @param users - The member(s) to add + */ addMember(...users: User[]): Promise; + /** + * Remove (kick) one or more members from the group + * @param users - The member(s) to remove + */ removeMember(...users: User[]): Promise; + /** + * Permanently ban one or more members from the group + * @param users - The member(s) to ban + */ banMember(...users: User[]): Promise; + /** + * Unban one or more permanently banned members from the group + * @param users - The member(s) to unban + */ unbanMember(...users: User[]): Promise; + /** + * Leave the group + * + * If the client is an administrator of the group, `successorAdmins` has to be set + * @param deleteLocalData - Whether local client data about the group should be deleted + * @param successorAdmins - One or more member(s) to make group admins after the client + * leaves the group, in case this client is the only admin + */ leave(deleteLocalData?: boolean, successorAdmins?: User[]): Promise; } diff --git a/dist/classes/Group.js b/dist/classes/Group.js index af68954..3f7fad9 100644 --- a/dist/classes/Group.js +++ b/dist/classes/Group.js @@ -5,13 +5,29 @@ const Channel_1 = require("./Channel"); const CLIDispatcher_1 = require("./CLIDispatcher"); const SentDataMessage_1 = require("./SentDataMessage"); const GroupEditor_1 = require("./GroupEditor"); +/** + * A Signal group + */ class Group extends Channel_1.Channel { + /** + * @param groupId - The ID of the group + * @param client + * @internal + */ constructor(groupId, client) { super(); + /** + * Whether the channel is a group chat + */ this.group = true; this.id = groupId; this.client = client; } + /** + * Send a message to the channel + * @param text - The text of the message, or an empty string + * @param options - The optional options used to build the message + */ async send(text, options) { let groupData = await CLIDispatcher_1.CLIDispatcher.dispatch("listGroups", {}, this.client.process); let data = await CLIDispatcher_1.CLIDispatcher.dispatch("send", { @@ -33,6 +49,10 @@ class Group extends Channel_1.Channel { let timestamp = data.result?.timestamp; return new SentDataMessage_1.SentDataMessage(timestamp, this, this.client, text, options); } + /** + * Set the client's typing status for this channel + * @param typing - Whether the client should be typing or not + */ async setTyping(typing) { let groupData = await CLIDispatcher_1.CLIDispatcher.dispatch("listGroups", {}, this.client.process); await CLIDispatcher_1.CLIDispatcher.dispatch("sendTyping", { @@ -41,6 +61,10 @@ class Group extends Channel_1.Channel { stop: !typing }, this.client.process); } + /** + * Send a sticker to this channel + * @param sticker - The sticker to send + */ async sendSticker(sticker) { let groupData = await CLIDispatcher_1.CLIDispatcher.dispatch("listGroups", {}, this.client.process); await CLIDispatcher_1.CLIDispatcher.dispatch("send", { @@ -49,6 +73,10 @@ class Group extends Channel_1.Channel { sticker: sticker.pack.id + ":" + sticker.id }, this.client.process); } + /** + * Block or unblock the group + * @param blocked - Whether the group should be blocked or not + */ async setBlocked(blocked) { let groupData = await CLIDispatcher_1.CLIDispatcher.dispatch("listGroups", {}, this.client.process); if (blocked) { @@ -64,45 +92,80 @@ class Group extends Channel_1.Channel { }, this.client.process); } } + /** + * Edit the group's information + */ async editor() { return new GroupEditor_1.GroupEditor(this, await CLIDispatcher_1.CLIDispatcher.dispatch("listGroups", {}, this.client.process), this.client); } + /** + * Add one or more admins to the group + * @param users - The admin(s) to add + */ async addAdmin(...users) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateGroup", { groupId: this.id, admin: users.map(i => i.number) }, this.client.process); } + /** + * Remove one or more admins + * @param users - The admin(s) to remove + */ async removeAdmin(...users) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateGroup", { groupId: this.id, removeAdmin: users.map(i => i.number) }, this.client.process); } + /** + * Add one or more members to the group + * @param users - The member(s) to add + */ async addMember(...users) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateGroup", { groupId: this.id, member: users.map(i => i.number) }, this.client.process); } + /** + * Remove (kick) one or more members from the group + * @param users - The member(s) to remove + */ async removeMember(...users) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateGroup", { groupId: this.id, removeMember: users.map(i => i.number) }, this.client.process); } + /** + * Permanently ban one or more members from the group + * @param users - The member(s) to ban + */ async banMember(...users) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateGroup", { groupId: this.id, ban: users.map(i => i.number) }, this.client.process); } + /** + * Unban one or more permanently banned members from the group + * @param users - The member(s) to unban + */ async unbanMember(...users) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateGroup", { groupId: this.id, unban: users.map(i => i.number) }, this.client.process); } + /** + * Leave the group + * + * If the client is an administrator of the group, `successorAdmins` has to be set + * @param deleteLocalData - Whether local client data about the group should be deleted + * @param successorAdmins - One or more member(s) to make group admins after the client + * leaves the group, in case this client is the only admin + */ async leave(deleteLocalData = false, successorAdmins) { await CLIDispatcher_1.CLIDispatcher.dispatch("quitGroup", { groupId: this.id, diff --git a/dist/classes/Group.js.map b/dist/classes/Group.js.map index f82cead..5e07a50 100644 --- a/dist/classes/Group.js.map +++ b/dist/classes/Group.js.map @@ -1 +1 @@ -{"version":3,"file":"Group.js","sourceRoot":"","sources":["../../classes/Group.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAElC,mDAA8C;AAE9C,uDAAkD;AAElD,+CAA0C;AAG1C,MAAa,KAAM,SAAQ,iBAAO;IAK9B,YAAY,OAAe,EAAE,MAAc;QACvC,KAAK,EAAE,CAAC;QALL,UAAK,GAAY,IAAI,CAAC;QAMzB,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,OAA6B;QACzD,IAAI,SAAS,GAAG,MAAM,6BAAa,CAAC,QAAQ,CACxC,YAAY,EACZ,EAAE,EACF,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;QAEF,IAAI,IAAI,GAAG,MAAM,6BAAa,CAAC,QAAQ,CACnC,MAAM,EACN;YACI,OAAO,EAAE,IAAI,CAAC,EAAE;YAChB,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;YAC1F,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC,CAA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AChC,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;IACN,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,WAAW,CAAC,GAAG,KAAa;QACrC,MAAM,6BAAa,CAAC,QAAQ,CACxB,aAAa,EACb;YACI,OAAO,EAAE,IAAI,CAAC,EAAE;YAChB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;SAClC,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;IACN,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,KAAK,CAAC,kBAA2B,KAAK,EAAE,eAAwB;QACzE,MAAM,6BAAa,CAAC,QAAQ,CACxB,WAAW,EACX;YACI,OAAO,EAAE,IAAI,CAAC,EAAE;YAChB,KAAK,EAAE,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;YAC1C,MAAM,EAAE,eAAe;SAC1B,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;IACN,CAAC;CACJ;AA3PD,sBA2PC"} \ No newline at end of file diff --git a/dist/classes/GroupDataMessage.d.ts b/dist/classes/GroupDataMessage.d.ts index 29cdccb..b664751 100644 --- a/dist/classes/GroupDataMessage.d.ts +++ b/dist/classes/GroupDataMessage.d.ts @@ -9,17 +9,58 @@ import { IReceivedMessageURLPreview } from "../types/IReceivedMessageURLPreview" import { IChatMessageOptions } from "../types/IChatMessageOptions"; import { SentDataMessage } from "./SentDataMessage"; /** - * A data message as sent by Signal + * A data (text) message sent in a {@link Group} */ export declare class GroupDataMessage extends GroupMessage implements DataMessage { + /** + * Message text + */ content?: string; + /** + * Attachments associated with the message + */ attachments: Attachment[]; + /** + * Mentions in the message + */ mentions: UserMention[]; + /** + * URL previews present in the message + */ previews: IReceivedMessageURLPreview[]; + /** + * Formatting rules collection for this message + */ formatting: MessageFormatting; + /** + * Quoted message, if applicable + */ quote?: QuoteMessage; + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param client + * @internal + */ constructor(user: User, data: any, time: number, groupId: string, client: any); + /** + * Mark the message as read + */ markAsRead(): Promise; + /** + * Mark the message as viewed + */ markAsViewed(): Promise; + /** + * Reply to (quote) the message + * @param text - The text of the reply + * @param options - The options used to build the reply message + */ reply(text: string, options?: IChatMessageOptions): Promise; + /** + * Delete the message + */ + delete(): Promise; } diff --git a/dist/classes/GroupDataMessage.js b/dist/classes/GroupDataMessage.js index b488883..8b7c160 100644 --- a/dist/classes/GroupDataMessage.js +++ b/dist/classes/GroupDataMessage.js @@ -14,13 +14,30 @@ const UserDataType_1 = require("../enums/UserDataType"); const ReceivedURLPreview_1 = require("./ReceivedURLPreview"); const QuoteBuilder_1 = require("./QuoteBuilder"); /** - * A data message as sent by Signal + * A data (text) message sent in a {@link Group} */ class GroupDataMessage extends GroupMessage_1.GroupMessage { + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param client + * @internal + */ constructor(user, data, time, groupId, client) { super(user, time, new Group_1.Group(groupId, client), client, data.expiresInSeconds); + /** + * Attachments associated with the message + */ this.attachments = []; + /** + * Mentions in the message + */ this.mentions = []; + /** + * URL previews present in the message + */ this.previews = []; this.client = client; this.content = data.message && data.message.trim().length > 0 ? data.message : null; @@ -31,6 +48,9 @@ class GroupDataMessage extends GroupMessage_1.GroupMessage { this.mentions = data.mentions?.map(mention => new UserMention_1.UserMention(new User_1.User(mention, UserDataType_1.UserDataType.MentionOrGroup, client), mention.start, mention.length)); this.previews = data.previews?.map(preview => (new ReceivedURLPreview_1.ReceivedURLPreview(preview)).build()); } + /** + * Mark the message as read + */ async markAsRead() { await CLIDispatcher_1.CLIDispatcher.dispatch("sendReceipt", { recipient: this.author.number, @@ -38,6 +58,9 @@ class GroupDataMessage extends GroupMessage_1.GroupMessage { type: MessageReceipt_1.MessageReceipt.Read }, this.client.process); } + /** + * Mark the message as viewed + */ async markAsViewed() { await CLIDispatcher_1.CLIDispatcher.dispatch("sendReceipt", { recipient: this.author.number, @@ -45,6 +68,11 @@ class GroupDataMessage extends GroupMessage_1.GroupMessage { type: MessageReceipt_1.MessageReceipt.Viewed }, this.client.process); } + /** + * Reply to (quote) the message + * @param text - The text of the reply + * @param options - The options used to build the reply message + */ async reply(text, options) { if (options) { options.quote = new QuoteBuilder_1.QuoteBuilder(this.client, this.createdTimestamp, this.author.number, this.content); @@ -56,6 +84,17 @@ class GroupDataMessage extends GroupMessage_1.GroupMessage { } return await this.channel.send(text, options); } + /** + * Delete the message + */ + async delete() { + let groupData = await CLIDispatcher_1.CLIDispatcher.dispatch("listGroups", {}, this.client.process); + await CLIDispatcher_1.CLIDispatcher.dispatch("remoteDelete", { + groupId: this.channel.id, + recipient: groupData['result'].filter(i => i.id === this.channel.id)[0].members.map(i => i.number), + targetTimestamp: this.createdTimestamp + }, this.client.process); + } } exports.GroupDataMessage = GroupDataMessage; //# sourceMappingURL=GroupDataMessage.js.map \ No newline at end of file diff --git a/dist/classes/GroupDataMessage.js.map b/dist/classes/GroupDataMessage.js.map index bf5513e..c68c1d7 100644 --- a/dist/classes/GroupDataMessage.js.map +++ b/dist/classes/GroupDataMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"GroupDataMessage.js","sourceRoot":"","sources":["../../classes/GroupDataMessage.ts"],"names":[],"mappings":";;;AAAA,iCAA4B;AAE5B,iDAA4C;AAC5C,mCAA8B;AAG9B,6CAAwC;AACxC,iDAA4C;AAC5C,mDAA8C;AAC9C,4DAAuD;AACvD,2DAAsD;AAEtD,+CAA0C;AAC1C,wDAAmD;AAEnD,6DAAwD;AAIxD,iDAA4C;AAE5C;;GAEG;AACH,MAAa,gBAAiB,SAAQ,2BAAY;IAQ9C,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,OAAe,EAAE,MAAM;QACpE,KAAK,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,2BAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;SAC1G;aAAM;YACH,OAAO,GAAG;gBACN,KAAK,EAAE,IAAI,2BAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;aAChG,CAAA;SACJ;QAED,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,MAAM;QACf,IAAI,SAAS,GAAG,MAAM,6BAAa,CAAC,QAAQ,CACxC,YAAY,EACZ,EAAE,EACF,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;QAEF,MAAM,6BAAa,CAAC,QAAQ,CACxB,cAAc,EACd;YACI,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE;YACxB,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;YAClG,eAAe,EAAE,IAAI,CAAC,gBAAgB;SACzC,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;IACN,CAAC;CACJ;AArHD,4CAqHC"} \ No newline at end of file diff --git a/dist/classes/GroupDeleteMessage.d.ts b/dist/classes/GroupDeleteMessage.d.ts index c91dad1..5df5187 100644 --- a/dist/classes/GroupDeleteMessage.d.ts +++ b/dist/classes/GroupDeleteMessage.d.ts @@ -3,10 +3,25 @@ import { Client } from "./Client"; import { DeleteMessage } from "./DeleteMessage"; import { GroupMessage } from "./GroupMessage"; /** - * A deletion message as sent by Signal + * A deletion message sent in a {@link Group} */ export declare class GroupDeleteMessage extends GroupMessage implements DeleteMessage { + /** + * {@link Date} at which the original message was created + */ originalCreatedAt: Date; + /** + * Timestamp at which the original message was created + */ originalCreatedTimestamp: number; + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param originalTime - The timestamp the original message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, groupId: string, client: Client, originalTime: number); } diff --git a/dist/classes/GroupDeleteMessage.js b/dist/classes/GroupDeleteMessage.js index ab1248e..cd1854b 100644 --- a/dist/classes/GroupDeleteMessage.js +++ b/dist/classes/GroupDeleteMessage.js @@ -4,9 +4,18 @@ exports.GroupDeleteMessage = void 0; const GroupMessage_1 = require("./GroupMessage"); const Group_1 = require("./Group"); /** - * A deletion message as sent by Signal + * A deletion message sent in a {@link Group} */ class GroupDeleteMessage extends GroupMessage_1.GroupMessage { + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param originalTime - The timestamp the original message was sent at + * @param client + * @internal + */ constructor(user, data, time, groupId, client, originalTime) { super(user, time, new Group_1.Group(groupId, client), client, data.expiresInSeconds); this.originalCreatedAt = new Date(originalTime); diff --git a/dist/classes/GroupDeleteMessage.js.map b/dist/classes/GroupDeleteMessage.js.map index 452598e..0b0c98d 100644 --- a/dist/classes/GroupDeleteMessage.js.map +++ b/dist/classes/GroupDeleteMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"GroupDeleteMessage.js","sourceRoot":"","sources":["../../classes/GroupDeleteMessage.ts"],"names":[],"mappings":";;;AAQA,iDAA4C;AAC5C,mCAA8B;AAE9B;;GAEG;AACH,MAAa,kBAAmB,SAAQ,2BAAY;IAIhD,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,OAAe,EAAE,MAAc,EAAE,YAAoB;QAClG,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,aAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7E,IAAI,CAAC,iBAAiB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,CAAC,wBAAwB,GAAG,YAAY,CAAC;IACjD,CAAC;CACJ;AATD,gDASC"} \ No newline at end of file +{"version":3,"file":"GroupDeleteMessage.js","sourceRoot":"","sources":["../../classes/GroupDeleteMessage.ts"],"names":[],"mappings":";;;AAOA,iDAA4C;AAC5C,mCAA8B;AAE9B;;GAEG;AACH,MAAa,kBAAmB,SAAQ,2BAAY;IAWhD;;;;;;;;OAQG;IACH,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,OAAe,EAAE,MAAc,EAAE,YAAoB;QAClG,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,aAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7E,IAAI,CAAC,iBAAiB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,CAAC,wBAAwB,GAAG,YAAY,CAAC;IACjD,CAAC;CACJ;AAzBD,gDAyBC"} \ No newline at end of file diff --git a/dist/classes/GroupEditMessage.d.ts b/dist/classes/GroupEditMessage.d.ts index 6e42851..45e66f3 100644 --- a/dist/classes/GroupEditMessage.d.ts +++ b/dist/classes/GroupEditMessage.d.ts @@ -3,10 +3,25 @@ import { Client } from "./Client"; import { EditMessage } from "./EditMessage"; import { GroupDataMessage } from "./GroupDataMessage"; /** - * An edit message as sent by Signal + * An edit message sent in a {@link Group} */ export declare class GroupEditMessage extends GroupDataMessage implements EditMessage { + /** + * {@link Date} at which the original message was created + */ originalCreatedAt: Date; + /** + * Timestamp at which the original message was created + */ originalCreatedTimestamp: number; + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param originalTime - The timestamp the original message was sent at + * @param client + * @internal + */ constructor(user: User, data: any, time: number, groupId: string, originalTime: number, client: Client); } diff --git a/dist/classes/GroupEditMessage.js b/dist/classes/GroupEditMessage.js index 71ed0e7..d1e1136 100644 --- a/dist/classes/GroupEditMessage.js +++ b/dist/classes/GroupEditMessage.js @@ -3,9 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.GroupEditMessage = void 0; const GroupDataMessage_1 = require("./GroupDataMessage"); /** - * An edit message as sent by Signal + * An edit message sent in a {@link Group} */ class GroupEditMessage extends GroupDataMessage_1.GroupDataMessage { + /** + * @param user - The author of the message + * @param data - Data associated with the message + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param originalTime - The timestamp the original message was sent at + * @param client + * @internal + */ constructor(user, data, time, groupId, originalTime, client) { super(user, data, time, groupId, client); this.originalCreatedAt = new Date(originalTime); diff --git a/dist/classes/GroupEditMessage.js.map b/dist/classes/GroupEditMessage.js.map index a5f15ce..ce5e0e3 100644 --- a/dist/classes/GroupEditMessage.js.map +++ b/dist/classes/GroupEditMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"GroupEditMessage.js","sourceRoot":"","sources":["../../classes/GroupEditMessage.ts"],"names":[],"mappings":";;;AAaA,yDAAoD;AAEpD;;GAEG;AACH,MAAa,gBAAiB,SAAQ,mCAAgB;IAIlD,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,OAAe,EAAE,YAAoB,EAAE,MAAc;QAClG,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,iBAAiB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,CAAC,wBAAwB,GAAG,YAAY,CAAC;IACjD,CAAC;CACJ;AATD,4CASC"} \ No newline at end of file +{"version":3,"file":"GroupEditMessage.js","sourceRoot":"","sources":["../../classes/GroupEditMessage.ts"],"names":[],"mappings":";;;AAYA,yDAAoD;AAEpD;;GAEG;AACH,MAAa,gBAAiB,SAAQ,mCAAgB;IAWlD;;;;;;;;OAQG;IACH,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,OAAe,EAAE,YAAoB,EAAE,MAAc;QAClG,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,iBAAiB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,CAAC,wBAAwB,GAAG,YAAY,CAAC;IACjD,CAAC;CACJ;AAzBD,4CAyBC"} \ No newline at end of file diff --git a/dist/classes/GroupEditor.d.ts b/dist/classes/GroupEditor.d.ts index 985d804..860b1ce 100644 --- a/dist/classes/GroupEditor.d.ts +++ b/dist/classes/GroupEditor.d.ts @@ -4,27 +4,102 @@ import { GroupPermissions } from "./GroupPermissions"; import { Client } from "./Client"; import { AttachmentBuilder } from "./AttachmentBuilder"; import { GroupLinkStatus } from "../enums/GroupLinkStatus"; +/** + * A collector and editor of information related to the group + */ export declare class GroupEditor { + /** + * {@link Group} being worked on + */ initiator: Group; + /** + * ID of the group + */ id: string; + /** + * Name of the group + */ name: string; + /** + * Optional description for the group + */ description?: string; + /** + * Whether this client is a member of the group or not + */ isMember: boolean; + /** + * Whether this client has blocked the group or not + */ isBlocked: boolean; + /** + * If disappearing messages are enabled, amount of seconds before a message disappears + */ expirationSeconds: number; + /** + * List of members in the group + */ members: User[]; + /** + * List of members pending acceptance + */ pendingMembers: User[]; + /** + * List of members pending admin approval + */ requestingMembers: User[]; + /** + * List of admins + */ admins: User[]; + /** + * List of members banned from the group + */ bannedMembers: User[]; + /** + * Permission information + */ permissions: GroupPermissions; + /** + * If enabled, link to the group + */ inviteLink?: string; private client; + /** + * @param initiator - The group being worked on + * @param data - Data from signal-cli + * @param client + * @internal + */ constructor(initiator: Group, data: any, client: Client); + /** + * Update the name of the group + * @param name - The new group name + */ setName(name: string): Promise; + /** + * Update the description of the group + * @param description - The new group description + */ setDescription(description: string): Promise; + /** + * Update the avatar of the group + * @param avatar - The new group avatar + */ setAvatar(avatar: AttachmentBuilder): Promise; + /** + * Update the disappearing messages setting for the group + * @param seconds - The time (in seconds) before a message gets deleted. + * Use 0 to disable disappearing messages + */ setExpirationSeconds(seconds: number): Promise; + /** + * Reset the group invite link and create a new one + */ resetInviteLink(): Promise; + /** + * Change the status of the group invite link + * @param status - The new group invite link status + */ setLinkStatus(status: GroupLinkStatus): Promise; } diff --git a/dist/classes/GroupEditor.js b/dist/classes/GroupEditor.js index 534dc09..aeaa274 100644 --- a/dist/classes/GroupEditor.js +++ b/dist/classes/GroupEditor.js @@ -5,7 +5,16 @@ const User_1 = require("./User"); const GroupPermissions_1 = require("./GroupPermissions"); const UserDataType_1 = require("../enums/UserDataType"); const CLIDispatcher_1 = require("./CLIDispatcher"); +/** + * A collector and editor of information related to the group + */ class GroupEditor { + /** + * @param initiator - The group being worked on + * @param data - Data from signal-cli + * @param client + * @internal + */ constructor(initiator, data, client) { this.initiator = initiator; this.client = client; @@ -24,6 +33,10 @@ class GroupEditor { this.permissions = new GroupPermissions_1.GroupPermissions(group, this, client); this.inviteLink = group.groupInviteLink ?? null; } + /** + * Update the name of the group + * @param name - The new group name + */ async setName(name) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateGroup", { groupId: this.id, @@ -31,6 +44,10 @@ class GroupEditor { }, this.client.process); this.name = name; } + /** + * Update the description of the group + * @param description - The new group description + */ async setDescription(description) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateGroup", { groupId: this.id, @@ -38,12 +55,21 @@ class GroupEditor { }, this.client.process); this.description = description; } + /** + * Update the avatar of the group + * @param avatar - The new group avatar + */ async setAvatar(avatar) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateGroup", { groupId: this.id, avatar: avatar.uri }, this.client.process); } + /** + * Update the disappearing messages setting for the group + * @param seconds - The time (in seconds) before a message gets deleted. + * Use 0 to disable disappearing messages + */ async setExpirationSeconds(seconds) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateGroup", { groupId: this.id, @@ -51,12 +77,19 @@ class GroupEditor { }, this.client.process); this.expirationSeconds = seconds; } + /** + * Reset the group invite link and create a new one + */ async resetInviteLink() { await CLIDispatcher_1.CLIDispatcher.dispatch("updateGroup", { groupId: this.id, resetLink: true }, this.client.process); } + /** + * Change the status of the group invite link + * @param status - The new group invite link status + */ async setLinkStatus(status) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateGroup", { groupId: this.id, diff --git a/dist/classes/GroupEditor.js.map b/dist/classes/GroupEditor.js.map index c327f9f..36a8175 100644 --- a/dist/classes/GroupEditor.js.map +++ b/dist/classes/GroupEditor.js.map @@ -1 +1 @@ -{"version":3,"file":"GroupEditor.js","sourceRoot":"","sources":["../../classes/GroupEditor.ts"],"names":[],"mappings":";;;AACA,iCAA4B;AAC5B,yDAAoD;AACpD,wDAAmD;AAEnD,mDAA8C;AAK9C,MAAa,WAAW;IAiBpB,YAAY,SAAgB,EAAE,IAAS,EAAE,MAAc;QACnD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtE,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,KAAK,CAA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AW;SAC3B,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,SAAS,CAAC,MAAyB;QAC5C,MAAM,6BAAa,CAAC,QAAQ,CACxB,aAAa,EACb;YACI,OAAO,EAAE,IAAI,CAAC,EAAE;YAChB,MAAM,EAAE,MAAM,CAAC,GAAG;SACrB,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;IACN,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,oBAAoB,CAAC,OAAe;QAC7C,MAAM,6BAAa,CAAC,QAAQ,CACxB,aAAa,EACb;YACI,OAAO,EAAE,IAAI,CAAC,EAAE;YAChB,UAAU,EAAE,OAAO;SACtB,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;QAEF,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,eAAe;QACxB,MAAM,6BAAa,CAAC,QAAQ,CACxB,aAAa,EACb;YACI,OAAO,EAAE,IAAI,CAAC,EAAE;YAChB,SAAS,EAAE,IAAI;SAClB,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;IACN,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,aAAa,CAAC,MAAuB;QAC9C,MAAM,6BAAa,CAAC,QAAQ,CACxB,aAAa,EACb;YACI,OAAO,EAAE,IAAI,CAAC,EAAE;YAChB,IAAI,EAAE,MAAM,KAAK,cAAc,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,MAAM;SACrE,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;IACN,CAAC;CACJ;AAlMD,kCAkMC"} \ No newline at end of file diff --git a/dist/classes/GroupMessage.d.ts b/dist/classes/GroupMessage.d.ts index f1e4027..09de0da 100644 --- a/dist/classes/GroupMessage.d.ts +++ b/dist/classes/GroupMessage.d.ts @@ -2,8 +2,25 @@ import { ReceivedMessage } from "./ReceivedMessage"; import { User } from "./User"; import { Group } from "./Group"; import { Client } from "./Client"; +/** + * A message sent in a {@link Group} + */ export declare class GroupMessage extends ReceivedMessage { + /** + * {@link Group} the message was sent to + */ channel: Group; + /** + * Whether the message was sent in a group channel or not + */ isGroup: boolean; + /** + * @param user - The author of the message + * @param time - The timestamp the message was sent at + * @param group - The group the message was sent in + * @param client + * @param expirity - The number of seconds remaining before the message disappears, if applicable + * @internal + */ constructor(user: User, time: number, group: Group, client: Client, expirity?: number); } diff --git a/dist/classes/GroupMessage.js b/dist/classes/GroupMessage.js index 142fd33..de860e3 100644 --- a/dist/classes/GroupMessage.js +++ b/dist/classes/GroupMessage.js @@ -2,9 +2,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.GroupMessage = void 0; const ReceivedMessage_1 = require("./ReceivedMessage"); +/** + * A message sent in a {@link Group} + */ class GroupMessage extends ReceivedMessage_1.ReceivedMessage { + /** + * @param user - The author of the message + * @param time - The timestamp the message was sent at + * @param group - The group the message was sent in + * @param client + * @param expirity - The number of seconds remaining before the message disappears, if applicable + * @internal + */ constructor(user, time, group, client, expirity) { super(user, time, group, client, expirity); + /** + * Whether the message was sent in a group channel or not + */ this.isGroup = true; } } diff --git a/dist/classes/GroupMessage.js.map b/dist/classes/GroupMessage.js.map index 1e4e0f9..364129f 100644 --- a/dist/classes/GroupMessage.js.map +++ b/dist/classes/GroupMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"GroupMessage.js","sourceRoot":"","sources":["../../classes/GroupMessage.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAKlD,MAAa,YAAa,SAAQ,iCAAe;IAI7C,YAAY,IAAU,EAAE,IAAY,EAAE,KAAY,EAAE,MAAc,EAAE,QAAiB;QACjF,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAHxC,YAAO,GAAY,IAAI,CAAC;IAI/B,CAAC;CACJ;AAPD,oCAOC"} \ No newline at end of file +{"version":3,"file":"GroupMessage.js","sourceRoot":"","sources":["../../classes/GroupMessage.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAKlD;;GAEG;AACH,MAAa,YAAa,SAAQ,iCAAe;IAW7C;;;;;;;OAOG;IACH,YAAY,IAAU,EAAE,IAAY,EAAE,KAAY,EAAE,MAAc,EAAE,QAAiB;QACjF,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAd/C;;WAEG;QACI,YAAO,GAAY,IAAI,CAAC;IAY/B,CAAC;CACJ;AAtBD,oCAsBC"} \ No newline at end of file diff --git a/dist/classes/GroupPermissions.d.ts b/dist/classes/GroupPermissions.d.ts index 3ac1a56..79aec78 100644 --- a/dist/classes/GroupPermissions.d.ts +++ b/dist/classes/GroupPermissions.d.ts @@ -2,12 +2,38 @@ import { GroupPermissionLevel } from "../enums/GroupPermissionLevel"; import { Client } from "./Client"; import { GroupPermissionName } from "../enums/GroupPermissionName"; import { GroupEditor } from "./GroupEditor"; +/** + * Permissions associated with a group + */ export declare class GroupPermissions { + /** + * Current permission level for the "Who can add members" permission + */ addMember: GroupPermissionLevel; + /** + * Current permission level for the "Who can edit group info" permission + */ editDetails: GroupPermissionLevel; + /** + * Current permission level for the "Who can send messages" permission + */ sendMessage: GroupPermissionLevel; + /** + * Originating {@link GroupEditor} + */ editor: GroupEditor; private client; + /** + * @param groupData - The data associated with this group + * @param editor - The originating GroupEditor + * @param client + * @internal + */ constructor(groupData: any, editor: GroupEditor, client: Client); + /** + * Change a permission's level + * @param permission - The permission name + * @param level - The permission level + */ change(permission: GroupPermissionName, level: GroupPermissionLevel): Promise; } diff --git a/dist/classes/GroupPermissions.js b/dist/classes/GroupPermissions.js index df342cd..51e9431 100644 --- a/dist/classes/GroupPermissions.js +++ b/dist/classes/GroupPermissions.js @@ -4,7 +4,16 @@ exports.GroupPermissions = void 0; const GroupPermissionLevel_1 = require("../enums/GroupPermissionLevel"); const GroupPermissionName_1 = require("../enums/GroupPermissionName"); const CLIDispatcher_1 = require("./CLIDispatcher"); +/** + * Permissions associated with a group + */ class GroupPermissions { + /** + * @param groupData - The data associated with this group + * @param editor - The originating GroupEditor + * @param client + * @internal + */ constructor(groupData, editor, client) { this.editor = editor; if (groupData.permissionAddMember === "ONLY_ADMINS") { @@ -26,6 +35,11 @@ class GroupPermissions { this.sendMessage = GroupPermissionLevel_1.GroupPermissionLevel.Everyone; } } + /** + * Change a permission's level + * @param permission - The permission name + * @param level - The permission level + */ async change(permission, level) { if (permission === GroupPermissionName_1.GroupPermissionName.AddMember) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateGroup", { diff --git a/dist/classes/GroupPermissions.js.map b/dist/classes/GroupPermissions.js.map index 2cc42d2..8f19222 100644 --- a/dist/classes/GroupPermissions.js.map +++ b/dist/classes/GroupPermissions.js.map @@ -1 +1 @@ -{"version":3,"file":"GroupPermissions.js","sourceRoot":"","sources":["../../classes/GroupPermissions.ts"],"names":[],"mappings":";;;AAAA,wEAAmE;AAEnE,sEAAiE;AACjE,mDAA8C;AAG9C,MAAa,gBAAgB;IAOzB,YAAY,SAAc,EAAE,MAAmB,EAAE,MAAc;QAC3D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,SAAS,CAAC,mBAAmB,KAAK,aAAa,EAAE;YACjD,IAAI,CAAC,SAAS,GAAG,2CAAoB,CAAC,MAAM,CAAC;SAChD;aAAM;YACH,IAAI,CAAC,SAAS,GAAG,2CAAoB,CAAC,QAAQ,CAAC;SAClD;QAED,IAAI,SAAS,CAAC,qBAAqB,KAAK,aAAa,EAAE;YACnD,IAAI,CAAC,WAAW,GAAG,2CAAoB,CAAC,MAAM,CAAC;SAClD;aAAM;YACH,IAAI,CAAC,WAAW,GAAG,2CAAoB,CAAC,QAAQ,CAAC;SACpD;QAED,IAAI,SAAS,CAAC,qBAAqB,KAAK,aAAa,EAAE;YACnD,IAAI,CAAC,WAAW,GAAG,2CAAoB,CAAC,MAAM,CAAC;SAClD;aAAM;YACH,IAAI,CAAC,WAAW,GAAG,2CAAoB,CAAC,QAAQ,CAAC;SACpD;IACL,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,UAA+B,EAAE,KAA2B;QAC5E,IAAI,UAAU,KAAK,yCAAmB,CAAC,SAAS,EAAE;YAC9C,MAAM,6BAAa,CAAC,QAAQ,CACxB,aAAa,EACb;gBACI,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;gBACrB,sBAAsB,EAAE,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc;aACnF,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;SACL;aAAM,IAAI,UAAU,KAAK,yCAAmB,CAAC,WAAW,EAAE;YACvD,MAAM,6BAAa,CAAC,QAAQ,CACxB,aAAa,EACb;gBACI,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;gBACrB,wBAAwB,EAAE,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc;aACrF,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;SACL;aAAM,IAAI,UAAU,KAAK,yCAAmB,CAAC,WAAW,EAAE;YACvD,MAAM,6BAAa,CAAC,QAAQ,CACxB,aAAa,EACb;gBACI,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;gBACrB,yBAAyB,EAAE,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc;aACtF,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;SACL;IACL,CAAC;CACJ;AA3DD,4CA2DC"} \ No newline at end of file +{"version":3,"file":"GroupPermissions.js","sourceRoot":"","sources":["../../classes/GroupPermissions.ts"],"names":[],"m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,MAAM,CAAC,EAAE;gBACrB,wBAAwB,EAAE,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc;aACrF,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;SACL;aAAM,IAAI,UAAU,KAAK,yCAAmB,CAAC,WAAW,EAAE;YACvD,MAAM,6BAAa,CAAC,QAAQ,CACxB,aAAa,EACb;gBACI,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;gBACrB,yBAAyB,EAAE,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc;aACtF,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;SACL;IACL,CAAC;CACJ;AArFD,4CAqFC"} \ No newline at end of file diff --git a/dist/classes/GroupReactionMessage.d.ts b/dist/classes/GroupReactionMessage.d.ts index 4c5566e..27df7f0 100644 --- a/dist/classes/GroupReactionMessage.d.ts +++ b/dist/classes/GroupReactionMessage.d.ts @@ -5,11 +5,28 @@ import { Emoji } from "./Emoji"; import { ReactionTarget } from "./ReactionTarget"; import { ReactionMessage } from "./ReactionMessage"; /** - * A reaction message as sent by Signal + * A reaction message sent in a {@link Group} */ export declare class GroupReactionMessage extends GroupMessage implements ReactionMessage { + /** + * {@link Emoji} that was used for the reaction + */ emoji: Emoji; + /** + * Whether the reaction is a removal + */ removed: boolean; + /** + * Message targeted by the reaction + */ target: ReactionTarget; + /** + * @param user - The author of the message + * @param data - Data associated with the reaction + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param client + * @internal + */ constructor(user: User, data: any, time: number, groupId: string, client: Client); } diff --git a/dist/classes/GroupReactionMessage.js b/dist/classes/GroupReactionMessage.js index 1b70178..5beb244 100644 --- a/dist/classes/GroupReactionMessage.js +++ b/dist/classes/GroupReactionMessage.js @@ -6,9 +6,17 @@ const Group_1 = require("./Group"); const Emoji_1 = require("./Emoji"); const ReactionTarget_1 = require("./ReactionTarget"); /** - * A reaction message as sent by Signal + * A reaction message sent in a {@link Group} */ class GroupReactionMessage extends GroupMessage_1.GroupMessage { + /** + * @param user - The author of the message + * @param data - Data associated with the reaction + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param client + * @internal + */ constructor(user, data, time, groupId, client) { super(user, time, new Group_1.Group(groupId, client), client, data.expiresInSeconds); this.removed = data.reaction.isRemove; diff --git a/dist/classes/GroupReactionMessage.js.map b/dist/classes/GroupReactionMessage.js.map index 3875476..474fa57 100644 --- a/dist/classes/GroupReactionMessage.js.map +++ b/dist/classes/GroupReactionMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"GroupReactionMessage.js","sourceRoot":"","sources":["../../classes/GroupReactionMessage.ts"],"names":[],"mappings":";;;AAEA,iDAA4C;AAC5C,mCAA8B;AAE9B,mCAA8B;AAC9B,qDAAgD;AAGhD;;GAEG;AACH,MAAa,oBAAqB,SAAQ,2BAAY;IAKlD,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,OAAe,EAAE,MAAc;QAC5E,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,aAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7E,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,+BAAc,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC;CACJ;AAXD,oDAWC"} \ No newline at end of file +{"version":3,"file":"GroupReactionMessage.js","sourceRoot":"","sources":["../../classes/GroupReactionMessage.ts"],"names":[],"mappings":";;;AAEA,iDAA4C;AAC5C,mCAA8B;AAE9B,mCAA8B;AAC9B,qDAAgD;AAGhD;;GAEG;AACH,MAAa,oBAAqB,SAAQ,2BAAY;IAgBlD;;;;;;;OAOG;IACH,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,OAAe,EAAE,MAAc;QAC5E,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,aAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7E,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,+BAAc,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC;CACJ;AA9BD,oDA8BC"} \ No newline at end of file diff --git a/dist/classes/GroupStickerMessage.d.ts b/dist/classes/GroupStickerMessage.d.ts index aa587eb..88ec5d7 100644 --- a/dist/classes/GroupStickerMessage.d.ts +++ b/dist/classes/GroupStickerMessage.d.ts @@ -1,12 +1,23 @@ import { User } from "./User"; import { GroupMessage } from "./GroupMessage"; import { Client } from "./Client"; -import { StickerMessage } from "./StickerMessage"; import { Sticker } from "./Sticker"; +import { StickerMessage } from "./StickerMessage"; /** - * A sticker message as sent by Signal + * A sticker message sent in a {@link Group} */ export declare class GroupStickerMessage extends GroupMessage implements StickerMessage { + /** + * {@link Sticker} that was sent + */ sticker: Sticker; + /** + * @param user - The author of the message + * @param data - Data associated with the sticker + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param client + * @internal + */ constructor(user: User, data: any, time: number, groupId: string, client: Client); } diff --git a/dist/classes/GroupStickerMessage.js b/dist/classes/GroupStickerMessage.js index 45f4fc2..3d48191 100644 --- a/dist/classes/GroupStickerMessage.js +++ b/dist/classes/GroupStickerMessage.js @@ -6,9 +6,17 @@ const Group_1 = require("./Group"); const Sticker_1 = require("./Sticker"); const StickerSource_1 = require("../enums/StickerSource"); /** - * A sticker message as sent by Signal + * A sticker message sent in a {@link Group} */ class GroupStickerMessage extends GroupMessage_1.GroupMessage { + /** + * @param user - The author of the message + * @param data - Data associated with the sticker + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param client + * @internal + */ constructor(user, data, time, groupId, client) { super(user, time, new Group_1.Group(groupId, client), client, data.expiresInSeconds); this.sticker = new Sticker_1.Sticker(StickerSource_1.StickerSource.Received, data.sticker, client); diff --git a/dist/classes/GroupStickerMessage.js.map b/dist/classes/GroupStickerMessage.js.map index b2f7ca0..889ff8d 100644 --- a/dist/classes/GroupStickerMessage.js.map +++ b/dist/classes/GroupStickerMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"GroupStickerMessage.js","sourceRoot":"","sources":["../../classes/GroupStickerMessage.ts"],"names":[],"mappings":";;;AACA,iDAA4C;AAC5C,mCAA8B;AAG9B,uCAAkC;AAClC,0DAAqD;AAErD;;GAEG;AACH,MAAa,mBAAoB,SAAQ,2BAAY;IAGjD,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,OAAe,EAAE,MAAc;QAC5E,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,aAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7E,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,6BAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7E,CAAC;CACJ;AAPD,kDAOC"} \ No newline at end of file +{"version":3,"file":"GroupStickerMessage.js","sourceRoot":"","sources":["../../classes/GroupStickerMessage.ts"],"names":[],"mappings":";;;AACA,iDAA4C;AAC5C,mCAA8B;AAE9B,uCAAkC;AAClC,0DAAqD;AAGrD;;GAEG;AACH,MAAa,mBAAoB,SAAQ,2BAAY;IAMjD;;;;;;;OAOG;IACH,YAAY,IAAU,EAAE,IAAS,EAAE,IAAY,EAAE,OAAe,EAAE,MAAc;QAC5E,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,aAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7E,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,6BAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7E,CAAC;CACJ;AAlBD,kDAkBC"} \ No newline at end of file diff --git a/dist/classes/GroupTypingMessage.d.ts b/dist/classes/GroupTypingMessage.d.ts index 4c4af69..ee302dd 100644 --- a/dist/classes/GroupTypingMessage.d.ts +++ b/dist/classes/GroupTypingMessage.d.ts @@ -2,10 +2,22 @@ import { User } from "./User"; import { GroupMessage } from "./GroupMessage"; import { Client } from "./Client"; import { TypingMessageAction } from "../enums/TypingMessageAction"; +import { TypingMessage } from "./TypingMessage"; /** - * A typing message as sent by Signal + * A {@link TypingMessage} sent in a {@link Group} */ -export declare class GroupTypingMessage extends GroupMessage { +export declare class GroupTypingMessage extends GroupMessage implements TypingMessage { + /** + * Action associated with the typing message + */ action: TypingMessageAction; + /** + * @param user - The author of the message + * @param action - The action associated with the typing message + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param client + * @internal + */ constructor(user: User, action: TypingMessageAction, time: number, groupId: string, client: Client); } diff --git a/dist/classes/GroupTypingMessage.js b/dist/classes/GroupTypingMessage.js index 205b64e..18debd6 100644 --- a/dist/classes/GroupTypingMessage.js +++ b/dist/classes/GroupTypingMessage.js @@ -4,9 +4,17 @@ exports.GroupTypingMessage = void 0; const GroupMessage_1 = require("./GroupMessage"); const Group_1 = require("./Group"); /** - * A typing message as sent by Signal + * A {@link TypingMessage} sent in a {@link Group} */ class GroupTypingMessage extends GroupMessage_1.GroupMessage { + /** + * @param user - The author of the message + * @param action - The action associated with the typing message + * @param time - The timestamp the message was sent at + * @param groupId - The group the message was sent in + * @param client + * @internal + */ constructor(user, action, time, groupId, client) { super(user, time, new Group_1.Group(groupId, client), client); this.action = action; diff --git a/dist/classes/GroupTypingMessage.js.map b/dist/classes/GroupTypingMessage.js.map index 0e6f94a..95abf86 100644 --- a/dist/classes/GroupTypingMessage.js.map +++ b/dist/classes/GroupTypingMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"GroupTypingMessage.js","sourceRoot":"","sources":["../../classes/GroupTypingMessage.ts"],"names":[],"mappings":";;;AAEA,iDAA4C;AAC5C,mCAA8B;AAI9B;;GAEG;AACH,MAAa,kBAAmB,SAAQ,2BAAY;IAGhD,YAAY,IAAU,EAAE,MAA2B,EAAE,IAAY,EAAE,OAAe,EAAE,MAAc;QAC9F,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,aAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AAPD,gDAOC"} \ No newline at end of file +{"version":3,"file":"GroupTypingMessage.js","sourceRoot":"","sources":["../../classes/GroupTypingMessage.ts"],"names":[],"mappings":";;;AAEA,iDAA4C;AAC5C,mCAA8B;AAK9B;;GAEG;AACH,MAAa,kBAAmB,SAAQ,2BAAY;IAMhD;;;;;;;OAOG;IACH,YAAY,IAAU,EAAE,MAA2B,EAAE,IAAY,EAAE,OAAe,EAAE,MAAc;QAC9F,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,aAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AAlBD,gDAkBC"} \ No newline at end of file diff --git a/dist/classes/MessageFormatting.d.ts b/dist/classes/MessageFormatting.d.ts index 1a5380a..b88c198 100644 --- a/dist/classes/MessageFormatting.d.ts +++ b/dist/classes/MessageFormatting.d.ts @@ -1,6 +1,21 @@ import { MessageFormattingRule } from "./MessageFormattingRule"; +/** + * A collection of rules to apply formatting styles to a message + */ export declare class MessageFormatting { + /** + * Array of {@link MessageFormattingRule} + */ rules: MessageFormattingRule[]; + /** + * @param plain - Plain text message + * @param data - List of Signal-formatted rules + * @internal + */ constructor(plain?: string, data?: any); + /** + * Convert from a list of formatting rules + * @param rules + */ static fromRules(rules: MessageFormattingRule[]): MessageFormatting; } diff --git a/dist/classes/MessageFormatting.js b/dist/classes/MessageFormatting.js index 532fddd..5a8848a 100644 --- a/dist/classes/MessageFormatting.js +++ b/dist/classes/MessageFormatting.js @@ -2,7 +2,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.MessageFormatting = void 0; const MessageFormattingRule_1 = require("./MessageFormattingRule"); +/** + * A collection of rules to apply formatting styles to a message + */ class MessageFormatting { + /** + * @param plain - Plain text message + * @param data - List of Signal-formatted rules + * @internal + */ constructor(plain, data) { if (data && plain) { this.rules = data.map(i => { @@ -13,6 +21,10 @@ class MessageFormatting { this.rules = []; } } + /** + * Convert from a list of formatting rules + * @param rules + */ static fromRules(rules) { let mf = new MessageFormatting(); for (let rule of rules) { diff --git a/dist/classes/MessageFormatting.js.map b/dist/classes/MessageFormatting.js.map index 5431ab5..2e24bb0 100644 --- a/dist/classes/MessageFormatting.js.map +++ b/dist/classes/MessageFormatting.js.map @@ -1 +1 @@ -{"version":3,"file":"MessageFormatting.js","sourceRoot":"","sources":["../../classes/MessageFormatting.ts"],"names":[],"mappings":";;;AAAA,mEAA8D;AAG9D,MAAa,iBAAiB;IAG1B,YAAY,KAAc,EAAE,IAAU;QAClC,IAAI,IAAI,IAAI,KAAK,EAAE;YACf,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;gBACtB,OAAO,IAAI,6CAAqB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAC;SACN;aAAM;YACH,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;SACnB;IACL,CAAC;IAEM,MAAM,CAAC,SAAS,CAAC,KAA8B;QAClD,IAAI,EAAE,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAEjC,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE;YACpB,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACvB;QAED,OAAO,EAAE,CAAC;IACd,CAAC;CAGJ;AAxBD,8CAwBC"} \ No newline at end of file +{"version":3,"file":"MessageFormatting.js","sourceRoot":"","sources":["../../classes/MessageFormatting.ts"],"names":[],"mappings":";;;AAAA,mEAA8D;AAE9D;;GAEG;AACH,MAAa,iBAAiB;IAM1B;;;;OAIG;IACH,YAAY,KAAc,EAAE,IAAU;QAClC,IAAI,IAAI,IAAI,KAAK,EAAE;YACf,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;gBACtB,OAAO,IAAI,6CAAqB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAC;SACN;aAAM;YACH,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;SACnB;IACL,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,SAAS,CAAC,KAA8B;QAClD,IAAI,EAAE,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAEjC,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE;YACpB,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACvB;QAED,OAAO,EAAE,CAAC;IACd,CAAC;CAGJ;AApCD,8CAoCC"} \ No newline at end of file diff --git a/dist/classes/MessageFormattingRule.d.ts b/dist/classes/MessageFormattingRule.d.ts index 9418bdd..2d799ec 100644 --- a/dist/classes/MessageFormattingRule.d.ts +++ b/dist/classes/MessageFormattingRule.d.ts @@ -1,11 +1,43 @@ import { MessageFormattingStyle } from "../enums/MessageFormattingStyle"; +/** + * A rule used to apply formatting styles to a message + */ export declare class MessageFormattingRule { + /** + * Starting position of the rule + */ start: number; + /** + * Ending position of the rule + */ end: number; + /** + * Length of the rule + */ length: number; + /** + * Chunk of text covered by this rule + */ extract?: string; + /** + * Style the rule has to apply + */ styling: MessageFormattingStyle; + /** + * @param data - Data to reconstruct the formatting rule + * @param text - Non-formatted message text + * @internal + */ constructor(data: any, text?: string); + /** + * Build a formatting rule + * @param style - The style to apply + * @param start - The start position + * @param length - The length of the rule + */ static build(style: MessageFormattingStyle, start: number, length: number): MessageFormattingRule; + /** + * Convert the formatting rule to a format that can be passed to signal-cli + */ toCLIFormat(): string; } diff --git a/dist/classes/MessageFormattingRule.js b/dist/classes/MessageFormattingRule.js index 729a5d9..a7b7806 100644 --- a/dist/classes/MessageFormattingRule.js +++ b/dist/classes/MessageFormattingRule.js @@ -1,7 +1,15 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MessageFormattingRule = void 0; +/** + * A rule used to apply formatting styles to a message + */ class MessageFormattingRule { + /** + * @param data - Data to reconstruct the formatting rule + * @param text - Non-formatted message text + * @internal + */ constructor(data, text) { this.styling = data.style; this.start = data.start; @@ -9,6 +17,12 @@ class MessageFormattingRule { this.end = data.start + data.length; this.extract = text?.substring(this.start, this.end); } + /** + * Build a formatting rule + * @param style - The style to apply + * @param start - The start position + * @param length - The length of the rule + */ static build(style, start, length) { return new MessageFormattingRule({ style, @@ -16,6 +30,9 @@ class MessageFormattingRule { length }); } + /** + * Convert the formatting rule to a format that can be passed to signal-cli + */ toCLIFormat() { return this.start + ":" + this.length + ":" + this.styling; } diff --git a/dist/classes/MessageFormattingRule.js.map b/dist/classes/MessageFormattingRule.js.map index 3ba897a..423e41d 100644 --- a/dist/classes/MessageFormattingRule.js.map +++ b/dist/classes/MessageFormattingRule.js.map @@ -1 +1 @@ -{"version":3,"file":"MessageFormattingRule.js","sourceRoot":"","sources":["../../classes/MessageFormattingRule.ts"],"names":[],"mappings":";;;AAEA,MAAa,qBAAqB;IAO9B,YAAY,IAAS,EAAE,IAAa;QAChC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QACpC,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,KAA6B,EAAE,KAAa,EAAE,MAAc;QAC5E,OAAO,IAAI,qBAAqB,CAAC;YAC7B,KAAK;YACL,KAAK;YACL,MAAM;SACT,CAAC,CAAC;IACP,CAAC;IAEM,WAAW;QACd,OAAO,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC;IAC/D,CAAC;CACJ;AA1BD,sDA0BC"} \ No newline at end of file +{"version":3,"file":"MessageFormattingRule.js","sourceRoot":"","sources":["../../classes/MessageFormattingRule.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,MAAa,qBAAqB;IA0B9B;;;;OAIG;IACH,YAAY,IAAS,EAAE,IAAa;QAChC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QACpC,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,KAA6B,EAAE,KAAa,EAAE,MAAc;QAC5E,OAAO,IAAI,qBAAqB,CAAC;YAC7B,KAAK;YACL,KAAK;YACL,MAAM;SACT,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,WAAW;QACd,OAAO,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC;IAC/D,CAAC;CACJ;AA3DD,sDA2DC"} \ No newline at end of file diff --git a/dist/classes/ObjectCache.d.ts b/dist/classes/ObjectCache.d.ts index 6be6b62..7c5ee7e 100644 --- a/dist/classes/ObjectCache.d.ts +++ b/dist/classes/ObjectCache.d.ts @@ -1,3 +1,7 @@ +/** + * A cache for data to be used later + * @internal + */ export declare class ObjectCache extends Object { constructor(props: any); } diff --git a/dist/classes/ObjectCache.js b/dist/classes/ObjectCache.js index 7b52c42..1790f1b 100644 --- a/dist/classes/ObjectCache.js +++ b/dist/classes/ObjectCache.js @@ -1,6 +1,10 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ObjectCache = void 0; +/** + * A cache for data to be used later + * @internal + */ class ObjectCache extends Object { constructor(props) { super(props); diff --git a/dist/classes/ObjectCache.js.map b/dist/classes/ObjectCache.js.map index 12a4c13..729ce63 100644 --- a/dist/classes/ObjectCache.js.map +++ b/dist/classes/ObjectCache.js.map @@ -1 +1 @@ -{"version":3,"file":"ObjectCache.js","sourceRoot":"","sources":["../../classes/ObjectCache.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAY,SAAQ,MAAM;IACnC,YAAY,KAAK;QACb,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;CACJ;AAJD,kCAIC"} \ No newline at end of file +{"version":3,"file":"ObjectCache.js","sourceRoot":"","sources":["../../classes/ObjectCache.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,WAAY,SAAQ,MAAM;IACnC,YAAY,KAAK;QACb,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;CACJ;AAJD,kCAIC"} \ No newline at end of file diff --git a/dist/classes/QuoteBuilder.d.ts b/dist/classes/QuoteBuilder.d.ts index 7d6833f..de44803 100644 --- a/dist/classes/QuoteBuilder.d.ts +++ b/dist/classes/QuoteBuilder.d.ts @@ -1,10 +1,31 @@ import { QuoteMessage } from "./QuoteMessage"; import { Client } from "./Client"; +/** + * A helper class to build a quote to send + */ export declare class QuoteBuilder { + /** + * Timestamp at which the quoted message was sent + */ timestamp: number; + /** + * Number of the author of the quoted message + */ author: string; + /** + * Text of the quoted message + */ content?: string; private client; + /** + * @param client + * @param timestamp - The timestamp at which the quoted message was sent + * @param number - The number of the author of the quoted message + * @param text - The text of the quoted message + */ constructor(client: Client, timestamp: number, number: string, text?: string); + /** + * Transform the {@link QuoteBuilder} into a valid {@link QuoteMessage} + */ build(): QuoteMessage; } diff --git a/dist/classes/QuoteBuilder.js b/dist/classes/QuoteBuilder.js index 886d3ae..a2157ca 100644 --- a/dist/classes/QuoteBuilder.js +++ b/dist/classes/QuoteBuilder.js @@ -2,13 +2,25 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.QuoteBuilder = void 0; const QuoteMessage_1 = require("./QuoteMessage"); +/** + * A helper class to build a quote to send + */ class QuoteBuilder { + /** + * @param client + * @param timestamp - The timestamp at which the quoted message was sent + * @param number - The number of the author of the quoted message + * @param text - The text of the quoted message + */ constructor(client, timestamp, number, text) { this.client = client; this.timestamp = timestamp; this.author = number; this.content = text; } + /** + * Transform the {@link QuoteBuilder} into a valid {@link QuoteMessage} + */ build() { return new QuoteMessage_1.QuoteMessage({ authorNumber: this.author, diff --git a/dist/classes/QuoteBuilder.js.map b/dist/classes/QuoteBuilder.js.map index eeb83bb..28d3a09 100644 --- a/dist/classes/QuoteBuilder.js.map +++ b/dist/classes/QuoteBuilder.js.map @@ -1 +1 @@ -{"version":3,"file":"QuoteBuilder.js","sourceRoot":"","sources":["../../classes/QuoteBuilder.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAG5C,MAAa,YAAY;IAMrB,YAAY,MAAc,EAAE,SAAiB,EAAE,MAAc,EAAE,IAAa;QACxE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IAEM,KAAK;QACR,OAAO,IAAI,2BAAY,CAAC;YACpB,YAAY,EAAE,IAAI,CAAC,MAAM;YACzB,EAAE,EAAE,IAAI,CAAC,SAAS;YAClB,IAAI,EAAE,IAAI,CAAC,OAAO;SACrB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACpB,CAAC;CACJ;AApBD,oCAoBC"} \ No newline at end of file +{"version":3,"file":"QuoteBuilder.js","sourceRoot":"","sources":["../../classes/QuoteBuilder.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAG5C;;GAEG;AACH,MAAa,YAAY;IAiBrB;;;;;OAKG;IACH,YAAY,MAAc,EAAE,SAAiB,EAAE,MAAc,EAAE,IAAa;QACxE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,KAAK;QACR,OAAO,IAAI,2BAAY,CAAC;YACpB,YAAY,EAAE,IAAI,CAAC,MAAM;YACzB,EAAE,EAAE,IAAI,CAAC,SAAS;YAClB,IAAI,EAAE,IAAI,CAAC,OAAO;SACrB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACpB,CAAC;CACJ;AAxCD,oCAwCC"} \ No newline at end of file diff --git a/dist/classes/QuoteMessage.d.ts b/dist/classes/QuoteMessage.d.ts index e8cd5f0..e730344 100644 --- a/dist/classes/QuoteMessage.d.ts +++ b/dist/classes/QuoteMessage.d.ts @@ -1,11 +1,34 @@ import { User } from "./User"; import { Attachment } from "./Attachment"; import { Client } from "./Client"; +/** + * A message constructed from a quote + */ export declare class QuoteMessage { + /** + * {@link Date} the quoted message was sent at + */ createdAt: Date; + /** + * Timestamp the quoted message was sent at + */ createdTimestamp: number; + /** + * Author of the quoted message + */ author: User; + /** + * Text of the quoted message + */ content?: string; + /** + * Attachments in the quoted message + */ attachments?: Attachment[]; + /** + * @param quoteData - Data to reconstruct the quoted message + * @param client + * @internal + */ constructor(quoteData: any, client: Client); } diff --git a/dist/classes/QuoteMessage.js b/dist/classes/QuoteMessage.js index 361c1cd..32209d7 100644 --- a/dist/classes/QuoteMessage.js +++ b/dist/classes/QuoteMessage.js @@ -4,7 +4,15 @@ exports.QuoteMessage = void 0; const User_1 = require("./User"); const Attachment_1 = require("./Attachment"); const UserDataType_1 = require("../enums/UserDataType"); +/** + * A message constructed from a quote + */ class QuoteMessage { + /** + * @param quoteData - Data to reconstruct the quoted message + * @param client + * @internal + */ constructor(quoteData, client) { this.author = new User_1.User(quoteData, UserDataType_1.UserDataType.Quote, client); this.content = quoteData.text && quoteData.text.trim().length > 0 ? quoteData.text : null; diff --git a/dist/classes/QuoteMessage.js.map b/dist/classes/QuoteMessage.js.map index 4688775..c938667 100644 --- a/dist/classes/QuoteMessage.js.map +++ b/dist/classes/QuoteMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"QuoteMessage.js","sourceRoot":"","sources":["../../classes/QuoteMessage.ts"],"names":[],"mappings":";;;AAAA,iCAA4B;AAC5B,6CAAwC;AACxC,wDAAmD;AAGnD,MAAa,YAAY;IAOrB,YAAY,SAAc,EAAE,MAAc;QACtC,IAAI,CAAC,MAAM,GAAG,IAAI,WAAI,CAA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rC,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;CACJ;AAtCD,oCAsCC"} \ No newline at end of file diff --git a/dist/classes/ReactionMessage.d.ts b/dist/classes/ReactionMessage.d.ts index cf5fcc5..67c5032 100644 --- a/dist/classes/ReactionMessage.d.ts +++ b/dist/classes/ReactionMessage.d.ts @@ -1,7 +1,20 @@ import { Emoji } from "./Emoji"; import { ReactionTarget } from "./ReactionTarget"; +/** + * A reaction message + * @internal + */ export declare class ReactionMessage { + /** + * {@link Emoji} that was used for the reaction + */ emoji: Emoji; + /** + * Whether the reaction is a removal + */ removed: boolean; + /** + * Message targetted by the reaction + */ target: ReactionTarget; } diff --git a/dist/classes/ReactionMessage.js b/dist/classes/ReactionMessage.js index 8204b85..54ddff3 100644 --- a/dist/classes/ReactionMessage.js +++ b/dist/classes/ReactionMessage.js @@ -1,6 +1,10 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ReactionMessage = void 0; +/** + * A reaction message + * @internal + */ class ReactionMessage { } exports.ReactionMessage = ReactionMessage; diff --git a/dist/classes/ReactionMessage.js.map b/dist/classes/ReactionMessage.js.map index 064c506..ce81c1c 100644 --- a/dist/classes/ReactionMessage.js.map +++ b/dist/classes/ReactionMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"ReactionMessage.js","sourceRoot":"","sources":["../../classes/ReactionMessage.ts"],"names":[],"mappings":";;;AAKA,MAAa,eAAe;CAI3B;AAJD,0CAIC"} \ No newline at end of file +{"version":3,"file":"ReactionMessage.js","sourceRoot":"","sources":["../../classes/ReactionMessage.ts"],"names":[],"mappings":";;;AAKA;;;GAGG;AACH,MAAa,eAAe;CAe3B;AAfD,0CAeC"} \ No newline at end of file diff --git a/dist/classes/ReactionTarget.d.ts b/dist/classes/ReactionTarget.d.ts index e6ca383..3ddf56b 100644 --- a/dist/classes/ReactionTarget.d.ts +++ b/dist/classes/ReactionTarget.d.ts @@ -2,6 +2,15 @@ import { ReceivedMessage } from "./ReceivedMessage"; import { DM } from "./DM"; import { Group } from "./Group"; import { Client } from "./Client"; +/** + * The target message for a reaction + */ export declare class ReactionTarget extends ReceivedMessage { + /** + * @param data - The data to reconstruct the target message + * @param channel - The channel the target message is in + * @param client + * @internal + */ constructor(data: any, channel: DM | Group, client: Client); } diff --git a/dist/classes/ReactionTarget.js b/dist/classes/ReactionTarget.js index 7f5adc8..a9fe0cb 100644 --- a/dist/classes/ReactionTarget.js +++ b/dist/classes/ReactionTarget.js @@ -4,7 +4,16 @@ exports.ReactionTarget = void 0; const User_1 = require("./User"); const UserDataType_1 = require("../enums/UserDataType"); const ReceivedMessage_1 = require("./ReceivedMessage"); +/** + * The target message for a reaction + */ class ReactionTarget extends ReceivedMessage_1.ReceivedMessage { + /** + * @param data - The data to reconstruct the target message + * @param channel - The channel the target message is in + * @param client + * @internal + */ constructor(data, channel, client) { super(new User_1.User(data.reaction, UserDataType_1.UserDataType.Reaction, client), data.reaction.targetSentTimestamp, channel, client, null); } diff --git a/dist/classes/ReactionTarget.js.map b/dist/classes/ReactionTarget.js.map index 7b4329d..25ea0e2 100644 --- a/dist/classes/ReactionTarget.js.map +++ b/dist/classes/ReactionTarget.js.map @@ -1 +1 @@ -{"version":3,"file":"ReactionTarget.js","sourceRoot":"","sources":["../../classes/ReactionTarget.ts"],"names":[],"mappings":";;;AAAA,iCAA4B;AAC5B,wDAAmD;AACnD,uDAAkD;AAKlD,MAAa,cAAe,SAAQ,iCAAe;IAC/C,YAAY,IAAS,EAAE,OAAiB,EAAE,MAAc;QACpD,KAAK,CAAC,IAAI,WAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,2BAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5H,CAAC;CACJ;AAJD,wCAIC"} \ No newline at end of file +{"version":3,"file":"ReactionTarget.js","sourceRoot":"","sources":["../../classes/ReactionTarget.ts"],"names":[],"mappings":";;;AAAA,iCAA4B;AAC5B,wDAAmD;AACnD,uDAAkD;AAKlD;;GAEG;AACH,MAAa,cAAe,SAAQ,iCAAe;IAC/C;;;;;OAKG;IACH,YAAY,IAAS,EAAE,OAAiB,EAAE,MAAc;QACpD,KAAK,CAAC,IAAI,WAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,2BAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5H,CAAC;CACJ;AAVD,wCAUC"} \ No newline at end of file diff --git a/dist/classes/ReceivedMessage.d.ts b/dist/classes/ReceivedMessage.d.ts index e4e3729..00caa87 100644 --- a/dist/classes/ReceivedMessage.d.ts +++ b/dist/classes/ReceivedMessage.d.ts @@ -2,16 +2,55 @@ import { User } from "./User"; import { Group } from "./Group"; import { DM } from "./DM"; import { Client } from "./Client"; +/** + * A message received from Signal + * @internal + */ export declare class ReceivedMessage { client: Client; + /** + * Author of the message + */ author: User; + /** + * {@link Date} the message was sent at + */ createdAt: Date; + /** + * Timestamp the message was sent at + */ createdTimestamp: number; + /** + * Channel the message was sent in + */ channel: DM | Group; + /** + * Whether the message will disappear automatically or not (disappearing messages) + */ ephemeral: boolean | null; + /** + * {@link Date} at which the message will disappear, if applicable + */ expiresAt?: Date; + /** + * Timestamp at which the message will disappear, if applicable + */ expiresTimestamp?: number; + /** + * Number of seconds remaining before the message disappears, if applicable + */ expiresInSeconds?: number; + /** + * Whether the message was sent in a group channel or not + */ isGroup: boolean; + /** + * @param user - The author of the message + * @param time - The timestamp the message was sent at + * @param channel - The channel the message was sent it + * @param client + * @param expirity - The number of seconds remaining before the message disappears, if applicable + * @internal + */ constructor(user: User, time: number, channel: DM | Group, client: Client, expirity?: number | null); } diff --git a/dist/classes/ReceivedMessage.js b/dist/classes/ReceivedMessage.js index 6c19ac6..6b93d8d 100644 --- a/dist/classes/ReceivedMessage.js +++ b/dist/classes/ReceivedMessage.js @@ -1,8 +1,23 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ReceivedMessage = void 0; +/** + * A message received from Signal + * @internal + */ class ReceivedMessage { + /** + * @param user - The author of the message + * @param time - The timestamp the message was sent at + * @param channel - The channel the message was sent it + * @param client + * @param expirity - The number of seconds remaining before the message disappears, if applicable + * @internal + */ constructor(user, time, channel, client, expirity) { + /** + * Whether the message will disappear automatically or not (disappearing messages) + */ this.ephemeral = false; this.client = client; this.channel = channel; diff --git a/dist/classes/ReceivedMessage.js.map b/dist/classes/ReceivedMessage.js.map index 32d3a82..0e0968a 100644 --- a/dist/classes/ReceivedMessage.js.map +++ b/dist/classes/ReceivedMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"ReceivedMessage.js","sourceRoot":"","sources":["../../classes/ReceivedMessage.ts"],"names":[],"mappings":";;;AAKA,MAAa,eAAe;IAYxB,YAAY,IAAU,EAAE,IAAY,EAAE,OAAiB,EAAE,MAAc,EAAE,QAAsB;QANxF,cAAS,GAAiB,KAAK,CAAC;QAOnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAE7B,IAAI,QAAQ,IAAI,QAAQ,GAAG,CAAC,EAAE;YAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;YACjC,IAAI,CAAC,gBAAgB,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;YACjE,IAAI,CAA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J;AAxED,0CAwEC"} \ No newline at end of file diff --git a/dist/classes/ReceivedURLPreview.d.ts b/dist/classes/ReceivedURLPreview.d.ts index a883e5a..e4d916c 100644 --- a/dist/classes/ReceivedURLPreview.d.ts +++ b/dist/classes/ReceivedURLPreview.d.ts @@ -1,10 +1,32 @@ import { IReceivedMessageURLPreview } from "../types/IReceivedMessageURLPreview"; import { Attachment } from "./Attachment"; +/** + * A URL preview in a received message + */ export declare class ReceivedURLPreview { + /** + * URL for this preview + */ url: string; + /** + * Title of the preview + */ title: string; + /** + * Optional description of the preview + */ description?: string; + /** + * Optional {@link Attachment} of the preview's image + */ image?: Attachment; + /** + * @param data - Data to reconstruct the {@link ReceivedURLPreview} + * @internal + */ constructor(data: any); + /** + * Build a URL preview object + */ build(): IReceivedMessageURLPreview; } diff --git a/dist/classes/ReceivedURLPreview.js b/dist/classes/ReceivedURLPreview.js index 8fe1339..90c25a8 100644 --- a/dist/classes/ReceivedURLPreview.js +++ b/dist/classes/ReceivedURLPreview.js @@ -2,7 +2,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.ReceivedURLPreview = void 0; const Attachment_1 = require("./Attachment"); +/** + * A URL preview in a received message + */ class ReceivedURLPreview { + /** + * @param data - Data to reconstruct the {@link ReceivedURLPreview} + * @internal + */ constructor(data) { this.url = data.url; this.title = data.title; @@ -11,6 +18,9 @@ class ReceivedURLPreview { if (data.image) this.image = new Attachment_1.Attachment(data.image); } + /** + * Build a URL preview object + */ build() { return { url: this.url, diff --git a/dist/classes/ReceivedURLPreview.js.map b/dist/classes/ReceivedURLPreview.js.map index af9e306..203995c 100644 --- a/dist/classes/ReceivedURLPreview.js.map +++ b/dist/classes/ReceivedURLPreview.js.map @@ -1 +1 @@ -{"version":3,"file":"ReceivedURLPreview.js","sourceRoot":"","sources":["../../classes/ReceivedURLPreview.ts"],"names":[],"mappings":";;;AAEA,6CAAwC;AAExC,MAAa,kBAAkB;IAM3B,YAAY,IAAS;QACjB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,IAAI,CAAC,WAAW;YAAE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAC1D,IAAI,IAAI,CAAC,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,IAAI,uBAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;IAEM,KAAK;QACR,OAAO;YACH,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;SACpB,CAAA;IACL,CAAC;CACJ;AArBD,gDAqBC"} \ No newline at end of file +{"version":3,"file":"ReceivedURLPreview.js","sourceRoot":"","sources":["../../classes/ReceivedURLPreview.ts"],"names":[],"mappings":";;;AAEA,6CAAwC;AAExC;;GAEG;AACH,MAAa,kBAAkB;IAqB3B;;;OAGG;IACH,YAAY,IAAS;QACjB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,IAAI,CAAC,WAAW;YAAE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAC1D,IAAI,IAAI,CAAC,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,IAAI,uBAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACI,KAAK;QACR,OAAO;YACH,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;SACpB,CAAA;IACL,CAAC;CACJ;AA3CD,gDA2CC"} \ No newline at end of file diff --git a/dist/classes/SentDataMessage.d.ts b/dist/classes/SentDataMessage.d.ts index 2d07bc7..409e757 100644 --- a/dist/classes/SentDataMessage.d.ts +++ b/dist/classes/SentDataMessage.d.ts @@ -3,10 +3,35 @@ import { DM } from "./DM"; import { Group } from "./Group"; import { IChatMessageOptions } from "../types/IChatMessageOptions"; import { SentMessage } from "./SentMessage"; +/** + * A text message sent to Signal + */ export declare class SentDataMessage extends SentMessage { + /** + * Text of the message + */ content: string; + /** + * Options used to build the message + */ options?: IChatMessageOptions; + /** + * @param time - The timestamp at which the message was sent + * @param channel - The channel the message was sent in + * @param client + * @param content - The text of the message + * @param options - The options used to build the message + * @internal + */ constructor(time: number, channel: DM | Group, client: Client, content: string, options?: IChatMessageOptions); + /** + * Edit the message + * @param text - The new text of the message + * @param options - The new options used to build the message + */ edit(text: string, options?: IChatMessageOptions): Promise; + /** + * Delete the message + */ delete(): Promise; } diff --git a/dist/classes/SentDataMessage.js b/dist/classes/SentDataMessage.js index 7f763a9..076f1f9 100644 --- a/dist/classes/SentDataMessage.js +++ b/dist/classes/SentDataMessage.js @@ -4,12 +4,28 @@ exports.SentDataMessage = void 0; const Group_1 = require("./Group"); const SentMessage_1 = require("./SentMessage"); const CLIDispatcher_1 = require("./CLIDispatcher"); +/** + * A text message sent to Signal + */ class SentDataMessage extends SentMessage_1.SentMessage { + /** + * @param time - The timestamp at which the message was sent + * @param channel - The channel the message was sent in + * @param client + * @param content - The text of the message + * @param options - The options used to build the message + * @internal + */ constructor(time, channel, client, content, options) { super(time, channel, client); this.content = content; this.options = options; } + /** + * Edit the message + * @param text - The new text of the message + * @param options - The new options used to build the message + */ async edit(text, options) { if (options) { options.original = this.createdTimestamp; @@ -21,6 +37,9 @@ class SentDataMessage extends SentMessage_1.SentMessage { } return await this.channel.send(text, options); } + /** + * Delete the message + */ async delete() { if (this.channel instanceof Group_1.Group) { let groupData = await CLIDispatcher_1.CLIDispatcher.dispatch("listGroups", {}, this.client.process); diff --git a/dist/classes/SentDataMessage.js.map b/dist/classes/SentDataMessage.js.map index 07347cf..7847292 100644 --- a/dist/classes/SentDataMessage.js.map +++ b/dist/classes/SentDataMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"SentDataMessage.js","sourceRoot":"","sources":["../../classes/SentDataMessage.ts"],"names":[],"mappings":";;;AAGA,mCAA8B;AAE9B,+CAA0C;AAC1C,mDAA8C;AAG9C,MAAa,eAAgB,SAAQ,yBAAW;IAI5C,YAAY,IAAY,EAAE,OAAiB,EAAE,MAAc,EAAE,OAAe,EAAE,OAA6B;QACvG,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,OAA6B;QACzD,IAAI,OAAO,EAAE;YACT,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC;SAC5C;aAAM;YACH,OAAO,GAAG;gBACN,QAAQ,EAAE,IAAI,CAAC,gBAAgB;aAClC,CAAA;SACJ;QAED,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAEM,KAAK,CAAC,MAAM;QACf,IAAI,IAAI,CAAC,OAAO,YAAY,aAAK,EAAE;YAC/B,IAAI,SAAS,GAAG,MAAM,6BAAa,CAAC,QAAQ,CACxC,YAAY,EACZ,EAAE,EACF,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;YAEF,MAAM,6BAAa,CAAC,QAAQ,CACxB,cAAc,EACd;gBACI,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE;gBACxB,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;gBAClG,eAAe,EAAE,IAAI,CAAC,gBAAgB;aACzC,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;SACL;aAAM;YACH,MAAM,6BAAa,CAAC,QAAQ,CACxB,cAAc,EACd;gBACI,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;gBAChC,eAAe,EAAE,IAAI,CAAC,gBAAgB;aACzC,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;SACL;IACL,CAAC;CACJ;AAlDD,0CAkDC"} \ No newline at end of file +{"version":3,"file":"SentDataMessage.js","sourceRoot":"","sources":["../../classes/SentDataMessage.ts"],"names":[],"mappings":";;;AAGA,mCAA8B;AAE9B,+CAA0C;AAC1C,mDAA8C;AAG9C;;GAEG;AACH,MAAa,eAAgB,SAAQ,yBAAW;IAW5C;;;;;;;OAOG;IACH,YAAY,IAAY,EAAE,OAAiB,EAAE,MAAc,EAAE,OAAe,EAAE,OAA6B;QACvG,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,OAA6B;QACzD,IAAI,OAAO,EAAE;YACT,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC;SAC5C;aAAM;YACH,OAAO,GAAG;gBACN,QAAQ,EAAE,IAAI,CAAC,gBAAgB;aAClC,CAAA;SACJ;QAED,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,MAAM;QACf,IAAI,IAAI,CAAC,OAAO,YAAY,aAAK,EAAE;YAC/B,IAAI,SAAS,GAAG,MAAM,6BAAa,CAAC,QAAQ,CACxC,YAAY,EACZ,EAAE,EACF,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;YAEF,MAAM,6BAAa,CAAC,QAAQ,CACxB,cAAc,EACd;gBACI,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE;gBACxB,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;gBAClG,eAAe,EAAE,IAAI,CAAC,gBAAgB;aACzC,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;SACL;aAAM;YACH,MAAM,6BAAa,CAAC,QAAQ,CACxB,cAAc,EACd;gBACI,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;gBAChC,eAAe,EAAE,IAAI,CAAC,gBAAgB;aACzC,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;SACL;IACL,CAAC;CACJ;AAzED,0CAyEC"} \ No newline at end of file diff --git a/dist/classes/SentMessage.d.ts b/dist/classes/SentMessage.d.ts index 03abdf5..198a657 100644 --- a/dist/classes/SentMessage.d.ts +++ b/dist/classes/SentMessage.d.ts @@ -1,10 +1,28 @@ import { Client } from "./Client"; import { DM } from "./DM"; import { Group } from "./Group"; +/** + * A message sent to Signal by this client + */ export declare class SentMessage { client: Client; + /** + * {@link Date} at which the message was created + */ createdAt: Date; + /** + * Timestamp at which the message was created + */ createdTimestamp: number; + /** + * Channel in which the message was created + */ channel: DM | Group; + /** + * @param time - The timestamp at which the sticker was sent + * @param channel - The channel the sticker was sent at + * @param client + * @internal + */ constructor(time: number, channel: DM | Group, client: Client); } diff --git a/dist/classes/SentMessage.js b/dist/classes/SentMessage.js index 03f4b83..d7a24ec 100644 --- a/dist/classes/SentMessage.js +++ b/dist/classes/SentMessage.js @@ -1,7 +1,16 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SentMessage = void 0; +/** + * A message sent to Signal by this client + */ class SentMessage { + /** + * @param time - The timestamp at which the sticker was sent + * @param channel - The channel the sticker was sent at + * @param client + * @internal + */ constructor(time, channel, client) { this.client = client; this.channel = channel; diff --git a/dist/classes/SentMessage.js.map b/dist/classes/SentMessage.js.map index d3000bf..5bed8c8 100644 --- a/dist/classes/SentMessage.js.map +++ b/dist/classes/SentMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"SentMessage.js","sourceRoot":"","sources":["../../classes/SentMessage.ts"],"names":[],"mappings":";;;AAKA,MAAa,WAAW;IAMpB,YAAY,IAAY,EAAE,OAAiB,EAAE,MAAc;QACvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IACjC,CAAC;CACJ;AAZD,kCAYC"} \ No newline at end of file +{"version":3,"file":"SentMessage.js","sourceRoot":"","sources":["../../classes/SentMessage.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACH,MAAa,WAAW;IAkBpB;;;;;OAKG;IACH,YAAY,IAAY,EAAE,OAAiB,EAAE,MAAc;QACvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IACjC,CAAC;CACJ;AA9BD,kCA8BC"} \ No newline at end of file diff --git a/dist/classes/SentStickerMessage.d.ts b/dist/classes/SentStickerMessage.d.ts index 1a5bef8..4ba0b21 100644 --- a/dist/classes/SentStickerMessage.d.ts +++ b/dist/classes/SentStickerMessage.d.ts @@ -3,8 +3,24 @@ import { DM } from "./DM"; import { Group } from "./Group"; import { SentMessage } from "./SentMessage"; import { Sticker } from "./Sticker"; +/** + * A sticker as sent to Signal + */ export declare class SentStickerMessage extends SentMessage { + /** + * {@link Sticker} that was sent + */ sticker: Sticker; + /** + * @param time - The timestamp at which the sticker was sent + * @param channel - The channel the sticker was sent at + * @param client + * @param sticker - The sticker that was sent + * @internal + */ constructor(time: number, channel: DM | Group, client: Client, sticker: Sticker); + /** + * Delete the sticker message + */ delete(): Promise; } diff --git a/dist/classes/SentStickerMessage.js b/dist/classes/SentStickerMessage.js index d7e10f2..652663d 100644 --- a/dist/classes/SentStickerMessage.js +++ b/dist/classes/SentStickerMessage.js @@ -4,11 +4,24 @@ exports.SentStickerMessage = void 0; const Group_1 = require("./Group"); const SentMessage_1 = require("./SentMessage"); const CLIDispatcher_1 = require("./CLIDispatcher"); +/** + * A sticker as sent to Signal + */ class SentStickerMessage extends SentMessage_1.SentMessage { + /** + * @param time - The timestamp at which the sticker was sent + * @param channel - The channel the sticker was sent at + * @param client + * @param sticker - The sticker that was sent + * @internal + */ constructor(time, channel, client, sticker) { super(time, channel, client); this.sticker = sticker; } + /** + * Delete the sticker message + */ async delete() { if (this.channel instanceof Group_1.Group) { let groupData = await CLIDispatcher_1.CLIDispatcher.dispatch("listGroups", {}, this.client.process); diff --git a/dist/classes/SentStickerMessage.js.map b/dist/classes/SentStickerMessage.js.map index b3ec747..bd91bf0 100644 --- a/dist/classes/SentStickerMessage.js.map +++ b/dist/classes/SentStickerMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"SentStickerMessage.js","sourceRoot":"","sources":["../../classes/SentStickerMessage.ts"],"names":[],"mappings":";;;AAGA,mCAA8B;AAE9B,+CAA0C;AAC1C,mDAA8C;AAI9C,MAAa,kBAAmB,SAAQ,yBAAW;IAG/C,YAAY,IAAY,EAAE,OAAiB,EAAE,MAAc,EAAE,OAAgB;QACzE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,MAAM;QACf,IAAI,IAAI,CAAC,OAAO,YAAY,aAAK,EAAE;YAC/B,IAAI,SAAS,GAAG,MAAM,6BAAa,CAAC,QAAQ,CACxC,YAAY,EACZ,EAAE,EACF,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;YAEF,MAAM,6BAAa,CAAC,QAAQ,CACxB,cAAc,EACd;gBACI,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE;gBACxB,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;gBAClG,eAAe,EAAE,IAAI,CAAC,gBAAgB;aACzC,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;SACL;aAAM;YACH,MAAM,6BAAa,CAAC,QAAQ,CACxB,cAAc,EACd;gBACI,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;gBAChC,eAAe,EAAE,IAAI,CAAC,gBAAgB;aACzC,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;SACL;IACL,CAAC;CACJ;AApCD,gDAoCC"} \ No newline at end of file +{"version":3,"file":"SentStickerMessage.js","sourceRoot":"","sources":["../../classes/SentStickerMessage.ts"],"names":[],"mappings":";;;AAGA,mCAA8B;A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9c0e8d0 100644 --- a/dist/classes/SignalAPIError.d.ts +++ b/dist/classes/SignalAPIError.d.ts @@ -1,4 +1,15 @@ +/** + * An error in the Signal API + */ export declare class SignalAPIError extends Error { + /** + * Internal error code for this error or category of errors + */ code: number; + /** + * @param message - The error message + * @param code - The internal error code for this error or category of errors + * @internal + */ constructor(message: string, code?: number); } diff --git a/dist/classes/SignalAPIError.js b/dist/classes/SignalAPIError.js index 170f0e5..eb08534 100644 --- a/dist/classes/SignalAPIError.js +++ b/dist/classes/SignalAPIError.js @@ -1,7 +1,15 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SignalAPIError = void 0; +/** + * An error in the Signal API + */ class SignalAPIError extends Error { + /** + * @param message - The error message + * @param code - The internal error code for this error or category of errors + * @internal + */ constructor(message, code) { const errorCodes = { '-1': "USER_ERROR", diff --git a/dist/classes/SignalAPIError.js.map b/dist/classes/SignalAPIError.js.map index 9bd0419..fdf80ab 100644 --- a/dist/classes/SignalAPIError.js.map +++ b/dist/classes/SignalAPIError.js.map @@ -1 +1 @@ -{"version":3,"file":"SignalAPIError.js","sourceRoot":"","sources":["../../classes/SignalAPIError.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAe,SAAQ,KAAK;IAGrC,YAAY,OAAe,EAAE,IAAa;QACtC,MAAM,UAAU,GAAG;YACf,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,qBAAqB;SAC9B,CAAA;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAE7B,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC;SACpF;IACL,CAAC;CACJ;AAlBD,wCAkBC"} \ No newline at end of file +{"version":3,"file":"SignalAPIError.js","sourceRoot":"","sources":["../../classes/SignalAPIError.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK;IAMrC;;;;OAIG;IACH,YAAY,OAAe,EAAE,IAAa;QACtC,MAAM,UAAU,GAAG;YACf,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,qBAAqB;SAC9B,CAAA;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAE7B,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC;SACpF;IACL,CAAC;CACJ;AA1BD,wCA0BC"} \ No newline at end of file diff --git a/dist/classes/SignalCLIError.d.ts b/dist/classes/SignalCLIError.d.ts index b3a6bcb..3445780 100644 --- a/dist/classes/SignalCLIError.d.ts +++ b/dist/classes/SignalCLIError.d.ts @@ -1,5 +1,20 @@ +/** + * An error in signal-cli + */ export declare class SignalCLIError extends Error { + /** + * Full path to the signal-cli executable + */ executable: string; + /** + * List of all the command parameters used with signal-cli + */ arguments: string[]; + /** + * @param message - The error message + * @param executable - The full path to the signal-cli executable + * @param args - The list of all the command parameters used with signal-cli + * @internal + */ constructor(message: string, executable?: string, args?: string[]); } diff --git a/dist/classes/SignalCLIError.js b/dist/classes/SignalCLIError.js index b19d17f..76926c7 100644 --- a/dist/classes/SignalCLIError.js +++ b/dist/classes/SignalCLIError.js @@ -1,7 +1,16 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SignalCLIError = void 0; +/** + * An error in signal-cli + */ class SignalCLIError extends Error { + /** + * @param message - The error message + * @param executable - The full path to the signal-cli executable + * @param args - The list of all the command parameters used with signal-cli + * @internal + */ constructor(message, executable, args) { super(message); this.name = "SignalCLIError"; diff --git a/dist/classes/SignalCLIError.js.map b/dist/classes/SignalCLIError.js.map index 0ac6fa9..b24f8f7 100644 --- a/dist/classes/SignalCLIError.js.map +++ b/dist/classes/SignalCLIError.js.map @@ -1 +1 @@ -{"version":3,"file":"SignalCLIError.js","sourceRoot":"","sources":["../../classes/SignalCLIError.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAe,SAAQ,KAAK;IAIrC,YAAY,OAAe,EAAE,UAAmB,EAAE,IAAe;QAC7D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAE7B,IAAI,UAAU;YAAE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7C,IAAI,IAAI;YAAE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACpC,CAAC;CACJ;AAXD,wCAWC"} \ No newline at end of file +{"version":3,"file":"SignalCLIError.js","sourceRoot":"","sources":["../../classes/SignalCLIError.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK;IAWrC;;;;;OAKG;IACH,YAAY,OAAe,EAAE,UAAmB,EAAE,IAAe;QAC7D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAE7B,IAAI,UAAU;YAAE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7C,IAAI,IAAI;YAAE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACpC,CAAC;CACJ;AAxBD,wCAwBC"} \ No newline at end of file diff --git a/dist/classes/Sticker.d.ts b/dist/classes/Sticker.d.ts index ec6cffa..ed7cb3c 100644 --- a/dist/classes/Sticker.d.ts +++ b/dist/classes/Sticker.d.ts @@ -2,9 +2,28 @@ import { StickerPack } from "./StickerPack"; import { Client } from "./Client"; import { Emoji } from "./Emoji"; import { StickerSource } from "../enums/StickerSource"; +/** + * A Signal sticker + */ export declare class Sticker { + /** + * Pack this sticker is part of + */ pack: StickerPack; + /** + * ID to the sticker relative to the pack + */ id: number; + /** + * {@link Emoji} representing this sticker, if applicable + */ emoji?: Emoji; + /** + * @param source - The source of this sticker + * @param data - Data representing the sticker + * @param client + * @param pack - The pack the sticker is part of + * @internal + */ constructor(source: StickerSource, data: any, client: Client, pack?: StickerPack); } diff --git a/dist/classes/Sticker.js b/dist/classes/Sticker.js index a140d97..d3bf003 100644 --- a/dist/classes/Sticker.js +++ b/dist/classes/Sticker.js @@ -4,7 +4,17 @@ exports.Sticker = void 0; const StickerPack_1 = require("./StickerPack"); const Emoji_1 = require("./Emoji"); const StickerSource_1 = require("../enums/StickerSource"); +/** + * A Signal sticker + */ class Sticker { + /** + * @param source - The source of this sticker + * @param data - Data representing the sticker + * @param client + * @param pack - The pack the sticker is part of + * @internal + */ constructor(source, data, client, pack) { if (source === StickerSource_1.StickerSource.Received) { this.pack = new StickerPack_1.StickerPack(data.packId, client); diff --git a/dist/classes/Sticker.js.map b/dist/classes/Sticker.js.map index 773fad9..6afe5f5 100644 --- a/dist/classes/Sticker.js.map +++ b/dist/classes/Sticker.js.map @@ -1 +1 @@ -{"version":3,"file":"Sticker.js","sourceRoot":"","sources":["../../classes/Sticker.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAE1C,mCAA8B;AAC9B,0DAAqD;AAErD,MAAa,OAAO;IAKhB,YAAY,MAAqB,EAAE,IAAS,EAAE,MAAc,EAAE,IAAkB;QAC5E,IAAI,MAAM,KAAK,6BAAa,CAAC,QAAQ,EAAE;YACnC,IAAI,CAAC,IAAI,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACjD,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;SAC5B;aAAM,IAAI,MAAM,KAAK,6BAAa,CAAC,IAAI,EAAE;YACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;YAClB,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACtC;IACL,CAAC;CACJ;AAfD,0BAeC"} \ No newline at end of file +{"version":3,"file":"Sticker.js","sourceRoot":"","sources":["../../classes/Sticker.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAE1C,mCAA8B;AAC9B,0DAAqD;AAErD;;GAEG;AACH,MAAa,OAAO;IAgBhB;;;;;;OAMG;IACH,YAAY,MAAqB,EAAE,IAAS,EAAE,MAAc,EAAE,IAAkB;QAC5E,IAAI,MAAM,KAAK,6BAAa,CAAC,QAAQ,EAAE;YACnC,IAAI,CAAC,IAAI,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACjD,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;SAC5B;aAAM,IAAI,MAAM,KAAK,6BAAa,CAAC,IAAI,EAAE;YACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;YAClB,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACtC;IACL,CAAC;CACJ;AAjCD,0BAiCC"} \ No newline at end of file diff --git a/dist/classes/StickerMessage.d.ts b/dist/classes/StickerMessage.d.ts index 44c6b59..e205c19 100644 --- a/dist/classes/StickerMessage.d.ts +++ b/dist/classes/StickerMessage.d.ts @@ -1,4 +1,11 @@ import { Sticker } from "./Sticker"; +/** + * A message containing a sticker + * @internal + */ export declare class StickerMessage { + /** + * {@link Sticker} the message contains + */ sticker: Sticker; } diff --git a/dist/classes/StickerMessage.js b/dist/classes/StickerMessage.js index 376b5c1..28792dc 100644 --- a/dist/classes/StickerMessage.js +++ b/dist/classes/StickerMessage.js @@ -1,6 +1,10 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StickerMessage = void 0; +/** + * A message containing a sticker + * @internal + */ class StickerMessage { } exports.StickerMessage = StickerMessage; diff --git a/dist/classes/StickerMessage.js.map b/dist/classes/StickerMessage.js.map index 2654a4b..2c56c71 100644 --- a/dist/classes/StickerMessage.js.map +++ b/dist/classes/StickerMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"StickerMessage.js","sourceRoot":"","sources":["../../classes/StickerMessage.ts"],"names":[],"mappings":";;;AAMA,MAAa,cAAc;CAE1B;AAFD,wCAEC"} \ No newline at end of file +{"version":3,"file":"StickerMessage.js","sourceRoot":"","sources":["../../classes/StickerMessage.ts"],"names":[],"mappings":";;;AAMA;;;GAGG;AACH,MAAa,cAAc;CAK1B;AALD,wCAKC"} \ No newline at end of file diff --git a/dist/classes/StickerPack.d.ts b/dist/classes/StickerPack.d.ts index 26f7424..10af6c4 100644 --- a/dist/classes/StickerPack.d.ts +++ b/dist/classes/StickerPack.d.ts @@ -1,11 +1,37 @@ import { Client } from "./Client"; import { Sticker } from "./Sticker"; +/** + * A Signal sticker pack + */ export declare class StickerPack { + /** + * Sticker pack ID + */ id: string; + /** + * Sticker pack name + */ title: string; + /** + * Sticker pack author + */ author: string; + /** + * URL to install the sticker pack + */ url: string; + /** + * Sticker used as a cover for this pack + */ cover: Sticker; + /** + * Stickers the pack contents + */ items: Sticker[]; + /** + * @param id - The sticker pack's ID + * @param client + * @internal + */ constructor(id: string, client: Client); } diff --git a/dist/classes/StickerPack.js b/dist/classes/StickerPack.js index 82cf1d5..fff8d46 100644 --- a/dist/classes/StickerPack.js +++ b/dist/classes/StickerPack.js @@ -3,7 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.StickerPack = void 0; const Sticker_1 = require("./Sticker"); const StickerSource_1 = require("../enums/StickerSource"); +/** + * A Signal sticker pack + */ class StickerPack { + /** + * @param id - The sticker pack's ID + * @param client + * @internal + */ constructor(id, client) { let cacheData = client.stickerPacks['list'].filter(i => i.packId === id)[0]; this.id = cacheData.packId; diff --git a/dist/classes/StickerPack.js.map b/dist/classes/StickerPack.js.map index 70ee4c3..ac6df91 100644 --- a/dist/classes/StickerPack.js.map +++ b/dist/classes/StickerPack.js.map @@ -1 +1 @@ -{"version":3,"file":"StickerPack.js","sourceRoot":"","sources":["../../classes/StickerPack.ts"],"names":[],"mappings":";;;AACA,uCAAkC;AAClC,0DAAqD;AAErD,MAAa,WAAW;IAQpB,YAAY,EAAU,EAAE,MAAc;QAClC,IAAI,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAE5E,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QAC/B,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,IAAI,iBAAO,CAAC,6BAAa,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC5E,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACpC,OAAO,IAAI,iBAAO,CAAC,6BAAa,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApBD,kCAoBC"} \ No newline at end of file +{"version":3,"file":"StickerPack.js","sourceRoot":"","sources":["../../classes/StickerPack.ts"],"names":[],"mappings":";;;AACA,uCAAkC;AAClC,0DAAqD;AAErD;;GAEG;AACH,MAAa,WAAW;IA+BpB;;;;OAIG;IACH,YAAY,EAAU,EAAE,MAAc;QAClC,IAAI,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAE5E,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QAC/B,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,IAAI,iBAAO,CAAC,6BAAa,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC5E,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACpC,OAAO,IAAI,iBAAO,CAAC,6BAAa,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAhDD,kCAgDC"} \ No newline at end of file diff --git a/dist/classes/TypingMessage.d.ts b/dist/classes/TypingMessage.d.ts index ba68f6a..865e0a1 100644 --- a/dist/classes/TypingMessage.d.ts +++ b/dist/classes/TypingMessage.d.ts @@ -1,13 +1,11 @@ -import { User } from "./User"; -import { Message } from "./Message"; +import { TypingMessageAction } from "../enums/TypingMessageAction"; /** - * A typing event + * A typing message sent on Signal + * @internal */ -export declare class TypingMessage extends Message { +export declare class TypingMessage { + /** + * Action associated with the typing message + */ action: TypingMessageAction; - constructor(user: User, action: TypingMessageAction, time: number); -} -export declare enum TypingMessageAction { - Started = "STARTED", - Stopped = "STOPPED" } diff --git a/dist/classes/TypingMessage.js b/dist/classes/TypingMessage.js index 26e9399..5eeb152 100644 --- a/dist/classes/TypingMessage.js +++ b/dist/classes/TypingMessage.js @@ -1,20 +1,11 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.TypingMessageAction = exports.TypingMessage = void 0; -const Message_1 = require("./Message"); +exports.TypingMessage = void 0; /** - * A typing event + * A typing message sent on Signal + * @internal */ -class TypingMessage extends Message_1.Message { - constructor(user, action, time) { - super(user, time); - this.action = action; - } +class TypingMessage { } exports.TypingMessage = TypingMessage; -var TypingMessageAction; -(function (TypingMessageAction) { - TypingMessageAction["Started"] = "STARTED"; - TypingMessageAction["Stopped"] = "STOPPED"; -})(TypingMessageAction || (exports.TypingMessageAction = TypingMessageAction = {})); //# sourceMappingURL=TypingMessage.js.map \ No newline at end of file diff --git a/dist/classes/TypingMessage.js.map b/dist/classes/TypingMessage.js.map index 648a1b2..7c1edba 100644 --- a/dist/classes/TypingMessage.js.map +++ b/dist/classes/TypingMessage.js.map @@ -1 +1 @@ -{"version":3,"file":"TypingMessage.js","sourceRoot":"","sources":["../../classes/TypingMessage.ts"],"names":[],"mappings":";;;AACA,uCAAkC;AAElC;;GAEG;AACH,MAAa,aAAc,SAAQ,iBAAO;IAGtC,YAAY,IAAU,EAAE,MAA2B,EAAE,IAAY;QAC7D,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AAPD,sCAOC;AAED,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC3B,0CAAmB,CAAA;IACnB,0CAAmB,CAAA;AACvB,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B"} \ No newline at end of file +{"version":3,"file":"TypingMessage.js","sourceRoot":"","sources":["../../classes/TypingMessage.ts"],"names":[],"mappings":";;;AAQA;;;GAGG;AACH,MAAa,aAAa;CAKzB;AALD,sCAKC"} \ No newline at end of file diff --git a/dist/classes/User.d.ts b/dist/classes/User.d.ts index e6a09a4..73cf7a7 100644 --- a/dist/classes/User.d.ts +++ b/dist/classes/User.d.ts @@ -1,18 +1,69 @@ import { UserDataType } from "../enums/UserDataType"; import { Client } from "./Client"; import { DM } from "./DM"; +/** + * A Signal user + */ export declare class User { + /** + * The user's phone number + */ number?: string; + /** + * The user's nickname they set + */ nickName?: string; + /** + * The user's UUID + */ uuid?: string; + /** + * The ID of the device the user is on + */ device?: number; private client; + /** + * @param data - Sufficient data to create a {@link User} + * @param dataType - The type of data used to create the {@link User} + * @param client + * @internal + */ constructor(data: any, dataType: UserDataType, client: Client); + /** + * Create a {@link DM} with this user + */ createDM(): DM; + /** + * Create a new {@link User} from a phone number + * @param number - The phone number to use + * @param client + */ static fromNumber(number: string, client: Client): User; + /** + * Block or unblock this user + * @param blocked - Whether the user should be blocked or not + */ setBlocked(blocked: boolean): Promise; + /** + * Verify the user's safety number + * + * @param safetyNumber - The user's safety number. + * If not present, all known keys will be trusted + */ verify(safetyNumber?: string): Promise; - addToContacts(name?: string, disappearingMessagesTime?: number): Promise; + /** + * Add the user to the contacts list + * @param name - The name to give the user + */ + addToContacts(name?: string): Promise; + /** + * Remove the user from the contact list + */ removeFromContacts(): Promise; + /** + * Change the disappearing messages expiration time + * @param time - The time (in seconds) before a message gets deleted. + * Use 0 to disable disappearing messages + */ setDisappearingMessagesTime(time?: number): Promise; } diff --git a/dist/classes/User.js b/dist/classes/User.js index 20db534..913b491 100644 --- a/dist/classes/User.js +++ b/dist/classes/User.js @@ -4,11 +4,32 @@ exports.User = void 0; const UserDataType_1 = require("../enums/UserDataType"); const CLIDispatcher_1 = require("./CLIDispatcher"); const DM_1 = require("./DM"); +/** + * A Signal user + */ class User { + /** + * @param data - Sufficient data to create a {@link User} + * @param dataType - The type of data used to create the {@link User} + * @param client + * @internal + */ constructor(data, dataType, client) { + /** + * The user's phone number + */ this.number = null; + /** + * The user's nickname they set + */ this.nickName = null; + /** + * The user's UUID + */ this.uuid = null; + /** + * The ID of the device the user is on + */ this.device = null; this.client = client; if (dataType === UserDataType_1.UserDataType.Envelope) { @@ -44,12 +65,24 @@ class User { this.number = data; } } + /** + * Create a {@link DM} with this user + */ createDM() { return new DM_1.DM(this.uuid ?? null, this.number, this.client); } + /** + * Create a new {@link User} from a phone number + * @param number - The phone number to use + * @param client + */ static fromNumber(number, client) { return new User(number, UserDataType_1.UserDataType.Number, client); } + /** + * Block or unblock this user + * @param blocked - Whether the user should be blocked or not + */ async setBlocked(blocked) { if (blocked) { await CLIDispatcher_1.CLIDispatcher.dispatch("block", { @@ -62,6 +95,12 @@ class User { }, this.client.process); } } + /** + * Verify the user's safety number + * + * @param safetyNumber - The user's safety number. + * If not present, all known keys will be trusted + */ async verify(safetyNumber) { if (safetyNumber) { await CLIDispatcher_1.CLIDispatcher.dispatch("trust", { @@ -76,19 +115,31 @@ class User { }, this.client.process); } } - async addToContacts(name, disappearingMessagesTime) { + /** + * Add the user to the contacts list + * @param name - The name to give the user + */ + async addToContacts(name) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateContact", { name: name, recipient: [this.number] }, this.client.process); await CLIDispatcher_1.CLIDispatcher.dispatch("sendContacts", {}, this.client.process); } + /** + * Remove the user from the contact list + */ async removeFromContacts() { await CLIDispatcher_1.CLIDispatcher.dispatch("removeContact", { recipient: [this.number] }, this.client.process); await CLIDispatcher_1.CLIDispatcher.dispatch("sendContacts", {}, this.client.process); } + /** + * Change the disappearing messages expiration time + * @param time - The time (in seconds) before a message gets deleted. + * Use 0 to disable disappearing messages + */ async setDisappearingMessagesTime(time) { await CLIDispatcher_1.CLIDispatcher.dispatch("updateContact", { expiration: time ?? 0, diff --git a/dist/classes/User.js.map b/dist/classes/User.js.map index d0e5012..41ed4be 100644 --- a/dist/classes/User.js.map +++ b/dist/classes/User.js.map @@ -1 +1 @@ -{"version":3,"file":"User.js","sourceRoot":"","sources":["../../classes/User.ts"],"names":[],"mappings":";;;AAAA,wDA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,oBAmLC"} \ No newline at end of file diff --git a/dist/classes/UserMention.d.ts b/dist/classes/UserMention.d.ts index 130de9b..6841aa0 100644 --- a/dist/classes/UserMention.d.ts +++ b/dist/classes/UserMention.d.ts @@ -1,10 +1,34 @@ import { User } from "./User"; import { IUserResolvable } from "../types/IUserResolvable"; +/** + * A mention of a user in a message + */ export declare class UserMention { + /** + * The user's phone number + */ number: string; + /** + * The user's UUID + */ uuid?: string; + /** + * The start of the mention in the message + */ start: number; + /** + * The length of the mention in the message + */ length?: number; + /** + * @param user - The {@link User} (or {@link IUserResolvable}) to mention + * @param start - Where the mention should start in the message + * @param length - How long the mention should be in the message + * @internal + */ constructor(user: User | IUserResolvable, start?: number, length?: number); + /** + * Convert the mention to a format that can be passed to signal-cli + */ toCLIFormat(): string; } diff --git a/dist/classes/UserMention.js b/dist/classes/UserMention.js index 984bf4d..25b5ea0 100644 --- a/dist/classes/UserMention.js +++ b/dist/classes/UserMention.js @@ -2,13 +2,28 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.UserMention = void 0; const User_1 = require("./User"); +/** + * A mention of a user in a message + */ class UserMention { + /** + * @param user - The {@link User} (or {@link IUserResolvable}) to mention + * @param start - Where the mention should start in the message + * @param length - How long the mention should be in the message + * @internal + */ constructor(user, start, length) { + /** + * The length of the mention in the message + */ this.length = 1; this.number = user instanceof User_1.User ? user.number : user; this.start = start ?? 0; this.length = length ?? 1; } + /** + * Convert the mention to a format that can be passed to signal-cli + */ toCLIFormat() { return this.start + ":" + this.length + ":" + this.number; } diff --git a/dist/classes/UserMention.js.map b/dist/classes/UserMention.js.map index 545b556..4c216ac 100644 --- a/dist/classes/UserMention.js.map +++ b/dist/classes/UserMention.js.map @@ -1 +1 @@ -{"version":3,"file":"UserMention.js","sourceRoot":"","sources":["../../classes/UserMention.ts"],"names":[],"mappings":";;;AAAA,iCAA4B;AAG5B,MAAa,WAAW;IAMpB,YAAY,IAA0B,EAAE,KAAc,EAAE,MAAe;QAFhE,WAAM,GAAY,CAAC,CAAC;QAGvB,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,WAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QACxD,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,CAAC;IAC9B,CAAC;IAEM,WAAW;QACd,OAAO,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9D,CAAC;CACJ;AAfD,kCAeC"} \ No newline at end of file +{"version":3,"file":"UserMention.js","sourceRoot":"","sources":["../../classes/UserMention.ts"],"names":[],"mappings":";;;AAAA,iCAA4B;AAG5B;;GAEG;AACH,MAAa,WAAW;IAqBpB;;;;;OAKG;IACH,YAAY,IAA0B,EAAE,KAAc,EAAE,MAAe;QAXvE;;WAEG;QACI,WAAM,GAAY,CAAC,CAAC;QASvB,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,WAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QACxD,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,WAAW;QACd,OAAO,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9D,CAAC;CACJ;AAvCD,kCAuCC"} \ No newline at end of file diff --git a/dist/enums/ConfigEnvironment.d.ts b/dist/enums/ConfigEnvironment.d.ts index 0104b42..97d87dc 100644 --- a/dist/enums/ConfigEnvironment.d.ts +++ b/dist/enums/ConfigEnvironment.d.ts @@ -1,3 +1,9 @@ +/** + * The server environment the client will use + * + * We don't exactly know what this does, so it's + * probably better if you don't touch it + */ export declare enum ConfigEnvironment { Live = "live", Staging = "staging", diff --git a/dist/enums/ConfigEnvironment.js b/dist/enums/ConfigEnvironment.js index 310b314..c7698bb 100644 --- a/dist/enums/ConfigEnvironment.js +++ b/dist/enums/ConfigEnvironment.js @@ -1,6 +1,12 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigEnvironment = void 0; +/** + * The server environment the client will use + * + * We don't exactly know what this does, so it's + * probably better if you don't touch it + */ var ConfigEnvironment; (function (ConfigEnvironment) { ConfigEnvironment["Live"] = "live"; diff --git a/dist/enums/ConfigEnvironment.js.map b/dist/enums/ConfigEnvironment.js.map index 1ee771b..ce33fda 100644 --- a/dist/enums/ConfigEnvironment.js.map +++ b/dist/enums/ConfigEnvironment.js.map @@ -1 +1 @@ -{"version":3,"file":"ConfigEnvironment.js","sourceRoot":"","sources":["../../enums/ConfigEnvironment.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IACzB,kCAAa,CAAA;IACb,wCAAmB,CAAA;IACnB,wCAAmB,CAAA;AACvB,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B"} \ No newline at end of file +{"version":3,"file":"ConfigEnvironment.js","sourceRoot":"","sources":["../../enums/ConfigEnvironment.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IACzB,kCAAa,CAAA;IACb,wCAAmB,CAAA;IACnB,wCAAmB,CAAA;AACvB,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B"} \ No newline at end of file diff --git a/dist/enums/ConfigTrustLevel.d.ts b/dist/enums/ConfigTrustLevel.d.ts index 51900ad..f4e1862 100644 --- a/dist/enums/ConfigTrustLevel.d.ts +++ b/dist/enums/ConfigTrustLevel.d.ts @@ -1,5 +1,19 @@ +/** + * The amount of trust the client should give to + * contacts + */ export declare enum ConfigTrustLevel { + /** + * Always trust new identities + */ All = "always", + /** + * Trust new identities on first use + * @default + */ OnFirstUse = "on-first-use", + /** + * Never trust new identities + */ None = "never" } diff --git a/dist/enums/ConfigTrustLevel.js b/dist/enums/ConfigTrustLevel.js index b0e868c..525730e 100644 --- a/dist/enums/ConfigTrustLevel.js +++ b/dist/enums/ConfigTrustLevel.js @@ -1,10 +1,24 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigTrustLevel = void 0; +/** + * The amount of trust the client should give to + * contacts + */ var ConfigTrustLevel; (function (ConfigTrustLevel) { + /** + * Always trust new identities + */ ConfigTrustLevel["All"] = "always"; + /** + * Trust new identities on first use + * @default + */ ConfigTrustLevel["OnFirstUse"] = "on-first-use"; + /** + * Never trust new identities + */ ConfigTrustLevel["None"] = "never"; })(ConfigTrustLevel || (exports.ConfigTrustLevel = ConfigTrustLevel = {})); //# sourceMappingURL=ConfigTrustLevel.js.map \ No newline at end of file diff --git a/dist/enums/ConfigTrustLevel.js.map b/dist/enums/ConfigTrustLevel.js.map index add109a..4b4720a 100644 --- a/dist/enums/ConfigTrustLevel.js.map +++ b/dist/enums/ConfigTrustLevel.js.map @@ -1 +1 @@ -{"version":3,"file":"ConfigTrustLevel.js","sourceRoot":"","sources":["../../enums/ConfigTrustLevel.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IACxB,kCAAc,CAAA;IACd,+CAA2B,CAAA;IAC3B,kCAAc,CAAA;AAClB,CAAC,EAJW,gBAAgB,gCAAhB,gBAAgB,QAI3B"} \ No newline at end of file +{"version":3,"file":"ConfigTrustLevel.js","sourceRoot":"","sources":["../../enums/ConfigTrustLevel.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,IAAY,gBAgBX;AAhBD,WAAY,gBAAgB;IACxB;;OAEG;IACH,kCAAc,CAAA;IAEd;;;OAGG;IACH,+CAA2B,CAAA;IAE3B;;OAEG;IACH,kCAAc,CAAA;AAClB,CAAC,EAhBW,gBAAgB,gCAAhB,gBAAgB,QAgB3B"} \ No newline at end of file diff --git a/dist/enums/GroupLinkStatus.d.ts b/dist/enums/GroupLinkStatus.d.ts index a72cede..324c6ec 100644 --- a/dist/enums/GroupLinkStatus.d.ts +++ b/dist/enums/GroupLinkStatus.d.ts @@ -1,5 +1,18 @@ +/** + * The state of a group's invite link + */ export declare enum GroupLinkStatus { + /** + * On + */ Enabled = "enabled", + /** + * On, approve new members + */ WithApproval = "withApproval", + /** + * Off + * @default + */ Disabled = "disabled" } diff --git a/dist/enums/GroupLinkStatus.js b/dist/enums/GroupLinkStatus.js index 05ebf70..45b3307 100644 --- a/dist/enums/GroupLinkStatus.js +++ b/dist/enums/GroupLinkStatus.js @@ -1,10 +1,23 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GroupLinkStatus = void 0; +/** + * The state of a group's invite link + */ var GroupLinkStatus; (function (GroupLinkStatus) { + /** + * On + */ GroupLinkStatus["Enabled"] = "enabled"; + /** + * On, approve new members + */ GroupLinkStatus["WithApproval"] = "withApproval"; + /** + * Off + * @default + */ GroupLinkStatus["Disabled"] = "disabled"; })(GroupLinkStatus || (exports.GroupLinkStatus = GroupLinkStatus = {})); //# sourceMappingURL=GroupLinkStatus.js.map \ No newline at end of file diff --git a/dist/enums/GroupLinkStatus.js.map b/dist/enums/GroupLinkStatus.js.map index b02dac4..9a101b9 100644 --- a/dist/enums/GroupLinkStatus.js.map +++ b/dist/enums/GroupLinkStatus.js.map @@ -1 +1 @@ -{"version":3,"file":"GroupLinkStatus.js","sourceRoot":"","sources":["../../enums/GroupLinkStatus.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAIX;AAJD,WAAY,eAAe;IACvB,sCAAmB,CAAA;IACnB,gDAA6B,CAAA;IAC7B,wCAAqB,CAAA;AACzB,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B"} \ No newline at end of file +{"version":3,"file":"GroupLinkStatus.js","sourceRoot":"","sources":["../../enums/GroupLinkStatus.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,eAgBX;AAhBD,WAAY,eAAe;IACvB;;OAEG;IACH,sCAAmB,CAAA;IAEnB;;OAEG;IACH,gDAA6B,CAAA;IAE7B;;;OAGG;IACH,wCAAqB,CAAA;AACzB,CAAC,EAhBW,eAAe,+BAAf,eAAe,QAgB1B"} \ No newline at end of file diff --git a/dist/enums/GroupPermissionLevel.d.ts b/dist/enums/GroupPermissionLevel.d.ts index 23e0bd0..a42a934 100644 --- a/dist/enums/GroupPermissionLevel.d.ts +++ b/dist/enums/GroupPermissionLevel.d.ts @@ -1,4 +1,14 @@ +/** + * A level for a permission in a group + */ export declare enum GroupPermissionLevel { + /** + * All members + * @default + */ Everyone = "EVERY_MEMBER", + /** + * Only Admins + */ Admins = "ONLY_ADMINS" } diff --git a/dist/enums/GroupPermissionLevel.js b/dist/enums/GroupPermissionLevel.js index adc52f9..b836b44 100644 --- a/dist/enums/GroupPermissionLevel.js +++ b/dist/enums/GroupPermissionLevel.js @@ -1,9 +1,19 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GroupPermissionLevel = void 0; +/** + * A level for a permission in a group + */ var GroupPermissionLevel; (function (GroupPermissionLevel) { + /** + * All members + * @default + */ GroupPermissionLevel["Everyone"] = "EVERY_MEMBER"; + /** + * Only Admins + */ GroupPermissionLevel["Admins"] = "ONLY_ADMINS"; })(GroupPermissionLevel || (exports.GroupPermissionLevel = GroupPermissionLevel = {})); //# sourceMappingURL=GroupPermissionLevel.js.map \ No newline at end of file diff --git a/dist/enums/GroupPermissionLevel.js.map b/dist/enums/GroupPermissionLevel.js.map index 7b38019..aa2ccba 100644 --- a/dist/enums/GroupPermissionLevel.js.map +++ b/dist/enums/GroupPermissionLevel.js.map @@ -1 +1 @@ -{"version":3,"file":"GroupPermissionLevel.js","sourceRoot":"","sources":["../../enums/GroupPermissionLevel.ts"],"names":[],"mappings":";;;AAAA,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC5B,iDAAyB,CAAA;IACzB,8CAAsB,CAAA;AAC1B,CAAC,EAHW,oBAAoB,oCAApB,oBAAoB,QAG/B"} \ No newline at end of file +{"version":3,"file":"GroupPermissionLevel.js","sourceRoot":"","sources":["../../enums/GroupPermissionLevel.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,oBAWX;AAXD,WAAY,oBAAoB;IAC5B;;;OAGG;IACH,iDAAyB,CAAA;IAEzB;;OAEG;IACH,8CAAsB,CAAA;AAC1B,CAAC,EAXW,oBAAoB,oCAApB,oBAAoB,QAW/B"} \ No newline at end of file diff --git a/dist/enums/GroupPermissionName.d.ts b/dist/enums/GroupPermissionName.d.ts index 4962c3e..40ee3be 100644 --- a/dist/enums/GroupPermissionName.d.ts +++ b/dist/enums/GroupPermissionName.d.ts @@ -1,5 +1,17 @@ +/** + * The name of a permission in a group + */ export declare enum GroupPermissionName { + /** + * Who can add members + */ AddMember = "addMember", + /** + * Who can edit group info + */ EditDetails = "editDetails", + /** + * Who can send messages + */ SendMessage = "sendMessage" } diff --git a/dist/enums/GroupPermissionName.js b/dist/enums/GroupPermissionName.js index 812976c..ccdf285 100644 --- a/dist/enums/GroupPermissionName.js +++ b/dist/enums/GroupPermissionName.js @@ -1,10 +1,22 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GroupPermissionName = void 0; +/** + * The name of a permission in a group + */ var GroupPermissionName; (function (GroupPermissionName) { + /** + * Who can add members + */ GroupPermissionName["AddMember"] = "addMember"; + /** + * Who can edit group info + */ GroupPermissionName["EditDetails"] = "editDetails"; + /** + * Who can send messages + */ GroupPermissionName["SendMessage"] = "sendMessage"; })(GroupPermissionName || (exports.GroupPermissionName = GroupPermissionName = {})); //# sourceMappingURL=GroupPermissionName.js.map \ No newline at end of file diff --git a/dist/enums/GroupPermissionName.js.map b/dist/enums/GroupPermissionName.js.map index e72be87..c3f4854 100644 --- a/dist/enums/GroupPermissionName.js.map +++ b/dist/enums/GroupPermissionName.js.map @@ -1 +1 @@ -{"version":3,"file":"GroupPermissionName.js","sourceRoot":"","sources":["../../enums/GroupPermissionName.ts"],"names":[],"mappings":";;;AAAA,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC3B,8CAAuB,CAAA;IACvB,kDAA2B,CAAA;IAC3B,kDAA2B,CAAA;AAC/B,CAAC,EAJW,mBAAmB,mCAAnB,mBAAmB,QAI9B"} \ No newline at end of file +{"version":3,"file":"GroupPermissionName.js","sourceRoot":"","sources":["../../enums/GroupPermissionName.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,mBAeX;AAfD,WAAY,mBAAmB;IAC3B;;OAEG;IACH,8CAAuB,CAAA;IAEvB;;OAEG;IACH,kDAA2B,CAAA;IAE3B;;OAEG;IACH,kDAA2B,CAAA;AAC/B,CAAC,EAfW,mBAAmB,mCAAnB,mBAAmB,QAe9B"} \ No newline at end of file diff --git a/dist/enums/MessageFormattingStyle.d.ts b/dist/enums/MessageFormattingStyle.d.ts index b3cf4b4..a1c595f 100644 --- a/dist/enums/MessageFormattingStyle.d.ts +++ b/dist/enums/MessageFormattingStyle.d.ts @@ -1,3 +1,6 @@ +/** + * A formatting style + */ export declare enum MessageFormattingStyle { Bold = "BOLD", Italic = "ITALIC", diff --git a/dist/enums/MessageFormattingStyle.js b/dist/enums/MessageFormattingStyle.js index 5560b4a..a462e97 100644 --- a/dist/enums/MessageFormattingStyle.js +++ b/dist/enums/MessageFormattingStyle.js @@ -1,6 +1,9 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MessageFormattingStyle = void 0; +/** + * A formatting style + */ var MessageFormattingStyle; (function (MessageFormattingStyle) { MessageFormattingStyle["Bold"] = "BOLD"; diff --git a/dist/enums/MessageFormattingStyle.js.map b/dist/enums/MessageFormattingStyle.js.map index 07734df..1bcc48b 100644 --- a/dist/enums/MessageFormattingStyle.js.map +++ b/dist/enums/MessageFormattingStyle.js.map @@ -1 +1 @@ -{"version":3,"file":"MessageFormattingStyle.js","sourceRoot":"","sources":["../../enums/MessageFormattingStyle.ts"],"names":[],"mappings":";;;AAAA,IAAY,sBAMX;AAND,WAAY,sBAAsB;IAC9B,uCAAa,CAAA;IACb,2CAAiB,CAAA;IACjB,yDAA+B,CAAA;IAC/B,iDAAuB,CAAA;IACvB,6CAAmB,CAAA;AACvB,CAAC,EANW,sBAAsB,sCAAtB,sBAAsB,QAMjC"} \ No newline at end of file +{"version":3,"file":"MessageFormattingStyle.js","sourceRoot":"","sources":["../../enums/MessageFormattingStyle.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,sBAMX;AAND,WAAY,sBAAsB;IAC9B,uCAAa,CAAA;IACb,2CAAiB,CAAA;IACjB,yDAA+B,CAAA;IAC/B,iDAAuB,CAAA;IACvB,6CAAmB,CAAA;AACvB,CAAC,EANW,sBAAsB,sCAAtB,sBAAsB,QAMjC"} \ No newline at end of file diff --git a/dist/enums/MessageReceipt.d.ts b/dist/enums/MessageReceipt.d.ts index b1b55f2..b8ba64c 100644 --- a/dist/enums/MessageReceipt.d.ts +++ b/dist/enums/MessageReceipt.d.ts @@ -1,4 +1,14 @@ +/** + * A type of message receipt + */ export declare enum MessageReceipt { + /** + * The message was read + * @default + */ Read = "read", + /** + * The message was viewed + */ Viewed = "viewed" } diff --git a/dist/enums/MessageReceipt.js b/dist/enums/MessageReceipt.js index acf503d..29ccf3b 100644 --- a/dist/enums/MessageReceipt.js +++ b/dist/enums/MessageReceipt.js @@ -1,9 +1,19 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MessageReceipt = void 0; +/** + * A type of message receipt + */ var MessageReceipt; (function (MessageReceipt) { + /** + * The message was read + * @default + */ MessageReceipt["Read"] = "read"; + /** + * The message was viewed + */ MessageReceipt["Viewed"] = "viewed"; })(MessageReceipt || (exports.MessageReceipt = MessageReceipt = {})); //# sourceMappingURL=MessageReceipt.js.map \ No newline at end of file diff --git a/dist/enums/MessageReceipt.js.map b/dist/enums/MessageReceipt.js.map index d79a54e..1cc8114 100644 --- a/dist/enums/MessageReceipt.js.map +++ b/dist/enums/MessageReceipt.js.map @@ -1 +1 @@ -{"version":3,"file":"MessageReceipt.js","sourceRoot":"","sources":["../../enums/MessageReceipt.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,+BAAa,CAAA;IACb,mCAAiB,CAAA;AACrB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB"} \ No newline at end of file +{"version":3,"file":"MessageReceipt.js","sourceRoot":"","sources":["../../enums/MessageReceipt.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,cAWX;AAXD,WAAY,cAAc;IACtB;;;OAGG;IACH,+BAAa,CAAA;IAEb;;OAEG;IACH,mCAAiB,CAAA;AACrB,CAAC,EAXW,cAAc,8BAAd,cAAc,QAWzB"} \ No newline at end of file diff --git a/dist/enums/StickerSource.d.ts b/dist/enums/StickerSource.d.ts index a0b68c9..75cb499 100644 --- a/dist/enums/StickerSource.d.ts +++ b/dist/enums/StickerSource.d.ts @@ -1,4 +1,13 @@ +/** + * The source a sticker comes from + */ export declare enum StickerSource { + /** + * The sticker was received in a message + */ Received = 0, + /** + * The sticker is part of a sticker pack + */ Pack = 1 } diff --git a/dist/enums/StickerSource.js b/dist/enums/StickerSource.js index 66cb34c..f523d4a 100644 --- a/dist/enums/StickerSource.js +++ b/dist/enums/StickerSource.js @@ -1,9 +1,18 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StickerSource = void 0; +/** + * The source a sticker comes from + */ var StickerSource; (function (StickerSource) { + /** + * The sticker was received in a message + */ StickerSource[StickerSource["Received"] = 0] = "Received"; + /** + * The sticker is part of a sticker pack + */ StickerSource[StickerSource["Pack"] = 1] = "Pack"; })(StickerSource || (exports.StickerSource = StickerSource = {})); //# sourceMappingURL=StickerSource.js.map \ No newline at end of file diff --git a/dist/enums/StickerSource.js.map b/dist/enums/StickerSource.js.map index 9be615c..fd833b4 100644 --- a/dist/enums/StickerSource.js.map +++ b/dist/enums/StickerSource.js.map @@ -1 +1 @@ -{"version":3,"file":"StickerSource.js","sourceRoot":"","sources":["../../enums/StickerSource.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,yDAAQ,CAAA;IACR,iDAAI,CAAA;AACR,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB"} \ No newline at end of file +{"version":3,"file":"StickerSource.js","sourceRoot":"","sources":["../../enums/StickerSource.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,aAUX;AAVD,WAAY,aAAa;IACrB;;OAEG;IACH,yDAAQ,CAAA;IAER;;OAEG;IACH,iDAAI,CAAA;AACR,CAAC,EAVW,aAAa,6BAAb,aAAa,QAUxB"} \ No newline at end of file diff --git a/dist/enums/TypingMessageAction.d.ts b/dist/enums/TypingMessageAction.d.ts index 4d7d860..bfaf92f 100644 --- a/dist/enums/TypingMessageAction.d.ts +++ b/dist/enums/TypingMessageAction.d.ts @@ -1,4 +1,13 @@ +/** + * An action a typing message is reporting + */ export declare enum TypingMessageAction { + /** + * The user has started typing + */ Started = "STARTED", + /** + * The user has stopped typing + */ Stopped = "STOPPED" } diff --git a/dist/enums/TypingMessageAction.js b/dist/enums/TypingMessageAction.js index 912ca7f..ca7a9ea 100644 --- a/dist/enums/TypingMessageAction.js +++ b/dist/enums/TypingMessageAction.js @@ -1,9 +1,18 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TypingMessageAction = void 0; +/** + * An action a typing message is reporting + */ var TypingMessageAction; (function (TypingMessageAction) { + /** + * The user has started typing + */ TypingMessageAction["Started"] = "STARTED"; + /** + * The user has stopped typing + */ TypingMessageAction["Stopped"] = "STOPPED"; })(TypingMessageAction || (exports.TypingMessageAction = TypingMessageAction = {})); //# sourceMappingURL=TypingMessageAction.js.map \ No newline at end of file diff --git a/dist/enums/TypingMessageAction.js.map b/dist/enums/TypingMessageAction.js.map index e2095c4..e9e6d93 100644 --- a/dist/enums/TypingMessageAction.js.map +++ b/dist/enums/TypingMessageAction.js.map @@ -1 +1 @@ -{"version":3,"file":"TypingMessageAction.js","sourceRoot":"","sources":["../../enums/TypingMessageAction.ts"],"names":[],"mappings":";;;AAAA,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC3B,0CAAmB,CAAA;IACnB,0CAAmB,CAAA;AACvB,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B"} \ No newline at end of file +{"version":3,"file":"TypingMessageAction.js","sourceRoot":"","sources":["../../enums/TypingMessageAction.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,mBAUX;AAVD,WAAY,mBAAmB;IAC3B;;OAEG;IACH,0CAAmB,CAAA;IAEnB;;OAEG;IACH,0CAAmB,CAAA;AACvB,CAAC,EAVW,mBAAmB,mCAAnB,mBAAmB,QAU9B"} \ No newline at end of file diff --git a/dist/enums/UserDataType.d.ts b/dist/enums/UserDataType.d.ts index 71bdce7..6f8bdfc 100644 --- a/dist/enums/UserDataType.d.ts +++ b/dist/enums/UserDataType.d.ts @@ -1,7 +1,25 @@ +/** + * The type of data used to construct a {@link User} + */ export declare enum UserDataType { + /** + * From an encrypted message + */ Envelope = 0, + /** + * From a quote inside a message + */ Quote = 1, + /** + * From a reaction message + */ Reaction = 2, + /** + * From a mention or a group user + */ MentionOrGroup = 3, + /** + * From an arbitrary phone number + */ Number = 4 } diff --git a/dist/enums/UserDataType.js b/dist/enums/UserDataType.js index 78dfd35..f59e499 100644 --- a/dist/enums/UserDataType.js +++ b/dist/enums/UserDataType.js @@ -1,12 +1,30 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UserDataType = void 0; +/** + * The type of data used to construct a {@link User} + */ var UserDataType; (function (UserDataType) { + /** + * From an encrypted message + */ UserDataType[UserDataType["Envelope"] = 0] = "Envelope"; + /** + * From a quote inside a message + */ UserDataType[UserDataType["Quote"] = 1] = "Quote"; + /** + * From a reaction message + */ UserDataType[UserDataType["Reaction"] = 2] = "Reaction"; + /** + * From a mention or a group user + */ UserDataType[UserDataType["MentionOrGroup"] = 3] = "MentionOrGroup"; + /** + * From an arbitrary phone number + */ UserDataType[UserDataType["Number"] = 4] = "Number"; })(UserDataType || (exports.UserDataType = UserDataType = {})); //# sourceMappingURL=UserDataType.js.map \ No newline at end of file diff --git a/dist/enums/UserDataType.js.map b/dist/enums/UserDataType.js.map index a873b90..4373837 100644 --- a/dist/enums/UserDataType.js.map +++ b/dist/enums/UserDataType.js.map @@ -1 +1 @@ -{"version":3,"file":"UserDataType.js","sourceRoot":"","sources":["../../enums/UserDataType.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAMX;AAND,WAAY,YAAY;IACpB,uDAAQ,CAAA;IACR,iDAAK,CAAA;IACL,uDAAQ,CAAA;IACR,mEAAc,CAAA;IACd,mDAAM,CAAA;AACV,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB"} \ No newline at end of file +{"version":3,"file":"UserDataType.js","sourceRoot":"","sources":["../../enums/UserDataType.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,YAyBX;AAzBD,WAAY,YAAY;IACpB;;OAEG;IACH,uDAAQ,CAAA;IAER;;OAEG;IACH,iDAAK,CAAA;IAEL;;OAEG;IACH,uDAAQ,CAAA;IAER;;OAEG;IACH,mEAAc,CAAA;IAEd;;OAEG;IACH,mDAAM,CAAA;AACV,CAAC,EAzBW,YAAY,4BAAZ,YAAY,QAyBvB"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts index 69dd4e3..c83f905 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -44,6 +44,7 @@ export { SignalCLIError } from "./classes/SignalCLIError"; export { Sticker } from "./classes/Sticker"; export { StickerMessage } from "./classes/StickerMessage"; export { StickerPack } from "./classes/StickerPack"; +export { TypingMessage } from "./classes/TypingMessage"; export { User } from "./classes/User"; export { UserMention } from "./classes/UserMention"; export { IAttachmentBuilderData } from "./types/IAttachmentBuilderData"; @@ -62,11 +63,9 @@ export { ISystemConfig } from "./types/ISystemConfig"; export { IUserResolvable } from "./types/IUserResolvable"; export { ConfigEnvironment } from "./enums/ConfigEnvironment"; export { ConfigTrustLevel } from "./enums/ConfigTrustLevel"; -export { ConfigVerbosity } from "./enums/ConfigVerbosity"; export { GroupLinkStatus } from "./enums/GroupLinkStatus"; export { GroupPermissionLevel } from "./enums/GroupPermissionLevel"; export { GroupPermissionName } from "./enums/GroupPermissionName"; -export { MessageFormattingFormat } from "./enums/MessageFormattingFormat"; export { MessageFormattingStyle } from "./enums/MessageFormattingStyle"; export { MessageReceipt } from "./enums/MessageReceipt"; export { StickerSource } from "./enums/StickerSource"; diff --git a/dist/index.js b/dist/index.js index 30d6370..b371b16 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.ConfigTrustLevel = exports.ConfigEnvironment = exports.UserMention = exports.User = exports.StickerPack = exports.StickerMessage = exports.Sticker = exports.SignalCLIError = exports.SignalAPIError = exports.SentStickerMessage = exports.SentMessage = exports.SentDataMessage = exports.ReceivedURLPreview = exports.ReceivedMessage = exports.ReactionTarget = exports.ReactionMessage = exports.QuoteMessage = exports.QuoteBuilder = exports.ObjectCache = exports.MessageFormattingRule = exports.MessageFormatting = exports.GroupTypingMessage = exports.GroupStickerMessage = exports.GroupReactionMessage = exports.GroupPermissions = exports.GroupMessage = exports.GroupEditor = exports.GroupEditMessage = exports.GroupDeleteMessage = exports.GroupDataMessage = exports.Group = exports.Emoji = exports.EditMessage = exports.DeleteMessage = exports.DataMessage = exports.DMTypingMessage = exports.DMStickerMessage = exports.DMReactionMessage = exports.DMMessage = exports.DMEditMessage = exports.DMDeleteMessage = exports.DMDataMessage = exports.DM = exports.Client = exports.Channel = exports.CLIEvent = exports.CLIDispatcher = exports.AttachmentSize = exports.AttachmentBuilder = exports.Attachment = void 0; -exports.UserDataType = exports.TypingMessageAction = exports.StickerSource = exports.MessageReceipt = exports.MessageFormattingStyle = exports.MessageFormattingFormat = exports.GroupPermissionName = exports.GroupPermissionLevel = exports.GroupLinkStatus = exports.ConfigVerbosity = void 0; +exports.ConfigEnvironment = exports.UserMention = exports.User = exports.TypingMessage = exports.StickerPack = exports.StickerMessage = exports.Sticker = exports.SignalCLIError = exports.SignalAPIError = exports.SentStickerMessage = exports.SentMessage = exports.SentDataMessage = exports.ReceivedURLPreview = exports.ReceivedMessage = exports.ReactionTarget = exports.ReactionMessage = exports.QuoteMessage = exports.QuoteBuilder = exports.ObjectCache = exports.MessageFormattingRule = exports.MessageFormatting = exports.GroupTypingMessage = exports.GroupStickerMessage = exports.GroupReactionMessage = exports.GroupPermissions = exports.GroupMessage = exports.GroupEditor = exports.GroupEditMessage = exports.GroupDeleteMessage = exports.GroupDataMessage = exports.Group = exports.Emoji = exports.EditMessage = exports.DeleteMessage = exports.DataMessage = exports.DMTypingMessage = exports.DMStickerMessage = exports.DMReactionMessage = exports.DMMessage = exports.DMEditMessage = exports.DMDeleteMessage = exports.DMDataMessage = exports.DM = exports.Client = exports.Channel = exports.CLIEvent = exports.CLIDispatcher = exports.AttachmentSize = exports.AttachmentBuilder = exports.Attachment = void 0; +exports.UserDataType = exports.TypingMessageAction = exports.StickerSource = exports.MessageReceipt = exports.MessageFormattingStyle = exports.GroupPermissionName = exports.GroupPermissionLevel = exports.GroupLinkStatus = exports.ConfigTrustLevel = void 0; // Classes var Attachment_1 = require("./classes/Attachment"); Object.defineProperty(exports, "Attachment", { enumerable: true, get: function () { return Attachment_1.Attachment; } }); @@ -95,6 +95,8 @@ var StickerMessage_1 = require("./classes/StickerMessage"); Object.defineProperty(exports, "StickerMessage", { enumerable: true, get: function () { return StickerMessage_1.StickerMessage; } }); var StickerPack_1 = require("./classes/StickerPack"); Object.defineProperty(exports, "StickerPack", { enumerable: true, get: function () { return StickerPack_1.StickerPack; } }); +var TypingMessage_1 = require("./classes/TypingMessage"); +Object.defineProperty(exports, "TypingMessage", { enumerable: true, get: function () { return TypingMessage_1.TypingMessage; } }); var User_1 = require("./classes/User"); Object.defineProperty(exports, "User", { enumerable: true, get: function () { return User_1.User; } }); var UserMention_1 = require("./classes/UserMention"); @@ -104,16 +106,12 @@ var ConfigEnvironment_1 = require("./enums/ConfigEnvironment"); Object.defineProperty(exports, "ConfigEnvironment", { enumerable: true, get: function () { return ConfigEnvironment_1.ConfigEnvironment; } }); var ConfigTrustLevel_1 = require("./enums/ConfigTrustLevel"); Object.defineProperty(exports, "ConfigTrustLevel", { enumerable: true, get: function () { return ConfigTrustLevel_1.ConfigTrustLevel; } }); -var ConfigVerbosity_1 = require("./enums/ConfigVerbosity"); -Object.defineProperty(exports, "ConfigVerbosity", { enumerable: true, get: function () { return ConfigVerbosity_1.ConfigVerbosity; } }); var GroupLinkStatus_1 = require("./enums/GroupLinkStatus"); Object.defineProperty(exports, "GroupLinkStatus", { enumerable: true, get: function () { return GroupLinkStatus_1.GroupLinkStatus; } }); var GroupPermissionLevel_1 = require("./enums/GroupPermissionLevel"); Object.defineProperty(exports, "GroupPermissionLevel", { enumerable: true, get: function () { return GroupPermissionLevel_1.GroupPermissionLevel; } }); var GroupPermissionName_1 = require("./enums/GroupPermissionName"); Object.defineProperty(exports, "GroupPermissionName", { enumerable: true, get: function () { return GroupPermissionName_1.GroupPermissionName; } }); -var MessageFormattingFormat_1 = require("./enums/MessageFormattingFormat"); -Object.defineProperty(exports, "MessageFormattingFormat", { enumerable: true, get: function () { return MessageFormattingFormat_1.MessageFormattingFormat; } }); var MessageFormattingStyle_1 = require("./enums/MessageFormattingStyle"); Object.defineProperty(exports, "MessageFormattingStyle", { enumerable: true, get: function () { return MessageFormattingStyle_1.MessageFormattingStyle; } }); var MessageReceipt_1 = require("./enums/MessageReceipt"); diff --git a/dist/index.js.map b/dist/index.js.map index 2eff009..e589964 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js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AAsE;AAA9D,gIAAA,sBAAsB,OAAA;AAC9B,yDAAsD;AAA9C,gHAAA,cAAc,OAAA;AACtB,uDAAoD;AAA5C,8GAAA,aAAa,OAAA;AACrB,mEAAgE;AAAxD,0HAAA,mBAAmB,OAAA;AAC3B,qDAAkD;AAA1C,4GAAA,YAAY,OAAA"} \ No newline at end of file diff --git a/dist/types/IAttachmentBuilderData.d.ts b/dist/types/IAttachmentBuilderData.d.ts index fd61f9c..5ab88ee 100644 --- a/dist/types/IAttachmentBuilderData.d.ts +++ b/dist/types/IAttachmentBuilderData.d.ts @@ -1,7 +1,23 @@ /// import { IMimeType } from "./IMimeType"; +/** + * Data used by an {@link AttachmentBuilder} to create + * an {@link Attachment} from an arbitrary Buffer + */ export interface IAttachmentBuilderData { + /** + * The {@link Buffer} to create the Attachment from + */ data: Buffer; + /** + * Optionally, the file type of the {@link Attachment} + * + * If this is unset, it will be sent as binary + * data (application/octet-stream) + */ type?: IMimeType; + /** + * An optional file name for the attachment + */ fileName?: string; } diff --git a/dist/types/ICLIEvent.d.ts b/dist/types/ICLIEvent.d.ts index 31c310f..ea4ba30 100644 --- a/dist/types/ICLIEvent.d.ts +++ b/dist/types/ICLIEvent.d.ts @@ -1,9 +1,35 @@ +/** + * An event received from signal-cli that is not associated + * with any earlier request + */ export interface ICLIEvent { - jsonrpc: string; + jsonrpc: "2.0"; + /** + * The version of JSON-RPC used by signal-cli + */ + /** + * The method used internally to receive this + * event (usually "receive") + */ method: string; + /** + * The data received from the event + */ params: { + /** + * The decrypted message + */ envelope: any; + /** + * The phone number of the account that received the event + */ account: string; + /** + * Undocumented, but we suppose this has something to do with + * the account having a Signal badge or not. + * + * If you know what this does, feel free to edit this + */ subscription: number; }; } diff --git a/dist/types/ICLIRequest.d.ts b/dist/types/ICLIRequest.d.ts index 4f4c5fd..1c8f75f 100644 --- a/dist/types/ICLIRequest.d.ts +++ b/dist/types/ICLIRequest.d.ts @@ -1,8 +1,27 @@ /// import { UUID } from "crypto"; +/** + * A request to be sent to signal-cli + * @internal + */ export interface ICLIRequest { + /** + * The version of JSON-RPC used by signal-cli + */ jsonrpc: "2.0"; + /** + * The method used for the request + * + * A list of the available methods can be accessed + * using `signal-cli --help` + */ method: string; + /** + * The parameters used with this method + * + * All parameters use camelCase instead of the original + * hyphen-format shown in signal-cli + */ params: any; id: UUID; } diff --git a/dist/types/ICLIResponse.d.ts b/dist/types/ICLIResponse.d.ts index 12a8f03..ff4d000 100644 --- a/dist/types/ICLIResponse.d.ts +++ b/dist/types/ICLIResponse.d.ts @@ -1,6 +1,24 @@ +/** + * A response sent by signal-cli + * @internal + */ export interface ICLIResponse { - jsonrpc: string; + /** + * The version of JSON-RPC used by signal-cli + */ + jsonrpc: "2.0"; + /** + * If the request has failed, an error message + */ error?: any; + /** + * One or more (positive) result(s) to the request, if it has + * not failed. + */ result?: any; + /** + * The original ID associated with the request, repeated so that + * the response can be associated with the original request. + */ id: string | null; } diff --git a/dist/types/IChatMessageOptions.d.ts b/dist/types/IChatMessageOptions.d.ts index 9b0ee5b..e32d1d2 100644 --- a/dist/types/IChatMessageOptions.d.ts +++ b/dist/types/IChatMessageOptions.d.ts @@ -2,12 +2,42 @@ import { AttachmentBuilder } from "../classes/AttachmentBuilder"; import { QuoteBuilder } from "../classes/QuoteBuilder"; import { MessageFormatting } from "../classes/MessageFormatting"; import { UserMention } from "../classes/UserMention"; -import { IReceivedMessageURLPreview } from "./IReceivedMessageURLPreview"; +import { ISentMessageURLPreview } from "./ISentMessageURLPreview"; +/** + * Options to be used when sending a message + * to a channel + */ export interface IChatMessageOptions { + /** + * All the attachments to be sent with the message, + * unless they are too large + */ attachments?: AttachmentBuilder[]; + /** + * A quote to add to the message, which should + * reference an older message (see QuoteBuilder) + */ quote?: QuoteBuilder; + /** + * The timestamp of an older message, used only + * internally and only if the new message is an + * edit + */ original?: number; - preview?: IReceivedMessageURLPreview; + /** + * A URL preview to add to the message + */ + preview?: ISentMessageURLPreview; + /** + * Formatting options to add to the message + */ formatting?: MessageFormatting; + /** + * One or more users to mention with this + * message + * + * Note that the text that was where the + * mention(s) is/are will be discarded. + */ mentions?: UserMention[]; } diff --git a/dist/types/IChatMessageURLPreview.d.ts b/dist/types/IChatMessageURLPreview.d.ts index db4718c..24440b3 100644 --- a/dist/types/IChatMessageURLPreview.d.ts +++ b/dist/types/IChatMessageURLPreview.d.ts @@ -1,9 +1,28 @@ import { IFilePath } from "./IFilePath"; import { Attachment } from "../classes/Attachment"; import { IDataURI } from "./IDataURI"; +/** + * A URL preview from a message + */ export interface IChatMessageURLPreview { + /** + * The URL the preview points to + * + * Note that the URL has to be present in the + * message for the preview to show up + */ url: string; + /** + * The title of the page the URL points to + */ title: string; + /** + * An (optional) description of the page the URL + * points to + */ description?: string; + /** + * An image attached to the URL preview, if any + */ image?: IFilePath | Attachment | IDataURI; } diff --git a/dist/types/IConfig.d.ts b/dist/types/IConfig.d.ts index cba1b35..362d82c 100644 --- a/dist/types/IConfig.d.ts +++ b/dist/types/IConfig.d.ts @@ -1,9 +1,8 @@ import { ISystemConfig } from "./ISystemConfig"; import { ConfigTrustLevel } from "../enums/ConfigTrustLevel"; import { ConfigEnvironment } from "../enums/ConfigEnvironment"; -import { ConfigVerbosity } from "../enums/ConfigVerbosity"; /** - * signal.js configuration options + * Signal.js configuration options */ export interface IConfig { /** @@ -53,12 +52,6 @@ export interface IConfig { * `--scrub-log` in signal-cli */ scrubLog?: boolean; - /** - * The amount of data to store in the log files. - * - * `--verbose` in signal-cli - */ - verbose?: ConfigVerbosity; /** * When to trust new identities. * diff --git a/dist/types/IDataURI.d.ts b/dist/types/IDataURI.d.ts index fc468bd..7ea6091 100644 --- a/dist/types/IDataURI.d.ts +++ b/dist/types/IDataURI.d.ts @@ -1,2 +1,6 @@ import { IMimeType } from "./IMimeType"; +/** + * A RFC2397-compliant data: URI + * @interface + */ export type IDataURI = `data:${IMimeType};base64,${string}` | `data:${IMimeType};filename=${string};base64,${string}`; diff --git a/dist/types/IFilePath.d.ts b/dist/types/IFilePath.d.ts index 1bbf34f..6d1425d 100644 --- a/dist/types/IFilePath.d.ts +++ b/dist/types/IFilePath.d.ts @@ -1 +1,4 @@ +/** + * A valid path to a file on the system + */ export type IFilePath = string; diff --git a/dist/types/IMimeType.d.ts b/dist/types/IMimeType.d.ts index 132affd..a70235a 100644 --- a/dist/types/IMimeType.d.ts +++ b/dist/types/IMimeType.d.ts @@ -1 +1,5 @@ +/** + * A valid MIME type + * @interface + */ export type IMimeType = `${"application" | "audio" | "image" | "message" | "multipart" | "text" | "video" | "font" | "example" | "model" | "chemical"}/${string}`; diff --git a/dist/types/IReceivedMessageURLPreview.d.ts b/dist/types/IReceivedMessageURLPreview.d.ts index c0dd3fe..95d5589 100644 --- a/dist/types/IReceivedMessageURLPreview.d.ts +++ b/dist/types/IReceivedMessageURLPreview.d.ts @@ -1,5 +1,11 @@ import { Attachment } from "../classes/Attachment"; import { IChatMessageURLPreview } from "./IChatMessageURLPreview"; +/** + * A URL preview to be sent in a message + */ export interface IReceivedMessageURLPreview extends IChatMessageURLPreview { + /** + * The received image attached to the URL preview + */ image?: Attachment; } diff --git a/dist/types/ISentMessageURLPreview.d.ts b/dist/types/ISentMessageURLPreview.d.ts index 83ca4df..51f7184 100644 --- a/dist/types/ISentMessageURLPreview.d.ts +++ b/dist/types/ISentMessageURLPreview.d.ts @@ -1,6 +1,12 @@ import { IFilePath } from "./IFilePath"; import { IDataURI } from "./IDataURI"; import { IChatMessageURLPreview } from "./IChatMessageURLPreview"; +/** + * A URL preview to be sent in a message + */ export interface ISentMessageURLPreview extends IChatMessageURLPreview { + /** + * A path to a file or valid data: URI + */ image?: IFilePath | IDataURI; } diff --git a/dist/types/ISystemConfig.d.ts b/dist/types/ISystemConfig.d.ts index eefa9d8..da35857 100644 --- a/dist/types/ISystemConfig.d.ts +++ b/dist/types/ISystemConfig.d.ts @@ -1,5 +1,8 @@ /// import { SpawnOptionsWithoutStdio } from "child_process"; +/** + * Configuration options used to configure the process + */ export interface ISystemConfig { /** * Custom options to pass to `child_process.spawn`, use only if you know what you're doing as this WILL break stuff diff --git a/dist/types/IUserResolvable.d.ts b/dist/types/IUserResolvable.d.ts index 4f19eac..e5c8237 100644 --- a/dist/types/IUserResolvable.d.ts +++ b/dist/types/IUserResolvable.d.ts @@ -1 +1,5 @@ +/** + * A valid user phone number + * @interface + */ export type IUserResolvable = `+${number}`; diff --git a/enums/ConfigEnvironment.ts b/enums/ConfigEnvironment.ts index 0e7e9fe..31a2936 100644 --- a/enums/ConfigEnvironment.ts +++ b/enums/ConfigEnvironment.ts @@ -1,3 +1,9 @@ +/** + * The server environment the client will use + * + * We don't exactly know what this does, so it's + * probably better if you don't touch it + */ export enum ConfigEnvironment { Live = "live", Staging = "staging", diff --git a/enums/ConfigTrustLevel.ts b/enums/ConfigTrustLevel.ts index 68e8749..956b64e 100644 --- a/enums/ConfigTrustLevel.ts +++ b/enums/ConfigTrustLevel.ts @@ -1,5 +1,21 @@ +/** + * The amount of trust the client should give to + * contacts + */ export enum ConfigTrustLevel { + /** + * Always trust new identities + */ All = "always", + + /** + * Trust new identities on first use + * @default + */ OnFirstUse = "on-first-use", + + /** + * Never trust new identities + */ None = "never" } \ No newline at end of file diff --git a/enums/ConfigVerbosity.ts b/enums/ConfigVerbosity.ts deleted file mode 100644 index 76bf8fd..0000000 --- a/enums/ConfigVerbosity.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum ConfigVerbosity { - None, - Info, - Notices, - Verbose -} \ No newline at end of file diff --git a/enums/GroupLinkStatus.ts b/enums/GroupLinkStatus.ts index 5b83b80..3b8713f 100644 --- a/enums/GroupLinkStatus.ts +++ b/enums/GroupLinkStatus.ts @@ -1,5 +1,20 @@ +/** + * The state of a group's invite link + */ export enum GroupLinkStatus { + /** + * On + */ Enabled = "enabled", + + /** + * On, approve new members + */ WithApproval = "withApproval", + + /** + * Off + * @default + */ Disabled = "disabled" } \ No newline at end of file diff --git a/enums/GroupPermissionLevel.ts b/enums/GroupPermissionLevel.ts index 1dff84b..6e6cb2d 100644 --- a/enums/GroupPermissionLevel.ts +++ b/enums/GroupPermissionLevel.ts @@ -1,4 +1,15 @@ +/** + * A level for a permission in a group + */ export enum GroupPermissionLevel { + /** + * All members + * @default + */ Everyone = "EVERY_MEMBER", + + /** + * Only Admins + */ Admins = "ONLY_ADMINS" } \ No newline at end of file diff --git a/enums/GroupPermissionName.ts b/enums/GroupPermissionName.ts index 43cdd86..a925c83 100644 --- a/enums/GroupPermissionName.ts +++ b/enums/GroupPermissionName.ts @@ -1,5 +1,19 @@ +/** + * The name of a permission in a group + */ export enum GroupPermissionName { + /** + * Who can add members + */ AddMember = "addMember", + + /** + * Who can edit group info + */ EditDetails = "editDetails", + + /** + * Who can send messages + */ SendMessage = "sendMessage" } \ No newline at end of file diff --git a/enums/MessageFormattingFormat.ts b/enums/MessageFormattingFormat.ts deleted file mode 100644 index d3a0904..0000000 --- a/enums/MessageFormattingFormat.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum MessageFormattingFormat { - Signal, - Markdown -} \ No newline at end of file diff --git a/enums/MessageFormattingStyle.ts b/enums/MessageFormattingStyle.ts index e469da0..8e3b0e8 100644 --- a/enums/MessageFormattingStyle.ts +++ b/enums/MessageFormattingStyle.ts @@ -1,3 +1,6 @@ +/** + * A formatting style + */ export enum MessageFormattingStyle { Bold = "BOLD", Italic = "ITALIC", diff --git a/enums/MessageReceipt.ts b/enums/MessageReceipt.ts index 8e4b96c..2214730 100644 --- a/enums/MessageReceipt.ts +++ b/enums/MessageReceipt.ts @@ -1,4 +1,15 @@ +/** + * A type of message receipt + */ export enum MessageReceipt { + /** + * The message was read + * @default + */ Read = "read", + + /** + * The message was viewed + */ Viewed = "viewed" } \ No newline at end of file diff --git a/enums/StickerSource.ts b/enums/StickerSource.ts index 00d610a..22a46e3 100644 --- a/enums/StickerSource.ts +++ b/enums/StickerSource.ts @@ -1,4 +1,14 @@ +/** + * The source a sticker comes from + */ export enum StickerSource { + /** + * The sticker was received in a message + */ Received, + + /** + * The sticker is part of a sticker pack + */ Pack } \ No newline at end of file diff --git a/enums/TypingMessageAction.ts b/enums/TypingMessageAction.ts index 76c4f95..556ff96 100644 --- a/enums/TypingMessageAction.ts +++ b/enums/TypingMessageAction.ts @@ -1,4 +1,14 @@ +/** + * An action a typing message is reporting + */ export enum TypingMessageAction { + /** + * The user has started typing + */ Started = "STARTED", + + /** + * The user has stopped typing + */ Stopped = "STOPPED" } \ No newline at end of file diff --git a/enums/UserDataType.ts b/enums/UserDataType.ts index c9c141e..b2df3c0 100644 --- a/enums/UserDataType.ts +++ b/enums/UserDataType.ts @@ -1,7 +1,29 @@ +/** + * The type of data used to construct a {@link User} + */ export enum UserDataType { + /** + * From an encrypted message + */ Envelope, + + /** + * From a quote inside a message + */ Quote, + + /** + * From a reaction message + */ Reaction, + + /** + * From a mention or a group user + */ MentionOrGroup, + + /** + * From an arbitrary phone number + */ Number } \ No newline at end of file diff --git a/index.ts b/index.ts index 24f09e3..4965f0e 100644 --- a/index.ts +++ b/index.ts @@ -45,6 +45,7 @@ export {SignalCLIError} from "./classes/SignalCLIError"; export {Sticker} from "./classes/Sticker"; export {StickerMessage} from "./classes/StickerMessage"; export {StickerPack} from "./classes/StickerPack"; +export {TypingMessage} from "./classes/TypingMessage"; export {User} from "./classes/User"; export {UserMention} from "./classes/UserMention"; @@ -67,11 +68,9 @@ export {IUserResolvable} from "./types/IUserResolvable"; // Enums export {ConfigEnvironment} from "./enums/ConfigEnvironment"; export {ConfigTrustLevel} from "./enums/ConfigTrustLevel"; -export {ConfigVerbosity} from "./enums/ConfigVerbosity"; export {GroupLinkStatus} from "./enums/GroupLinkStatus"; export {GroupPermissionLevel} from "./enums/GroupPermissionLevel"; export {GroupPermissionName} from "./enums/GroupPermissionName"; -export {MessageFormattingFormat} from "./enums/MessageFormattingFormat"; export {MessageFormattingStyle} from "./enums/MessageFormattingStyle"; export {MessageReceipt} from "./enums/MessageReceipt"; export {StickerSource} from "./enums/StickerSource"; diff --git a/package.json b/package.json index 78780e1..9765d2f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@equestria.dev/signal.js", - "version": "0.3.0-beta.2", + "version": "0.3.1-beta.0", "description": "An easy-to-use Node.js library for Signal", "main": "dist/index.js", "publishConfig": { @@ -17,6 +17,7 @@ "type": "git", "url": "https://git.equestria.dev/equestria.dev/signal.js" }, + "homepage": "https://signaljs.equestria.dev", "keywords": [ "signal", "signal-cli", diff --git a/types/IAttachmentBuilderData.ts b/types/IAttachmentBuilderData.ts index 43157d7..f6d52a2 100644 --- a/types/IAttachmentBuilderData.ts +++ b/types/IAttachmentBuilderData.ts @@ -1,7 +1,25 @@ import {IMimeType} from "./IMimeType"; +/** + * Data used by an {@link AttachmentBuilder} to create + * an {@link Attachment} from an arbitrary Buffer + */ export interface IAttachmentBuilderData { + /** + * The {@link Buffer} to create the Attachment from + */ data: Buffer; + + /** + * Optionally, the file type of the {@link Attachment} + * + * If this is unset, it will be sent as binary + * data (application/octet-stream) + */ type?: IMimeType; + + /** + * An optional file name for the attachment + */ fileName?: string; } \ No newline at end of file diff --git a/types/ICLIEvent.ts b/types/ICLIEvent.ts index cd5f158..e45eacc 100644 --- a/types/ICLIEvent.ts +++ b/types/ICLIEvent.ts @@ -1,9 +1,39 @@ +/** + * An event received from signal-cli that is not associated + * with any earlier request + */ export interface ICLIEvent { - jsonrpc: string, + jsonrpc: "2.0", + /** + * The version of JSON-RPC used by signal-cli + */ + + /** + * The method used internally to receive this + * event (usually "receive") + */ method: string, + + /** + * The data received from the event + */ params: { + /** + * The decrypted message + */ envelope: any, + + /** + * The phone number of the account that received the event + */ account: string, + + /** + * Undocumented, but we suppose this has something to do with + * the account having a Signal badge or not. + * + * If you know what this does, feel free to edit this + */ subscription: number } } \ No newline at end of file diff --git a/types/ICLIRequest.ts b/types/ICLIRequest.ts index 1eef77f..c714ffd 100644 --- a/types/ICLIRequest.ts +++ b/types/ICLIRequest.ts @@ -1,8 +1,29 @@ import {UUID} from "crypto"; +/** + * A request to be sent to signal-cli + * @internal + */ export interface ICLIRequest { + /** + * The version of JSON-RPC used by signal-cli + */ jsonrpc: "2.0", + + /** + * The method used for the request + * + * A list of the available methods can be accessed + * using `signal-cli --help` + */ method: string, + + /** + * The parameters used with this method + * + * All parameters use camelCase instead of the original + * hyphen-format shown in signal-cli + */ params: any, id: UUID } \ No newline at end of file diff --git a/types/ICLIResponse.ts b/types/ICLIResponse.ts index 1e29e2f..3de8421 100644 --- a/types/ICLIResponse.ts +++ b/types/ICLIResponse.ts @@ -1,6 +1,27 @@ +/** + * A response sent by signal-cli + * @internal + */ export interface ICLIResponse { - jsonrpc: string, + /** + * The version of JSON-RPC used by signal-cli + */ + jsonrpc: "2.0", + + /** + * If the request has failed, an error message + */ error?: any, + + /** + * One or more (positive) result(s) to the request, if it has + * not failed. + */ result?: any, + + /** + * The original ID associated with the request, repeated so that + * the response can be associated with the original request. + */ id: string|null, } \ No newline at end of file diff --git a/types/IChatMessageOptions.ts b/types/IChatMessageOptions.ts index 8ea3939..b044b2a 100644 --- a/types/IChatMessageOptions.ts +++ b/types/IChatMessageOptions.ts @@ -4,12 +4,48 @@ import {IChatMessageURLPreview} from "./IChatMessageURLPreview"; import {MessageFormatting} from "../classes/MessageFormatting"; import {UserMention} from "../classes/UserMention"; import {IReceivedMessageURLPreview} from "./IReceivedMessageURLPreview"; +import {ISentMessageURLPreview} from "./ISentMessageURLPreview"; +/** + * Options to be used when sending a message + * to a channel + */ export interface IChatMessageOptions { + /** + * All the attachments to be sent with the message, + * unless they are too large + */ attachments?: AttachmentBuilder[]; + + /** + * A quote to add to the message, which should + * reference an older message (see QuoteBuilder) + */ quote?: QuoteBuilder; + + /** + * The timestamp of an older message, used only + * internally and only if the new message is an + * edit + */ original?: number; - preview?: IReceivedMessageURLPreview; + + /** + * A URL preview to add to the message + */ + preview?: ISentMessageURLPreview; + + /** + * Formatting options to add to the message + */ formatting?: MessageFormatting; + + /** + * One or more users to mention with this + * message + * + * Note that the text that was where the + * mention(s) is/are will be discarded. + */ mentions?: UserMention[]; } \ No newline at end of file diff --git a/types/IChatMessageURLPreview.ts b/types/IChatMessageURLPreview.ts index 1c63a2b..1413daf 100644 --- a/types/IChatMessageURLPreview.ts +++ b/types/IChatMessageURLPreview.ts @@ -2,9 +2,31 @@ import {IFilePath} from "./IFilePath"; import {Attachment} from "../classes/Attachment"; import {IDataURI} from "./IDataURI"; +/** + * A URL preview from a message + */ export interface IChatMessageURLPreview { + /** + * The URL the preview points to + * + * Note that the URL has to be present in the + * message for the preview to show up + */ url: string; + + /** + * The title of the page the URL points to + */ title: string; + + /** + * An (optional) description of the page the URL + * points to + */ description?: string; + + /** + * An image attached to the URL preview, if any + */ image?: IFilePath|Attachment|IDataURI; } \ No newline at end of file diff --git a/types/IConfig.ts b/types/IConfig.ts index 439da1a..f702a04 100644 --- a/types/IConfig.ts +++ b/types/IConfig.ts @@ -1,10 +1,9 @@ import {ISystemConfig} from "./ISystemConfig"; import {ConfigTrustLevel} from "../enums/ConfigTrustLevel"; import {ConfigEnvironment} from "../enums/ConfigEnvironment"; -import {ConfigVerbosity} from "../enums/ConfigVerbosity"; /** - * signal.js configuration options + * Signal.js configuration options */ export interface IConfig { /** @@ -61,13 +60,6 @@ export interface IConfig { */ scrubLog?: boolean - /** - * The amount of data to store in the log files. - * - * `--verbose` in signal-cli - */ - verbose?: ConfigVerbosity, - /** * When to trust new identities. * diff --git a/types/IDataURI.ts b/types/IDataURI.ts index 7010c1e..9f3ce79 100644 --- a/types/IDataURI.ts +++ b/types/IDataURI.ts @@ -1,3 +1,7 @@ import {IMimeType} from "./IMimeType"; +/** + * A RFC2397-compliant data: URI + * @interface + */ export type IDataURI = `data:${IMimeType};base64,${string}`|`data:${IMimeType};filename=${string};base64,${string}`; \ No newline at end of file diff --git a/types/IFilePath.ts b/types/IFilePath.ts index f5d20a9..d3b95f4 100644 --- a/types/IFilePath.ts +++ b/types/IFilePath.ts @@ -1 +1,4 @@ +/** + * A valid path to a file on the system + */ export type IFilePath = string; \ No newline at end of file diff --git a/types/IMimeType.ts b/types/IMimeType.ts index 607443f..c75b47d 100644 --- a/types/IMimeType.ts +++ b/types/IMimeType.ts @@ -1 +1,5 @@ +/** + * A valid MIME type + * @interface + */ export type IMimeType = `${"application"|"audio"|"image"|"message"|"multipart"|"text"|"video"|"font"|"example"|"model"|"chemical"}/${string}`; \ No newline at end of file diff --git a/types/IReceivedMessageURLPreview.ts b/types/IReceivedMessageURLPreview.ts index 4521ffa..1739674 100644 --- a/types/IReceivedMessageURLPreview.ts +++ b/types/IReceivedMessageURLPreview.ts @@ -3,6 +3,12 @@ import {Attachment} from "../classes/Attachment"; import {IDataURI} from "./IDataURI"; import {IChatMessageURLPreview} from "./IChatMessageURLPreview"; +/** + * A URL preview to be sent in a message + */ export interface IReceivedMessageURLPreview extends IChatMessageURLPreview { + /** + * The received image attached to the URL preview + */ image?: Attachment; } \ No newline at end of file diff --git a/types/ISentMessageURLPreview.ts b/types/ISentMessageURLPreview.ts index cd68607..945b04c 100644 --- a/types/ISentMessageURLPreview.ts +++ b/types/ISentMessageURLPreview.ts @@ -3,6 +3,12 @@ import {Attachment} from "../classes/Attachment"; import {IDataURI} from "./IDataURI"; import {IChatMessageURLPreview} from "./IChatMessageURLPreview"; +/** + * A URL preview to be sent in a message + */ export interface ISentMessageURLPreview extends IChatMessageURLPreview { + /** + * A path to a file or valid data: URI + */ image?: IFilePath|IDataURI; } \ No newline at end of file diff --git a/types/ISystemConfig.ts b/types/ISystemConfig.ts index eb8ef74..8b4bc25 100644 --- a/types/ISystemConfig.ts +++ b/types/ISystemConfig.ts @@ -1,5 +1,8 @@ import {SpawnOptionsWithoutStdio} from "child_process"; +/** + * Configuration options used to configure the process + */ export interface ISystemConfig { /** * Custom options to pass to `child_process.spawn`, use only if you know what you're doing as this WILL break stuff diff --git a/types/IUserResolvable.ts b/types/IUserResolvable.ts index 5710755..a2801f7 100644 --- a/types/IUserResolvable.ts +++ b/types/IUserResolvable.ts @@ -1 +1,5 @@ +/** + * A valid user phone number + * @interface + */ export type IUserResolvable = `+${number}` \ No newline at end of file -- cgit