Skip to content

Commit

Permalink
refactor: use ESM import file extension syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
domwebber committed Jan 3, 2024
1 parent ec8c018 commit dc7cf17
Show file tree
Hide file tree
Showing 110 changed files with 226 additions and 223 deletions.
4 changes: 2 additions & 2 deletions src/API/AbstractAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import { AccountID } from "../ID";
import APIInterface from "./APIInterface";
import { AccountID } from "../ID.js";
import APIInterface from "./APIInterface.js";
import { randomBytes } from "crypto";
import type { Logger } from "winston";

Expand Down
28 changes: 15 additions & 13 deletions src/CloudAPI/CloudAPIMessage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import AbstractAPI, { AbstractAPIParams } from "../../API/AbstractAPI";
import EndpointType from "../../API/EndpointType";
import GraphRequest, { GraphRequestCreateParams } from "../../GraphRequest";
import CloudOutgoingMessageContact from "../../Message/Contact/MessageContact/CloudOutgoingMessageContact";
import CloudOutgoingMessageInteractive from "../../Message/Interactive/MessageInteractive/Outgoing/CloudOutgoingMessageInteractive";
import CloudOutgoingMessageLocation from "../../Message/Location/MessageLocation/Outgoing/CloudOutgoingMessageLocation";
import CloudOutgoingMessageMedia from "../../Message/MessageMedia/CloudOutgoingMessageMedia";
import OutgoingMessageType from "../../Message/MessageType/OutgoingMessageType";
import AbstractAPI, { AbstractAPIParams } from "../../API/AbstractAPI.js";
import EndpointType from "../../API/EndpointType.js";
import GraphRequest, {
GraphRequestCreateParams,
} from "../../GraphRequest/index.js";
import CloudOutgoingMessageContact from "../../Message/Contact/MessageContact/CloudOutgoingMessageContact.js";
import CloudOutgoingMessageInteractive from "../../Message/Interactive/MessageInteractive/Outgoing/CloudOutgoingMessageInteractive.js";
import CloudOutgoingMessageLocation from "../../Message/Location/MessageLocation/Outgoing/CloudOutgoingMessageLocation.js";
import CloudOutgoingMessageMedia from "../../Message/MessageMedia/CloudOutgoingMessageMedia.js";
import OutgoingMessageType from "../../Message/MessageType/OutgoingMessageType.js";
import CloudOutgoingMessage, {
CloudOutgoingMessageResponse,
} from "../../Message/OutgoingMessage/CloudOutgoingMessage";
import CloudOutgoingMessageStatus from "../../Message/Status/MessageStatus/Outgoing/CloudOutgoingMessageStatus";
import CloudOutgoingStatusMessage from "../../Message/Status/StatusMessage/CloudOutgoingStatusMessage";
import CloudOutgoingMessageTemplate from "../../Message/Template/MessageTemplate/Outgoing/CloudOutgoingMessageTemplate";
import CloudOutgoingMessageText from "../../Message/Text/MessageText/Outgoing/CloudOutgoingMessageText";
} from "../../Message/OutgoingMessage/CloudOutgoingMessage.js";
import CloudOutgoingMessageStatus from "../../Message/Status/MessageStatus/Outgoing/CloudOutgoingMessageStatus.js";
import CloudOutgoingStatusMessage from "../../Message/Status/StatusMessage/CloudOutgoingStatusMessage.js";
import CloudOutgoingMessageTemplate from "../../Message/Template/MessageTemplate/Outgoing/CloudOutgoingMessageTemplate.js";
import CloudOutgoingMessageText from "../../Message/Text/MessageText/Outgoing/CloudOutgoingMessageText.js";

type CreateMessagePayload =
| CloudOutgoingMessageMedia
Expand Down
6 changes: 3 additions & 3 deletions src/CloudAPI/CloudAPIWebhook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import AbstractAPI from "../../API/AbstractAPI";
import { EventNotificationType } from "../../EventNotification";
import CloudAPIWebhookError from "./CloudWebhookAPIError";
import AbstractAPI from "../../API/AbstractAPI.js";
import { EventNotificationType } from "../../EventNotification/index.js";
import CloudAPIWebhookError from "./CloudWebhookAPIError.js";
import { createHmac } from "crypto";
import { IncomingMessage, ServerResponse } from "http";

Expand Down
8 changes: 4 additions & 4 deletions src/CloudAPI/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import AbstractAPI, { AbstractAPIParams } from "../API/AbstractAPI";
import CloudAPIInvalidParamError from "./CloudAPIInvalidParamError";
import AbstractAPI, { AbstractAPIParams } from "../API/AbstractAPI.js";
import CloudAPIInvalidParamError from "./CloudAPIInvalidParamError.js";
import CloudAPIMessage, {
CloudAPIMessageParams as BaseCloudAPIMessageParams,
} from "./CloudAPIMessage";
import CloudAPIWebhook from "./CloudAPIWebhook";
} from "./CloudAPIMessage/index.js";
import CloudAPIWebhook from "./CloudAPIWebhook/index.js";

