tonightpass 0.0.178 → 0.0.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +162 -1
- package/dist/index.d.ts +162 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.d.mts
CHANGED
|
@@ -1442,6 +1442,11 @@ declare class TonightPass {
|
|
|
1442
1442
|
reportByOrganization: (organizationSlug: string, channelId: string, messageId: string, data: ReportChannelMessageDto) => Promise<void>;
|
|
1443
1443
|
};
|
|
1444
1444
|
};
|
|
1445
|
+
readonly currencies: {
|
|
1446
|
+
getRates: () => Promise<ExchangeRates>;
|
|
1447
|
+
convert: (conversion: CurrencyConversion) => Promise<CurrencyConversionResult>;
|
|
1448
|
+
convertAmount: (from: Currency, to: Currency, amount: number) => Promise<CurrencyConversionResult>;
|
|
1449
|
+
};
|
|
1445
1450
|
readonly health: {
|
|
1446
1451
|
getAll: () => Promise<Health<"database" | "app" | "api">>;
|
|
1447
1452
|
database: () => Promise<Health<"database">>;
|
|
@@ -1558,4 +1563,160 @@ declare class TonightPass {
|
|
|
1558
1563
|
declare const isBrowser: boolean;
|
|
1559
1564
|
declare function buildFileFormData(key: string, files: File | File[] | FileList): FormData;
|
|
1560
1565
|
|
|
1561
|
-
|
|
1566
|
+
interface ChannelMessageCreateEvent extends WebSocketEvent<ChannelMessage> {
|
|
1567
|
+
type: "channel_message_create";
|
|
1568
|
+
}
|
|
1569
|
+
interface ChannelMessageUpdateEvent extends WebSocketEvent<ChannelMessage> {
|
|
1570
|
+
type: "channel_message_update";
|
|
1571
|
+
}
|
|
1572
|
+
interface ChannelMessageDeleteEvent extends WebSocketEvent<{
|
|
1573
|
+
id: string;
|
|
1574
|
+
channelId: string;
|
|
1575
|
+
}> {
|
|
1576
|
+
type: "channel_message_delete";
|
|
1577
|
+
}
|
|
1578
|
+
interface ChannelUpdateEvent extends WebSocketEvent<Channel> {
|
|
1579
|
+
type: "channel_update";
|
|
1580
|
+
}
|
|
1581
|
+
interface ChannelDeleteEvent extends WebSocketEvent<{
|
|
1582
|
+
id: string;
|
|
1583
|
+
}> {
|
|
1584
|
+
type: "channel_delete";
|
|
1585
|
+
}
|
|
1586
|
+
interface ChannelMemberJoinEvent extends WebSocketEvent<{
|
|
1587
|
+
channel: Channel;
|
|
1588
|
+
user: User;
|
|
1589
|
+
}> {
|
|
1590
|
+
type: "channel_member_join";
|
|
1591
|
+
}
|
|
1592
|
+
interface ChannelMemberLeaveEvent extends WebSocketEvent<{
|
|
1593
|
+
channelId: string;
|
|
1594
|
+
userId: string;
|
|
1595
|
+
}> {
|
|
1596
|
+
type: "channel_member_leave";
|
|
1597
|
+
}
|
|
1598
|
+
interface TypingStartEvent extends WebSocketEvent<{
|
|
1599
|
+
channelId: string;
|
|
1600
|
+
userId: string;
|
|
1601
|
+
username: string;
|
|
1602
|
+
}> {
|
|
1603
|
+
type: "typing_start";
|
|
1604
|
+
}
|
|
1605
|
+
interface TypingStopEvent extends WebSocketEvent<{
|
|
1606
|
+
channelId: string;
|
|
1607
|
+
userId: string;
|
|
1608
|
+
}> {
|
|
1609
|
+
type: "typing_stop";
|
|
1610
|
+
}
|
|
1611
|
+
type ChannelWebSocketEvent = ChannelMessageCreateEvent | ChannelMessageUpdateEvent | ChannelMessageDeleteEvent | ChannelUpdateEvent | ChannelDeleteEvent | ChannelMemberJoinEvent | ChannelMemberLeaveEvent | TypingStartEvent | TypingStopEvent;
|
|
1612
|
+
|
|
1613
|
+
interface WebSocketEvent<T = unknown> {
|
|
1614
|
+
type: string;
|
|
1615
|
+
data: T;
|
|
1616
|
+
}
|
|
1617
|
+
interface WebSocketConnectOptions {
|
|
1618
|
+
token?: string;
|
|
1619
|
+
channelId?: string;
|
|
1620
|
+
organizationSlug?: string;
|
|
1621
|
+
}
|
|
1622
|
+
interface WebSocketClientOptions {
|
|
1623
|
+
baseURL: string;
|
|
1624
|
+
reconnectInterval?: number;
|
|
1625
|
+
maxReconnectAttempts?: number;
|
|
1626
|
+
debug?: boolean;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
type GETEndpoints = Extract<Endpoints, {
|
|
1630
|
+
method: "GET";
|
|
1631
|
+
}>;
|
|
1632
|
+
type RESTEndpointPaths = GETEndpoints["path"];
|
|
1633
|
+
type WebSocketPath<T extends string> = T extends `${RESTEndpointPaths}/ws` ? T : never;
|
|
1634
|
+
type WebSocketEndpoint<Path extends string, ConnectOptions = undefined> = {
|
|
1635
|
+
path: WebSocketPath<Path>;
|
|
1636
|
+
options: ConnectOptions;
|
|
1637
|
+
};
|
|
1638
|
+
type WebSocketEndpoints = WebSocketEndpoint<"/channels/@me/ws", WebSocketConnectOptions> | WebSocketEndpoint<"/channels/@me/:channelId/ws", WebSocketConnectOptions & {
|
|
1639
|
+
channelId: string;
|
|
1640
|
+
}> | WebSocketEndpoint<"/channels/:organizationSlug/ws", WebSocketConnectOptions & {
|
|
1641
|
+
organizationSlug: string;
|
|
1642
|
+
}> | WebSocketEndpoint<"/channels/:organizationSlug/:channelId/ws", WebSocketConnectOptions & {
|
|
1643
|
+
organizationSlug: string;
|
|
1644
|
+
channelId: string;
|
|
1645
|
+
}>;
|
|
1646
|
+
type WebSocketPaths = WebSocketEndpoints["path"];
|
|
1647
|
+
type WebSocketPathsFor = Extract<WebSocketEndpoints, {
|
|
1648
|
+
path: string;
|
|
1649
|
+
}>["path"];
|
|
1650
|
+
type WebSocketOptionsFor<P extends WebSocketPaths> = Extract<WebSocketEndpoints, {
|
|
1651
|
+
path: P;
|
|
1652
|
+
}>["options"];
|
|
1653
|
+
|
|
1654
|
+
type WebSocketEventHandler<T> = (event: T) => void;
|
|
1655
|
+
declare class WebSocketClient {
|
|
1656
|
+
private ws?;
|
|
1657
|
+
private options;
|
|
1658
|
+
private reconnectAttempts;
|
|
1659
|
+
private reconnectTimer?;
|
|
1660
|
+
private eventHandlers;
|
|
1661
|
+
private isConnected;
|
|
1662
|
+
private isReconnecting;
|
|
1663
|
+
constructor(options?: Partial<WebSocketClientOptions>);
|
|
1664
|
+
private log;
|
|
1665
|
+
private getWebSocketURL;
|
|
1666
|
+
connect<P extends WebSocketPaths>(path: P, options: WebSocketOptionsFor<P>): Promise<void>;
|
|
1667
|
+
private handleReconnect;
|
|
1668
|
+
private handleEvent;
|
|
1669
|
+
on<T extends ChannelWebSocketEvent>(eventType: T["type"] | "*", handler: WebSocketEventHandler<T>): () => void;
|
|
1670
|
+
off<T extends ChannelWebSocketEvent>(eventType: T["type"] | "*", _handler: WebSocketEventHandler<T>): void;
|
|
1671
|
+
send(data: unknown): void;
|
|
1672
|
+
disconnect(): void;
|
|
1673
|
+
get connected(): boolean;
|
|
1674
|
+
get reconnecting(): boolean;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
declare class ChannelWebSocketClient extends WebSocketClient {
|
|
1678
|
+
connectToChannel(channelId: string, options?: WebSocketConnectOptions): Promise<void>;
|
|
1679
|
+
connectToOrganizationChannel(organizationSlug: string, channelId: string, options?: WebSocketConnectOptions): Promise<void>;
|
|
1680
|
+
connectToUserChannels(options?: WebSocketConnectOptions): Promise<void>;
|
|
1681
|
+
connectToOrganizationChannels(organizationSlug: string, options?: WebSocketConnectOptions): Promise<void>;
|
|
1682
|
+
onMessageCreate(handler: WebSocketEventHandler<ChannelMessageCreateEvent>): () => void;
|
|
1683
|
+
onMessageUpdate(handler: WebSocketEventHandler<ChannelMessageUpdateEvent>): () => void;
|
|
1684
|
+
onMessageDelete(handler: WebSocketEventHandler<ChannelMessageDeleteEvent>): () => void;
|
|
1685
|
+
onChannelUpdate(handler: WebSocketEventHandler<ChannelUpdateEvent>): () => void;
|
|
1686
|
+
onChannelDelete(handler: WebSocketEventHandler<ChannelDeleteEvent>): () => void;
|
|
1687
|
+
onMemberJoin(handler: WebSocketEventHandler<ChannelMemberJoinEvent>): () => void;
|
|
1688
|
+
onMemberLeave(handler: WebSocketEventHandler<ChannelMemberLeaveEvent>): () => void;
|
|
1689
|
+
onTypingStart(handler: WebSocketEventHandler<TypingStartEvent>): () => void;
|
|
1690
|
+
onTypingStop(handler: WebSocketEventHandler<TypingStopEvent>): () => void;
|
|
1691
|
+
startTyping(channelId: string): void;
|
|
1692
|
+
stopTyping(channelId: string): void;
|
|
1693
|
+
subscribeToChannel(channelId: string): void;
|
|
1694
|
+
unsubscribeFromChannel(channelId: string): void;
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
declare function channelsWS(options?: Partial<WebSocketClientOptions>): {
|
|
1698
|
+
connect: (channelId: string, token?: string) => Promise<void>;
|
|
1699
|
+
connectToOrganization: (organizationSlug: string, channelId: string, token?: string) => Promise<void>;
|
|
1700
|
+
connectToUserChannels: (token?: string) => Promise<void>;
|
|
1701
|
+
connectToOrganizationChannels: (organizationSlug: string, token?: string) => Promise<void>;
|
|
1702
|
+
onMessageCreate: (handler: Parameters<(handler: WebSocketEventHandler<ChannelMessageCreateEvent>) => () => void>[0]) => () => void;
|
|
1703
|
+
onMessageUpdate: (handler: Parameters<(handler: WebSocketEventHandler<ChannelMessageUpdateEvent>) => () => void>[0]) => () => void;
|
|
1704
|
+
onMessageDelete: (handler: Parameters<(handler: WebSocketEventHandler<ChannelMessageDeleteEvent>) => () => void>[0]) => () => void;
|
|
1705
|
+
onChannelUpdate: (handler: Parameters<(handler: WebSocketEventHandler<ChannelUpdateEvent>) => () => void>[0]) => () => void;
|
|
1706
|
+
onChannelDelete: (handler: Parameters<(handler: WebSocketEventHandler<ChannelDeleteEvent>) => () => void>[0]) => () => void;
|
|
1707
|
+
onMemberJoin: (handler: Parameters<(handler: WebSocketEventHandler<ChannelMemberJoinEvent>) => () => void>[0]) => () => void;
|
|
1708
|
+
onMemberLeave: (handler: Parameters<(handler: WebSocketEventHandler<ChannelMemberLeaveEvent>) => () => void>[0]) => () => void;
|
|
1709
|
+
onTypingStart: (handler: Parameters<(handler: WebSocketEventHandler<TypingStartEvent>) => () => void>[0]) => () => void;
|
|
1710
|
+
onTypingStop: (handler: Parameters<(handler: WebSocketEventHandler<TypingStopEvent>) => () => void>[0]) => () => void;
|
|
1711
|
+
onAny: (handler: Parameters<(<T extends ChannelWebSocketEvent>(eventType: T["type"] | "*", handler: WebSocketEventHandler<T>) => () => void)>[1]) => () => void;
|
|
1712
|
+
startTyping: (channelId: string) => void;
|
|
1713
|
+
stopTyping: (channelId: string) => void;
|
|
1714
|
+
subscribeToChannel: (channelId: string) => void;
|
|
1715
|
+
unsubscribeFromChannel: (channelId: string) => void;
|
|
1716
|
+
disconnect: () => void;
|
|
1717
|
+
readonly connected: boolean;
|
|
1718
|
+
readonly reconnecting: boolean;
|
|
1719
|
+
client: ChannelWebSocketClient;
|
|
1720
|
+
};
|
|
1721
|
+
|
|
1722
|
+
export { type APIRequestOptions, type APIResponse, AcceptOrganizationMemberInvitationDto, AddParticipantDto, AddReactionDto, type AnalyticsOptions, type ArrayFilterOptions, type ArrayOptions, type ArrayPaginationOptions, type ArrayResult, type ArraySortOptions, AtLeastOneMedia, AtLeastOneMediaConstraint, AtLeastOneMediaOnUpdate, AtLeastOneMediaOnUpdateConstraint, type AuthEndpoints, type Base, BaseOrganizationEventDto, type BaseProfile, type BaseProfileMetadata, type Body, type CareerEndpoints, type CareersCategory, type CareersEmploymentType, type CareersJob, type CareersOffice, type Channel, type ChannelDeleteEvent, type ChannelEndpoints, type ChannelMember, type ChannelMemberJoinEvent, type ChannelMemberLeaveEvent, ChannelMemberRole, type ChannelMessage, type ChannelMessageCreateEvent, type ChannelMessageDeleteEvent, type ChannelMessageEndpoints, type ChannelMessageReaction, type ChannelMessageReadByEntry, ChannelMessageReportReason, type ChannelMessageUpdateEvent, type ChannelParticipant, ChannelStatus, ChannelType, type ChannelUpdateEvent, ChannelWebSocketClient, type ChannelWebSocketEvent, Client, type ClientOptions, ContentOrAttachmentsConstraint, CreateChannelDto, CreateChannelMessageDto, CreateLocationDto, CreateOrganizationDto, CreateOrganizationEventDto, type CreateOrganizationEventInput, CreateOrganizationEventOrderDto, CreateOrganizationEventStyleDto, CreateOrganizationEventTicketDto, type CreateOrganizationEventTicketInput, CreateOrganizationIdentityDto, CreateOrganizationMemberDto, CreateOrganizationMemberInvitationLinkDto, CreateUserDto, CreateUserIdentityDto, type CurrenciesEndpoints, Currency, type CurrencyConversion, type CurrencyConversionResult, DEFAULT_API_URL, type DeepPartial, type Distance, type Endpoint, type Endpoints, ErrorType, type ErroredAPIResponse, type EventAnalyticsOptions, type ExchangeRates, type ExcludeBase, type GeoPoint, GeoPointDto, type GeoSearchAggregation, type Health, type HealthEndpoints, Language, type Location$1 as Location, type NotificationEndpoints, type Order, type OrderEndpoints, type Organization, type OrganizationAnalyticsEndpoints, type OrganizationAnalyticsOverview, type OrganizationBilling, type OrganizationBillingAccount, type OrganizationEndpoints, type OrganizationEvent, type OrganizationEventAnalytics, type OrganizationEventArrayOptions, type OrganizationEventEndpoints, OrganizationEventFileType, type OrganizationEventOrderEndpoints, OrganizationEventStatus, type OrganizationEventStyle, type OrganizationEventStyleEndpoints, OrganizationEventStyleType, type OrganizationEventTicket, OrganizationEventTicketCategory, type OrganizationEventTicketEndpoints, OrganizationEventTicketType, OrganizationEventType, OrganizationEventVisibilityType, type OrganizationIdentity, type OrganizationMember, OrganizationMemberRole, OrganizationMemberStatus, type OrganizationMembersEndpoints, type OrganizationProfile, type OrganizationProfileMetadata, type OrganizationSocialLink, OrganizationSocialType, type OrganizationToken, OrganizationTokenType, type PathsFor, type Profile, type ProfileEndpoints, type ProfileMetadata, ProfileType, type PromisedAPIResponse, type PromisedResponse, type PublicUser, type QueryParams, REGEX, RecoveryDto, RecoveryResetDto, type RecoveryResponse, ReportChannelMessageDto, type Response, type ResponseFor, SignInUserDto, type StringifiedQuery, type StringifiedQueryValue, type SuccessfulAPIResponse, TonightPass, TonightPassAPIError, type TypingStartEvent, type TypingStopEvent, UpdateChannelDto, UpdateChannelMessageDto, UpdateLocationDto, UpdateOrganizationDto, UpdateOrganizationEventDto, UpdateOrganizationEventStyleDto, UpdateOrganizationEventTicketDto, UpdateOrganizationIdentityDto, UpdateOrganizationMemberDto, UpdateUserDto, type User, type UserBooking, type UserBookingEndpoints, type UserBookingTicket, type UserBookingWithoutTickets, type UserChannelCountOptions, type UserConnection, type UserConnectionClient, type UserConnectionDevice, type UserConnectionOS, type UserEndpoints, UserFileType, type UserIdentifier, type UserIdentity, UserIdentityGender, type UserNotification, type UserNotificationBase, type UserNotificationEndpoints, type UserNotificationFollow, UserNotificationType, type UserPreferences, type UserProfile, type UserProfileMetadata, UserRole, type UserToken, UserTokenType, WebSocketClient, type WebSocketClientOptions, type WebSocketConnectOptions, type WebSocketEndpoint, type WebSocketEndpoints, type WebSocketEvent, type WebSocketEventHandler, type WebSocketOptionsFor, type WebSocketPath, type WebSocketPaths, type WebSocketPathsFor, type WebhookEndpoints, auth, buildFileFormData, careers, channels, channelsWS, currencies, health, isBrowser, notifications, orders, organizations, profiles, request, sdk, users };
|
package/dist/index.d.ts
CHANGED
|
@@ -1442,6 +1442,11 @@ declare class TonightPass {
|
|
|
1442
1442
|
reportByOrganization: (organizationSlug: string, channelId: string, messageId: string, data: ReportChannelMessageDto) => Promise<void>;
|
|
1443
1443
|
};
|
|
1444
1444
|
};
|
|
1445
|
+
readonly currencies: {
|
|
1446
|
+
getRates: () => Promise<ExchangeRates>;
|
|
1447
|
+
convert: (conversion: CurrencyConversion) => Promise<CurrencyConversionResult>;
|
|
1448
|
+
convertAmount: (from: Currency, to: Currency, amount: number) => Promise<CurrencyConversionResult>;
|
|
1449
|
+
};
|
|
1445
1450
|
readonly health: {
|
|
1446
1451
|
getAll: () => Promise<Health<"database" | "app" | "api">>;
|
|
1447
1452
|
database: () => Promise<Health<"database">>;
|
|
@@ -1558,4 +1563,160 @@ declare class TonightPass {
|
|
|
1558
1563
|
declare const isBrowser: boolean;
|
|
1559
1564
|
declare function buildFileFormData(key: string, files: File | File[] | FileList): FormData;
|
|
1560
1565
|
|
|
1561
|
-
|
|
1566
|
+
interface ChannelMessageCreateEvent extends WebSocketEvent<ChannelMessage> {
|
|
1567
|
+
type: "channel_message_create";
|
|
1568
|
+
}
|
|
1569
|
+
interface ChannelMessageUpdateEvent extends WebSocketEvent<ChannelMessage> {
|
|
1570
|
+
type: "channel_message_update";
|
|
1571
|
+
}
|
|
1572
|
+
interface ChannelMessageDeleteEvent extends WebSocketEvent<{
|
|
1573
|
+
id: string;
|
|
1574
|
+
channelId: string;
|
|
1575
|
+
}> {
|
|
1576
|
+
type: "channel_message_delete";
|
|
1577
|
+
}
|
|
1578
|
+
interface ChannelUpdateEvent extends WebSocketEvent<Channel> {
|
|
1579
|
+
type: "channel_update";
|
|
1580
|
+
}
|
|
1581
|
+
interface ChannelDeleteEvent extends WebSocketEvent<{
|
|
1582
|
+
id: string;
|
|
1583
|
+
}> {
|
|
1584
|
+
type: "channel_delete";
|
|
1585
|
+
}
|
|
1586
|
+
interface ChannelMemberJoinEvent extends WebSocketEvent<{
|
|
1587
|
+
channel: Channel;
|
|
1588
|
+
user: User;
|
|
1589
|
+
}> {
|
|
1590
|
+
type: "channel_member_join";
|
|
1591
|
+
}
|
|
1592
|
+
interface ChannelMemberLeaveEvent extends WebSocketEvent<{
|
|
1593
|
+
channelId: string;
|
|
1594
|
+
userId: string;
|
|
1595
|
+
}> {
|
|
1596
|
+
type: "channel_member_leave";
|
|
1597
|
+
}
|
|
1598
|
+
interface TypingStartEvent extends WebSocketEvent<{
|
|
1599
|
+
channelId: string;
|
|
1600
|
+
userId: string;
|
|
1601
|
+
username: string;
|
|
1602
|
+
}> {
|
|
1603
|
+
type: "typing_start";
|
|
1604
|
+
}
|
|
1605
|
+
interface TypingStopEvent extends WebSocketEvent<{
|
|
1606
|
+
channelId: string;
|
|
1607
|
+
userId: string;
|
|
1608
|
+
}> {
|
|
1609
|
+
type: "typing_stop";
|
|
1610
|
+
}
|
|
1611
|
+
type ChannelWebSocketEvent = ChannelMessageCreateEvent | ChannelMessageUpdateEvent | ChannelMessageDeleteEvent | ChannelUpdateEvent | ChannelDeleteEvent | ChannelMemberJoinEvent | ChannelMemberLeaveEvent | TypingStartEvent | TypingStopEvent;
|
|
1612
|
+
|
|
1613
|
+
interface WebSocketEvent<T = unknown> {
|
|
1614
|
+
type: string;
|
|
1615
|
+
data: T;
|
|
1616
|
+
}
|
|
1617
|
+
interface WebSocketConnectOptions {
|
|
1618
|
+
token?: string;
|
|
1619
|
+
channelId?: string;
|
|
1620
|
+
organizationSlug?: string;
|
|
1621
|
+
}
|
|
1622
|
+
interface WebSocketClientOptions {
|
|
1623
|
+
baseURL: string;
|
|
1624
|
+
reconnectInterval?: number;
|
|
1625
|
+
maxReconnectAttempts?: number;
|
|
1626
|
+
debug?: boolean;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
type GETEndpoints = Extract<Endpoints, {
|
|
1630
|
+
method: "GET";
|
|
1631
|
+
}>;
|
|
1632
|
+
type RESTEndpointPaths = GETEndpoints["path"];
|
|
1633
|
+
type WebSocketPath<T extends string> = T extends `${RESTEndpointPaths}/ws` ? T : never;
|
|
1634
|
+
type WebSocketEndpoint<Path extends string, ConnectOptions = undefined> = {
|
|
1635
|
+
path: WebSocketPath<Path>;
|
|
1636
|
+
options: ConnectOptions;
|
|
1637
|
+
};
|
|
1638
|
+
type WebSocketEndpoints = WebSocketEndpoint<"/channels/@me/ws", WebSocketConnectOptions> | WebSocketEndpoint<"/channels/@me/:channelId/ws", WebSocketConnectOptions & {
|
|
1639
|
+
channelId: string;
|
|
1640
|
+
}> | WebSocketEndpoint<"/channels/:organizationSlug/ws", WebSocketConnectOptions & {
|
|
1641
|
+
organizationSlug: string;
|
|
1642
|
+
}> | WebSocketEndpoint<"/channels/:organizationSlug/:channelId/ws", WebSocketConnectOptions & {
|
|
1643
|
+
organizationSlug: string;
|
|
1644
|
+
channelId: string;
|
|
1645
|
+
}>;
|
|
1646
|
+
type WebSocketPaths = WebSocketEndpoints["path"];
|
|
1647
|
+
type WebSocketPathsFor = Extract<WebSocketEndpoints, {
|
|
1648
|
+
path: string;
|
|
1649
|
+
}>["path"];
|
|
1650
|
+
type WebSocketOptionsFor<P extends WebSocketPaths> = Extract<WebSocketEndpoints, {
|
|
1651
|
+
path: P;
|
|
1652
|
+
}>["options"];
|
|
1653
|
+
|
|
1654
|
+
type WebSocketEventHandler<T> = (event: T) => void;
|
|
1655
|
+
declare class WebSocketClient {
|
|
1656
|
+
private ws?;
|
|
1657
|
+
private options;
|
|
1658
|
+
private reconnectAttempts;
|
|
1659
|
+
private reconnectTimer?;
|
|
1660
|
+
private eventHandlers;
|
|
1661
|
+
private isConnected;
|
|
1662
|
+
private isReconnecting;
|
|
1663
|
+
constructor(options?: Partial<WebSocketClientOptions>);
|
|
1664
|
+
private log;
|
|
1665
|
+
private getWebSocketURL;
|
|
1666
|
+
connect<P extends WebSocketPaths>(path: P, options: WebSocketOptionsFor<P>): Promise<void>;
|
|
1667
|
+
private handleReconnect;
|
|
1668
|
+
private handleEvent;
|
|
1669
|
+
on<T extends ChannelWebSocketEvent>(eventType: T["type"] | "*", handler: WebSocketEventHandler<T>): () => void;
|
|
1670
|
+
off<T extends ChannelWebSocketEvent>(eventType: T["type"] | "*", _handler: WebSocketEventHandler<T>): void;
|
|
1671
|
+
send(data: unknown): void;
|
|
1672
|
+
disconnect(): void;
|
|
1673
|
+
get connected(): boolean;
|
|
1674
|
+
get reconnecting(): boolean;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
declare class ChannelWebSocketClient extends WebSocketClient {
|
|
1678
|
+
connectToChannel(channelId: string, options?: WebSocketConnectOptions): Promise<void>;
|
|
1679
|
+
connectToOrganizationChannel(organizationSlug: string, channelId: string, options?: WebSocketConnectOptions): Promise<void>;
|
|
1680
|
+
connectToUserChannels(options?: WebSocketConnectOptions): Promise<void>;
|
|
1681
|
+
connectToOrganizationChannels(organizationSlug: string, options?: WebSocketConnectOptions): Promise<void>;
|
|
1682
|
+
onMessageCreate(handler: WebSocketEventHandler<ChannelMessageCreateEvent>): () => void;
|
|
1683
|
+
onMessageUpdate(handler: WebSocketEventHandler<ChannelMessageUpdateEvent>): () => void;
|
|
1684
|
+
onMessageDelete(handler: WebSocketEventHandler<ChannelMessageDeleteEvent>): () => void;
|
|
1685
|
+
onChannelUpdate(handler: WebSocketEventHandler<ChannelUpdateEvent>): () => void;
|
|
1686
|
+
onChannelDelete(handler: WebSocketEventHandler<ChannelDeleteEvent>): () => void;
|
|
1687
|
+
onMemberJoin(handler: WebSocketEventHandler<ChannelMemberJoinEvent>): () => void;
|
|
1688
|
+
onMemberLeave(handler: WebSocketEventHandler<ChannelMemberLeaveEvent>): () => void;
|
|
1689
|
+
onTypingStart(handler: WebSocketEventHandler<TypingStartEvent>): () => void;
|
|
1690
|
+
onTypingStop(handler: WebSocketEventHandler<TypingStopEvent>): () => void;
|
|
1691
|
+
startTyping(channelId: string): void;
|
|
1692
|
+
stopTyping(channelId: string): void;
|
|
1693
|
+
subscribeToChannel(channelId: string): void;
|
|
1694
|
+
unsubscribeFromChannel(channelId: string): void;
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
declare function channelsWS(options?: Partial<WebSocketClientOptions>): {
|
|
1698
|
+
connect: (channelId: string, token?: string) => Promise<void>;
|
|
1699
|
+
connectToOrganization: (organizationSlug: string, channelId: string, token?: string) => Promise<void>;
|
|
1700
|
+
connectToUserChannels: (token?: string) => Promise<void>;
|
|
1701
|
+
connectToOrganizationChannels: (organizationSlug: string, token?: string) => Promise<void>;
|
|
1702
|
+
onMessageCreate: (handler: Parameters<(handler: WebSocketEventHandler<ChannelMessageCreateEvent>) => () => void>[0]) => () => void;
|
|
1703
|
+
onMessageUpdate: (handler: Parameters<(handler: WebSocketEventHandler<ChannelMessageUpdateEvent>) => () => void>[0]) => () => void;
|
|
1704
|
+
onMessageDelete: (handler: Parameters<(handler: WebSocketEventHandler<ChannelMessageDeleteEvent>) => () => void>[0]) => () => void;
|
|
1705
|
+
onChannelUpdate: (handler: Parameters<(handler: WebSocketEventHandler<ChannelUpdateEvent>) => () => void>[0]) => () => void;
|
|
1706
|
+
onChannelDelete: (handler: Parameters<(handler: WebSocketEventHandler<ChannelDeleteEvent>) => () => void>[0]) => () => void;
|
|
1707
|
+
onMemberJoin: (handler: Parameters<(handler: WebSocketEventHandler<ChannelMemberJoinEvent>) => () => void>[0]) => () => void;
|
|
1708
|
+
onMemberLeave: (handler: Parameters<(handler: WebSocketEventHandler<ChannelMemberLeaveEvent>) => () => void>[0]) => () => void;
|
|
1709
|
+
onTypingStart: (handler: Parameters<(handler: WebSocketEventHandler<TypingStartEvent>) => () => void>[0]) => () => void;
|
|
1710
|
+
onTypingStop: (handler: Parameters<(handler: WebSocketEventHandler<TypingStopEvent>) => () => void>[0]) => () => void;
|
|
1711
|
+
onAny: (handler: Parameters<(<T extends ChannelWebSocketEvent>(eventType: T["type"] | "*", handler: WebSocketEventHandler<T>) => () => void)>[1]) => () => void;
|
|
1712
|
+
startTyping: (channelId: string) => void;
|
|
1713
|
+
stopTyping: (channelId: string) => void;
|
|
1714
|
+
subscribeToChannel: (channelId: string) => void;
|
|
1715
|
+
unsubscribeFromChannel: (channelId: string) => void;
|
|
1716
|
+
disconnect: () => void;
|
|
1717
|
+
readonly connected: boolean;
|
|
1718
|
+
readonly reconnecting: boolean;
|
|
1719
|
+
client: ChannelWebSocketClient;
|
|
1720
|
+
};
|
|
1721
|
+
|
|
1722
|
+
export { type APIRequestOptions, type APIResponse, AcceptOrganizationMemberInvitationDto, AddParticipantDto, AddReactionDto, type AnalyticsOptions, type ArrayFilterOptions, type ArrayOptions, type ArrayPaginationOptions, type ArrayResult, type ArraySortOptions, AtLeastOneMedia, AtLeastOneMediaConstraint, AtLeastOneMediaOnUpdate, AtLeastOneMediaOnUpdateConstraint, type AuthEndpoints, type Base, BaseOrganizationEventDto, type BaseProfile, type BaseProfileMetadata, type Body, type CareerEndpoints, type CareersCategory, type CareersEmploymentType, type CareersJob, type CareersOffice, type Channel, type ChannelDeleteEvent, type ChannelEndpoints, type ChannelMember, type ChannelMemberJoinEvent, type ChannelMemberLeaveEvent, ChannelMemberRole, type ChannelMessage, type ChannelMessageCreateEvent, type ChannelMessageDeleteEvent, type ChannelMessageEndpoints, type ChannelMessageReaction, type ChannelMessageReadByEntry, ChannelMessageReportReason, type ChannelMessageUpdateEvent, type ChannelParticipant, ChannelStatus, ChannelType, type ChannelUpdateEvent, ChannelWebSocketClient, type ChannelWebSocketEvent, Client, type ClientOptions, ContentOrAttachmentsConstraint, CreateChannelDto, CreateChannelMessageDto, CreateLocationDto, CreateOrganizationDto, CreateOrganizationEventDto, type CreateOrganizationEventInput, CreateOrganizationEventOrderDto, CreateOrganizationEventStyleDto, CreateOrganizationEventTicketDto, type CreateOrganizationEventTicketInput, CreateOrganizationIdentityDto, CreateOrganizationMemberDto, CreateOrganizationMemberInvitationLinkDto, CreateUserDto, CreateUserIdentityDto, type CurrenciesEndpoints, Currency, type CurrencyConversion, type CurrencyConversionResult, DEFAULT_API_URL, type DeepPartial, type Distance, type Endpoint, type Endpoints, ErrorType, type ErroredAPIResponse, type EventAnalyticsOptions, type ExchangeRates, type ExcludeBase, type GeoPoint, GeoPointDto, type GeoSearchAggregation, type Health, type HealthEndpoints, Language, type Location$1 as Location, type NotificationEndpoints, type Order, type OrderEndpoints, type Organization, type OrganizationAnalyticsEndpoints, type OrganizationAnalyticsOverview, type OrganizationBilling, type OrganizationBillingAccount, type OrganizationEndpoints, type OrganizationEvent, type OrganizationEventAnalytics, type OrganizationEventArrayOptions, type OrganizationEventEndpoints, OrganizationEventFileType, type OrganizationEventOrderEndpoints, OrganizationEventStatus, type OrganizationEventStyle, type OrganizationEventStyleEndpoints, OrganizationEventStyleType, type OrganizationEventTicket, OrganizationEventTicketCategory, type OrganizationEventTicketEndpoints, OrganizationEventTicketType, OrganizationEventType, OrganizationEventVisibilityType, type OrganizationIdentity, type OrganizationMember, OrganizationMemberRole, OrganizationMemberStatus, type OrganizationMembersEndpoints, type OrganizationProfile, type OrganizationProfileMetadata, type OrganizationSocialLink, OrganizationSocialType, type OrganizationToken, OrganizationTokenType, type PathsFor, type Profile, type ProfileEndpoints, type ProfileMetadata, ProfileType, type PromisedAPIResponse, type PromisedResponse, type PublicUser, type QueryParams, REGEX, RecoveryDto, RecoveryResetDto, type RecoveryResponse, ReportChannelMessageDto, type Response, type ResponseFor, SignInUserDto, type StringifiedQuery, type StringifiedQueryValue, type SuccessfulAPIResponse, TonightPass, TonightPassAPIError, type TypingStartEvent, type TypingStopEvent, UpdateChannelDto, UpdateChannelMessageDto, UpdateLocationDto, UpdateOrganizationDto, UpdateOrganizationEventDto, UpdateOrganizationEventStyleDto, UpdateOrganizationEventTicketDto, UpdateOrganizationIdentityDto, UpdateOrganizationMemberDto, UpdateUserDto, type User, type UserBooking, type UserBookingEndpoints, type UserBookingTicket, type UserBookingWithoutTickets, type UserChannelCountOptions, type UserConnection, type UserConnectionClient, type UserConnectionDevice, type UserConnectionOS, type UserEndpoints, UserFileType, type UserIdentifier, type UserIdentity, UserIdentityGender, type UserNotification, type UserNotificationBase, type UserNotificationEndpoints, type UserNotificationFollow, UserNotificationType, type UserPreferences, type UserProfile, type UserProfileMetadata, UserRole, type UserToken, UserTokenType, WebSocketClient, type WebSocketClientOptions, type WebSocketConnectOptions, type WebSocketEndpoint, type WebSocketEndpoints, type WebSocketEvent, type WebSocketEventHandler, type WebSocketOptionsFor, type WebSocketPath, type WebSocketPaths, type WebSocketPathsFor, type WebhookEndpoints, auth, buildFileFormData, careers, channels, channelsWS, currencies, health, isBrowser, notifications, orders, organizations, profiles, request, sdk, users };
|