export interface WhatsAppAPIParams extends AbstractAPIParams {}

Expand Down
2 changes: 1 addition & 1 deletion src/Error/EventNotificationError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import Error, { ErrorMessage } from ".";
import Error, { ErrorMessage } from "./index.js";

export default interface EventNotificationError extends Error {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/Error/IncomingMessageError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import Error, { ErrorMessage } from ".";
import Error, { ErrorMessage } from "./index.js";

export default interface IncomingMessageError extends Error {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/Error/OutgoingMessageError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import Error from ".";
import Error from "./index.js";

export default interface OutgoingMessageError extends Error {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/EventNotification/EventNotificationContact.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AccountID } from "../ID";
import { AccountID } from "../ID.js";

/**
* WhatsApp NodeJS SDK.
Expand Down
2 changes: 1 addition & 1 deletion src/EventNotification/EventNotificationMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import { WhatsAppPhoneNumberID } from "../ID";
import { WhatsAppPhoneNumberID } from "../ID.js";

export default interface EventNotificationMetadata {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/EventNotification/EventNotificationStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import { AccountID, MessageID } from "../ID";
import { AccountID, MessageID } from "../ID.js";

export enum EventNotificationStatusReason {
/**
Expand Down
22 changes: 11 additions & 11 deletions src/EventNotification/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import EventNotificationError from "../Error/EventNotificationError";
import { AccountID } from "../ID";
import CloudIncomingAudioMessage from "../Message/Audio/AudioMessage/CloudIncomingAudioMessage";
import CloudIncomingDocumentMessage from "../Message/Document/DocumentMessage/CloudIncomingDocumentMessage";
import CloudIncomingImageMessage from "../Message/Image/ImageMessage/CloudIncomingImageMessage";
import CloudIncomingStickerMessage from "../Message/Sticker/StickerMessage/CloudIncomingStickerMessage";
import CloudIncomingTextMessage from "../Message/Text/TextMessage/CloudIncomingTextMessage";
import CloudIncomingVideoMessage from "../Message/Video/VideoMessage/CloudIncomingVideoMessage";
import EventNotificationContact from "./EventNotificationContact";
import EventNotificationMetadata from "./EventNotificationMetadata";
import EventNotificationStatus from "./EventNotificationStatus";
import EventNotificationError from "../Error/EventNotificationError.js";
import { AccountID } from "../ID.js";
import CloudIncomingAudioMessage from "../Message/Audio/AudioMessage/CloudIncomingAudioMessage.js";
import CloudIncomingDocumentMessage from "../Message/Document/DocumentMessage/CloudIncomingDocumentMessage.js";
import CloudIncomingImageMessage from "../Message/Image/ImageMessage/CloudIncomingImageMessage.js";
import CloudIncomingStickerMessage from "../Message/Sticker/StickerMessage/CloudIncomingStickerMessage.js";
import CloudIncomingTextMessage from "../Message/Text/TextMessage/CloudIncomingTextMessage.js";
import CloudIncomingVideoMessage from "../Message/Video/VideoMessage/CloudIncomingVideoMessage.js";
import EventNotificationContact from "./EventNotificationContact.js";
import EventNotificationMetadata from "./EventNotificationMetadata.js";
import EventNotificationStatus from "./EventNotificationStatus.js";

export type EventNotificationChangeValueMessage =
| CloudIncomingAudioMessage
Expand Down
4 changes: 2 additions & 2 deletions src/GraphRequest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import EndpointType from "../API/EndpointType";
import GraphResponse from "../GraphResponse";
import EndpointType from "../API/EndpointType.js";
import GraphResponse from "../GraphResponse/index.js";

export interface GraphRequestCreateParams extends RequestInit {
endpoint?: EndpointType;
Expand Down
6 changes: 3 additions & 3 deletions src/Message/Audio/AudioMessage/CloudIncomingAudioMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import CloudIncomingMessage from "../../IncomingMessage/CloudIncomingMessage";
import IncomingMessageType from "../../MessageType/IncomingMessageType";
import CloudIncomingMessageAudio from "../MessageAudio/CloudIncomingMessageAudio";
import CloudIncomingMessage from "../../IncomingMessage/CloudIncomingMessage.js";
import IncomingMessageType from "../../MessageType/IncomingMessageType.js";
import CloudIncomingMessageAudio from "../MessageAudio/CloudIncomingMessageAudio.js";

type CloudIncomingAudioMessage =
CloudIncomingMessage<IncomingMessageType.Audio> & {
Expand Down
6 changes: 3 additions & 3 deletions src/Message/Audio/AudioMessage/CloudOutgoingAudioMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import OutgoingMessageType from "../../MessageType/OutgoingMessageType";
import CloudOutgoingMessage from "../../OutgoingMessage/CloudOutgoingMessage";
import CloudOutgoingMessageAudio from "../MessageAudio/CloudOutgoingMessageAudio";
import OutgoingMessageType from "../../MessageType/OutgoingMessageType.js";
import CloudOutgoingMessage from "../../OutgoingMessage/CloudOutgoingMessage.js";
import CloudOutgoingMessageAudio from "../MessageAudio/CloudOutgoingMessageAudio.js";

type CloudOutgoingAudioMessage =
CloudOutgoingMessage<OutgoingMessageType.Audio> & {
Expand Down
6 changes: 3 additions & 3 deletions src/Message/Audio/AudioMessage/HostedOutgoingAudioMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import OutgoingMessageType from "../../MessageType/OutgoingMessageType";
import HostedOutgoingMessage from "../../OutgoingMessage/HostedOutgoingMessage";
import HostedOutgoingMessageAudio from "../MessageAudio/HostedOutgoingMessageAudio";
import OutgoingMessageType from "../../MessageType/OutgoingMessageType.js";
import HostedOutgoingMessage from "../../OutgoingMessage/HostedOutgoingMessage.js";
import HostedOutgoingMessageAudio from "../MessageAudio/HostedOutgoingMessageAudio.js";

type HostedOutgoingAudioMessage =
HostedOutgoingMessage<OutgoingMessageType.Audio> & {
Expand Down
4 changes: 2 additions & 2 deletions src/Message/Audio/MessageAudio/CloudIncomingMessageAudio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import CloudIncomingMessageMedia from "../../MessageMedia/CloudIncomingMessageMedia";
import IncomingMessageAudio from "./IncomingMessageAudio";
import CloudIncomingMessageMedia from "../../MessageMedia/CloudIncomingMessageMedia.js";
import IncomingMessageAudio from "./IncomingMessageAudio.js";

export default interface CloudIncomingMessageAudio
extends CloudIncomingMessageMedia,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import CloudOutgoingMessageMedia from "../../MessageMedia/CloudOutgoingMessageMedia";
import CloudOutgoingMessageMedia from "../../MessageMedia/CloudOutgoingMessageMedia.js";

export default interface CloudOutgoingMessageAudio
extends CloudOutgoingMessageMedia {}
4 changes: 2 additions & 2 deletions src/Message/Audio/MessageAudio/HostedIncomingMessageAudio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import HostedIncomingMessageMedia from "../../MessageMedia/HostedIncomingMessageMedia";
import IncomingMessageAudio from "./IncomingMessageAudio";
import HostedIncomingMessageMedia from "../../MessageMedia/HostedIncomingMessageMedia.js";
import IncomingMessageAudio from "./IncomingMessageAudio.js";

export default interface HostedIncomingMessageAudio
extends HostedIncomingMessageMedia,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import HostedOutgoingMessageMedia from "../../MessageMedia/HostedOutgoingMessageMedia";
import HostedOutgoingMessageMedia from "../../MessageMedia/HostedOutgoingMessageMedia.js";

export default interface HostedOutgoingMessageAudio
extends HostedOutgoingMessageMedia {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import OutgoingMessageType from "../../MessageType/OutgoingMessageType";
import CloudOutgoingMessage from "../../OutgoingMessage/CloudOutgoingMessage";
import CloudOutgoingMessageContact from "../MessageContact/CloudOutgoingMessageContact";
import OutgoingMessageType from "../../MessageType/OutgoingMessageType.js";
import CloudOutgoingMessage from "../../OutgoingMessage/CloudOutgoingMessage.js";
import CloudOutgoingMessageContact from "../MessageContact/CloudOutgoingMessageContact.js";

type CloudOutgoingContactMessage =
CloudOutgoingMessage<OutgoingMessageType.Contacts> & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import OutgoingMessageType from "../../MessageType/OutgoingMessageType";
import HostedOutgoingMessage from "../../OutgoingMessage/HostedOutgoingMessage";
import HostedOutgoingMessageContact from "../MessageContact/HostedOutgoingMessageContact";
import OutgoingMessageType from "../../MessageType/OutgoingMessageType.js";
import HostedOutgoingMessage from "../../OutgoingMessage/HostedOutgoingMessage.js";
import HostedOutgoingMessageContact from "../MessageContact/HostedOutgoingMessageContact.js";

type HostedOutgoingContactMessage =
HostedOutgoingMessage<OutgoingMessageType.Contacts> & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import OutgoingMessageContact from "./OutgoingMessageContact";
import OutgoingMessageContact from "./OutgoingMessageContact.js";

export default interface CloudOutgoingMessageContact
extends OutgoingMessageContact {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import OutgoingMessageContact from "./OutgoingMessageContact";
import OutgoingMessageContact from "./OutgoingMessageContact.js";

export default interface HostedOutgoingMessageContact
extends OutgoingMessageContact {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import MessageContact from ".";
import MessageContact from "./index.js";

export default interface OutgoingMessageContact extends MessageContact {}
2 changes: 1 addition & 1 deletion src/Message/Contact/MessageContact/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import { PhoneNumber, AccountID } from "../../../ID";
import { PhoneNumber, AccountID } from "../../../ID.js";

type MessageContactDetailType =
| "HOME"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import CloudIncomingMessage from "../../IncomingMessage/CloudIncomingMessage";
import IncomingMessageType from "../../MessageType/IncomingMessageType";
import CloudIncomingMessageDocument from "../MessageDocument/Incoming/CloudIncomingMessageDocument";
import CloudIncomingMessage from "../../IncomingMessage/CloudIncomingMessage.js";
import IncomingMessageType from "../../MessageType/IncomingMessageType.js";
import CloudIncomingMessageDocument from "../MessageDocument/Incoming/CloudIncomingMessageDocument.js";

type CloudIncomingDocumentMessage =
CloudIncomingMessage<IncomingMessageType.Document> & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import OutgoingMessageType from "../../MessageType/OutgoingMessageType";
import CloudOutgoingMessage from "../../OutgoingMessage/CloudOutgoingMessage";
import CloudOutgoingMessageDocument from "../MessageDocument/Outgoing/CloudOutgoingMessageDocument";
import OutgoingMessageType from "../../MessageType/OutgoingMessageType.js";
import CloudOutgoingMessage from "../../OutgoingMessage/CloudOutgoingMessage.js";
import CloudOutgoingMessageDocument from "../MessageDocument/Outgoing/CloudOutgoingMessageDocument.js";

type CloudOutgoingDocumentMessage =
CloudOutgoingMessage<OutgoingMessageType.Document> & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import OutgoingMessageType from "../../MessageType/OutgoingMessageType";
import HostedOutgoingMessage from "../../OutgoingMessage/HostedOutgoingMessage";
import HostedOutgoingMessageDocument from "../MessageDocument/Outgoing/HostedOutgoingMessageDocument";
import OutgoingMessageType from "../../MessageType/OutgoingMessageType.js";
import HostedOutgoingMessage from "../../OutgoingMessage/HostedOutgoingMessage.js";
import HostedOutgoingMessageDocument from "../MessageDocument/Outgoing/HostedOutgoingMessageDocument.js";

type HostedOutgoingDocumentMessage =
HostedOutgoingMessage<OutgoingMessageType.Document> & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import CloudIncomingMessageMedia from "../../../MessageMedia/CloudIncomingMessageMedia";
import IncomingMessageDocument from "../Incoming/IncomingMessageDocument";
import CloudIncomingMessageMedia from "../../../MessageMedia/CloudIncomingMessageMedia.js";
import IncomingMessageDocument from "../Incoming/IncomingMessageDocument.js";

export default interface CloudIncomingMessageDocument
extends CloudIncomingMessageMedia,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import HostedIncomingMessageMedia from "../../../MessageMedia/HostedIncomingMessageMedia";
import IncomingMessageDocument from "./IncomingMessageDocument";
import HostedIncomingMessageMedia from "../../../MessageMedia/HostedIncomingMessageMedia.js";
import IncomingMessageDocument from "./IncomingMessageDocument.js";

export default interface HostedInterfaceMessageDocument
extends HostedIncomingMessageMedia,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import MessageDocument from "..";
import MessageDocument from "../index.js";

export default interface IncomingMessageDocument extends MessageDocument {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* @author Dom Webber <[email protected]>
* @see https://greatdetail.com
*/
import CloudOutgoingMessageMedia from "../../../MessageMedia/CloudOutgoingMessageMedia";
import OutgoingMessageDocument from "./OutgoingMessageDocument";
import CloudOutgoingMessageMedia from "../../../MessageMedia/CloudOutgoingMessageMedia.js";
import OutgoingMessageDocument from "./OutgoingMessageDocument.js";

export default interface CloudOutgoingMessageDocument
extends CloudOutgoingMessageMedia,
Expand Down
Loading

0 comments on commit dc7cf17

Please sign in to comment.