stream-chat 8.56.0 → 8.57.0

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.
Files changed (80) hide show
  1. package/dist/cjs/index.browser.cjs +11101 -0
  2. package/dist/cjs/index.browser.cjs.map +7 -0
  3. package/dist/cjs/index.node.cjs +22510 -0
  4. package/dist/cjs/index.node.cjs.map +7 -0
  5. package/dist/esm/index.js +11097 -0
  6. package/dist/esm/index.js.map +7 -0
  7. package/dist/types/base64.d.ts +0 -1
  8. package/dist/types/campaign.d.ts +18 -3
  9. package/dist/types/channel.d.ts +3 -5
  10. package/dist/types/channel_manager.d.ts +11 -12
  11. package/dist/types/channel_state.d.ts +6 -7
  12. package/dist/types/client.d.ts +110 -141
  13. package/dist/types/client_state.d.ts +0 -1
  14. package/dist/types/connection.d.ts +3 -6
  15. package/dist/types/connection_fallback.d.ts +0 -1
  16. package/dist/types/constants.d.ts +0 -1
  17. package/dist/types/errors.d.ts +1 -2
  18. package/dist/types/events.d.ts +0 -1
  19. package/dist/types/index.d.ts +0 -1
  20. package/dist/types/insights.d.ts +3 -5
  21. package/dist/types/moderation.d.ts +0 -1
  22. package/dist/types/permissions.d.ts +2 -3
  23. package/dist/types/poll.d.ts +9 -10
  24. package/dist/types/poll_manager.d.ts +1 -2
  25. package/dist/types/search_controller.d.ts +17 -18
  26. package/dist/types/segment.d.ts +3 -4
  27. package/dist/types/signing.d.ts +3 -5
  28. package/dist/types/store.d.ts +5 -6
  29. package/dist/types/thread.d.ts +9 -10
  30. package/dist/types/thread_manager.d.ts +3 -4
  31. package/dist/types/token_manager.d.ts +4 -5
  32. package/dist/types/types.d.ts +400 -387
  33. package/dist/types/utils.d.ts +14 -15
  34. package/package.json +53 -58
  35. package/src/campaign.ts +3 -3
  36. package/src/channel_manager.ts +21 -10
  37. package/src/client.ts +69 -19
  38. package/src/connection.ts +14 -7
  39. package/src/connection_fallback.ts +9 -7
  40. package/src/signing.ts +10 -5
  41. package/src/token_manager.ts +5 -4
  42. package/src/types.ts +9 -0
  43. package/src/utils.ts +21 -0
  44. package/dist/browser.es.js +0 -19194
  45. package/dist/browser.es.js.map +0 -1
  46. package/dist/browser.full-bundle.min.js +0 -2
  47. package/dist/browser.full-bundle.min.js.map +0 -1
  48. package/dist/browser.js +0 -19275
  49. package/dist/browser.js.map +0 -1
  50. package/dist/index.es.js +0 -19197
  51. package/dist/index.es.js.map +0 -1
  52. package/dist/index.js +0 -19281
  53. package/dist/index.js.map +0 -1
  54. package/dist/types/base64.d.ts.map +0 -1
  55. package/dist/types/campaign.d.ts.map +0 -1
  56. package/dist/types/channel.d.ts.map +0 -1
  57. package/dist/types/channel_manager.d.ts.map +0 -1
  58. package/dist/types/channel_state.d.ts.map +0 -1
  59. package/dist/types/client.d.ts.map +0 -1
  60. package/dist/types/client_state.d.ts.map +0 -1
  61. package/dist/types/connection.d.ts.map +0 -1
  62. package/dist/types/connection_fallback.d.ts.map +0 -1
  63. package/dist/types/constants.d.ts.map +0 -1
  64. package/dist/types/errors.d.ts.map +0 -1
  65. package/dist/types/events.d.ts.map +0 -1
  66. package/dist/types/index.d.ts.map +0 -1
  67. package/dist/types/insights.d.ts.map +0 -1
  68. package/dist/types/moderation.d.ts.map +0 -1
  69. package/dist/types/permissions.d.ts.map +0 -1
  70. package/dist/types/poll.d.ts.map +0 -1
  71. package/dist/types/poll_manager.d.ts.map +0 -1
  72. package/dist/types/search_controller.d.ts.map +0 -1
  73. package/dist/types/segment.d.ts.map +0 -1
  74. package/dist/types/signing.d.ts.map +0 -1
  75. package/dist/types/store.d.ts.map +0 -1
  76. package/dist/types/thread.d.ts.map +0 -1
  77. package/dist/types/thread_manager.d.ts.map +0 -1
  78. package/dist/types/token_manager.d.ts.map +0 -1
  79. package/dist/types/types.d.ts.map +0 -1
  80. package/dist/types/utils.d.ts.map +0 -1
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="ws" />
3
1
  import WebSocket from 'isomorphic-ws';
4
2
  import { ConnectAPIResponse, ConnectionOpen, ExtendableGenerics, DefaultGenerics, UR, LogLevel } from './types';
5
3
  import { StreamChat } from './client';
@@ -114,9 +112,9 @@ export declare class StableWSConnection<StreamChatGenerics extends ExtendableGen
114
112
  *
115
113
  */
116
114
  _errorFromWSEvent: (event: WebSocket.CloseEvent | WebSocket.Data | WebSocket.ErrorEvent, isWSFailure?: boolean) => Error & {
117
- code?: string | number | undefined;
118
- isWSFailure?: boolean | undefined;
119
- StatusCode?: string | number | undefined;
115
+ code?: string | number;
116
+ isWSFailure?: boolean;
117
+ StatusCode?: string | number;
120
118
  };
121
119
  /**
122
120
  * _destroyCurrentWSConnection - Removes the current WS connection
@@ -138,4 +136,3 @@ export declare class StableWSConnection<StreamChatGenerics extends ExtendableGen
138
136
  */
139
137
  scheduleConnectionCheck: () => void;
140
138
  }
141
- //# sourceMappingURL=connection.d.ts.map
@@ -38,4 +38,3 @@ export declare class WSConnectionFallback<StreamChatGenerics extends ExtendableG
38
38
  isHealthy: () => boolean;
39
39
  disconnect: (timeout?: number) => Promise<void>;
40
40
  }
41
- //# sourceMappingURL=connection_fallback.d.ts.map
@@ -4,4 +4,3 @@ export declare const DEFAULT_MESSAGE_SET_PAGINATION: {
4
4
  hasNext: boolean;
5
5
  hasPrev: boolean;
6
6
  };
7
- //# sourceMappingURL=constants.d.ts.map
@@ -4,7 +4,7 @@ export declare const APIErrorCodes: Record<string, {
4
4
  name: string;
5
5
  retryable: boolean;
6
6
  }>;
7
- declare type APIError = Error & {
7
+ type APIError = Error & {
8
8
  code: number;
9
9
  isWSFailure?: boolean;
10
10
  };
@@ -14,4 +14,3 @@ export declare function isConnectionIDError(error: APIError): boolean;
14
14
  export declare function isWSFailure(err: APIError): boolean;
15
15
  export declare function isErrorResponse(res: AxiosResponse<unknown>): res is AxiosResponse<APIErrorResponse>;
16
16
  export {};
17
- //# sourceMappingURL=errors.d.ts.map
@@ -58,4 +58,3 @@ export declare const EVENT_MAP: {
58
58
  'transport.changed': boolean;
59
59
  'capabilities.changed': boolean;
60
60
  };
61
- //# sourceMappingURL=events.d.ts.map
@@ -22,4 +22,3 @@ export * from './token_manager';
22
22
  export * from './types';
23
23
  export * from './channel_manager';
24
24
  export { isOwnUser, chatCodes, logChatPromiseExecution, formatMessage } from './utils';
25
- //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,5 @@
1
- /// <reference types="ws" />
2
1
  import { StableWSConnection } from './connection';
3
- export declare type InsightTypes = 'ws_fatal' | 'ws_success_after_failure' | 'http_hi_failed';
2
+ export type InsightTypes = 'ws_fatal' | 'ws_success_after_failure' | 'http_hi_failed';
4
3
  export declare class InsightMetrics {
5
4
  connectionStartTimestamp: number | null;
6
5
  wsConsecutiveFailures: number;
@@ -17,7 +16,7 @@ export declare class InsightMetrics {
17
16
  */
18
17
  export declare const postInsights: (insightType: InsightTypes, insights: Record<string, unknown>) => Promise<void>;
19
18
  export declare function buildWsFatalInsight(connection: StableWSConnection, event: Record<string, unknown>): {
20
- ready_state: number | undefined;
19
+ ready_state: 0 | 1 | 2 | 3 | undefined;
21
20
  url: string;
22
21
  api_key: string;
23
22
  start_ts: number | null;
@@ -37,7 +36,7 @@ export declare function buildWsFatalInsight(connection: StableWSConnection, even
37
36
  instance_client_id: string;
38
37
  };
39
38
  export declare function buildWsSuccessAfterFailureInsight(connection: StableWSConnection): {
40
- ready_state: number | undefined;
39
+ ready_state: 0 | 1 | 2 | 3 | undefined;
41
40
  url: string;
42
41
  api_key: string;
43
42
  start_ts: number | null;
@@ -56,4 +55,3 @@ export declare function buildWsSuccessAfterFailureInsight(connection: StableWSCo
56
55
  user_agent: string | null;
57
56
  instance_client_id: string;
58
57
  };
59
- //# sourceMappingURL=insights.d.ts.map
@@ -169,4 +169,3 @@ export declare class Moderation<StreamChatGenerics extends ExtendableGenerics =
169
169
  status: string;
170
170
  } & APIResponse>;
171
171
  }
172
- //# sourceMappingURL=moderation.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { PermissionObject } from './types';
2
- declare type RequiredPermissionObject = Required<PermissionObject>;
2
+ type RequiredPermissionObject = Required<PermissionObject>;
3
3
  export declare const Allow = "Allow";
4
4
  export declare const Deny = "Deny";
5
5
  export declare const AnyResource: string[];
@@ -17,7 +17,7 @@ export declare class Permission {
17
17
  }
18
18
  export declare const AllowAll: Permission;
19
19
  export declare const DenyAll: Permission;
20
- export declare type Role = 'admin' | 'user' | 'guest' | 'anonymous' | 'channel_member' | 'channel_moderator' | string;
20
+ export type Role = 'admin' | 'user' | 'guest' | 'anonymous' | 'channel_member' | 'channel_moderator' | string;
21
21
  export declare const BuiltinRoles: {
22
22
  Admin: string;
23
23
  Anonymous: string;
@@ -53,4 +53,3 @@ export declare const BuiltinPermissions: {
53
53
  UseFrozenChannel: string;
54
54
  };
55
55
  export {};
56
- //# sourceMappingURL=permissions.d.ts.map
@@ -2,26 +2,26 @@ import { StateStore } from './store';
2
2
  import type { StreamChat } from './client';
3
3
  import type { DefaultGenerics, Event, ExtendableGenerics, PartialPollUpdate, PollAnswer, PollData, PollEnrichData, PollOptionData, PollResponse, PollVote, QueryVotesFilters, QueryVotesOptions, VoteSort } from './types';
4
4
  export declare const isVoteAnswer: <SCG extends ExtendableGenerics = DefaultGenerics>(vote: PollVote<SCG> | PollAnswer<SCG>) => vote is PollAnswer<SCG>;
5
- export declare type PollAnswersQueryParams = {
5
+ export type PollAnswersQueryParams = {
6
6
  filter?: QueryVotesFilters;
7
7
  options?: QueryVotesOptions;
8
8
  sort?: VoteSort;
9
9
  };
10
- export declare type PollOptionVotesQueryParams = {
10
+ export type PollOptionVotesQueryParams = {
11
11
  filter: {
12
12
  option_id: string;
13
13
  } & QueryVotesFilters;
14
14
  options?: QueryVotesOptions;
15
15
  sort?: VoteSort;
16
16
  };
17
- declare type OptionId = string;
18
- export declare type PollState<SCG extends ExtendableGenerics = DefaultGenerics> = SCG['pollType'] & Omit<PollResponse<SCG>, 'own_votes' | 'id'> & {
17
+ type OptionId = string;
18
+ export type PollState<SCG extends ExtendableGenerics = DefaultGenerics> = SCG['pollType'] & Omit<PollResponse<SCG>, 'own_votes' | 'id'> & {
19
19
  lastActivityAt: Date;
20
20
  maxVotedOptionIds: OptionId[];
21
21
  ownVotesByOptionId: Record<OptionId, PollVote<SCG>>;
22
22
  ownAnswer?: PollAnswer;
23
23
  };
24
- declare type PollInitOptions<SCG extends ExtendableGenerics = DefaultGenerics> = {
24
+ type PollInitOptions<SCG extends ExtendableGenerics = DefaultGenerics> = {
25
25
  client: StreamChat<SCG>;
26
26
  poll: PollResponse<SCG>;
27
27
  };
@@ -32,7 +32,7 @@ export declare class Poll<SCG extends ExtendableGenerics = DefaultGenerics> {
32
32
  private unsubscribeFunctions;
33
33
  constructor({ client, poll }: PollInitOptions<SCG>);
34
34
  private getInitialStateFromPollResponse;
35
- reinitializeState: (poll: PollInitOptions<SCG>['poll']) => void;
35
+ reinitializeState: (poll: PollInitOptions<SCG>["poll"]) => void;
36
36
  get data(): PollState<SCG>;
37
37
  handlePollUpdated: (event: Event<SCG>) => void;
38
38
  handlePollClosed: (event: Event<SCG>) => void;
@@ -40,7 +40,7 @@ export declare class Poll<SCG extends ExtendableGenerics = DefaultGenerics> {
40
40
  handleVoteChanged: (event: Event<SCG>) => void;
41
41
  handleVoteRemoved: (event: Event<SCG>) => void;
42
42
  query: (id: string) => Promise<PollResponse<SCG>>;
43
- update: (data: Exclude<PollData<SCG>, 'id'>) => Promise<import("./types").APIResponse & import("./types").UpdatePollAPIResponse<SCG>>;
43
+ update: (data: Exclude<PollData<SCG>, "id">) => Promise<import("./types").APIResponse & import("./types").UpdatePollAPIResponse<SCG>>;
44
44
  partialUpdate: (partialPollObject: PartialPollUpdate<SCG>) => Promise<import("./types").APIResponse & import("./types").UpdatePollAPIResponse<SCG>>;
45
45
  close: () => Promise<import("./types").APIResponse & import("./types").UpdatePollAPIResponse<SCG>>;
46
46
  delete: () => Promise<import("./types").APIResponse>;
@@ -49,11 +49,11 @@ export declare class Poll<SCG extends ExtendableGenerics = DefaultGenerics> {
49
49
  deleteOption: (optionId: string) => Promise<import("./types").APIResponse>;
50
50
  castVote: (optionId: string, messageId: string) => Promise<import("./types").APIResponse & import("./types").CastVoteAPIResponse<SCG>>;
51
51
  removeVote: (voteId: string, messageId: string) => Promise<import("./types").APIResponse & {
52
- vote: PollVote<DefaultGenerics>;
52
+ vote: PollVote;
53
53
  }>;
54
54
  addAnswer: (answerText: string, messageId: string) => Promise<import("./types").APIResponse & import("./types").CastVoteAPIResponse<SCG>>;
55
55
  removeAnswer: (answerId: string, messageId: string) => Promise<import("./types").APIResponse & {
56
- vote: PollVote<DefaultGenerics>;
56
+ vote: PollVote;
57
57
  }>;
58
58
  queryAnswers: (params: PollAnswersQueryParams) => Promise<import("./types").APIResponse & import("./types").PollAnswersAPIResponse<SCG>>;
59
59
  queryOptionVotes: (params: PollOptionVotesQueryParams) => Promise<import("./types").APIResponse & import("./types").PollVotesAPIResponse<SCG>>;
@@ -61,4 +61,3 @@ export declare class Poll<SCG extends ExtendableGenerics = DefaultGenerics> {
61
61
  export declare function extractPollData<SCG extends ExtendableGenerics = DefaultGenerics>(pollResponse: PollResponse<SCG>): PollData<SCG>;
62
62
  export declare function extractPollEnrichedData<SCG extends ExtendableGenerics = DefaultGenerics>(pollResponse: PollResponse<SCG>): Omit<PollEnrichData<SCG>, 'own_votes' | 'latest_answers'>;
63
63
  export {};
64
- //# sourceMappingURL=poll.d.ts.map
@@ -19,7 +19,7 @@ export declare class PollManager<SCG extends ExtendableGenerics = DefaultGeneric
19
19
  polls: (Poll<SCG> | undefined)[];
20
20
  next: string | undefined;
21
21
  }>;
22
- hydratePollCache: (messages: FormatMessageResponse<SCG>[] | MessageResponse<SCG>[], overwriteState?: boolean | undefined) => void;
22
+ hydratePollCache: (messages: FormatMessageResponse<SCG>[] | MessageResponse<SCG>[], overwriteState?: boolean) => void;
23
23
  private setOrOverwriteInCache;
24
24
  private subscribePollUpdated;
25
25
  private subscribePollClosed;
@@ -28,4 +28,3 @@ export declare class PollManager<SCG extends ExtendableGenerics = DefaultGeneric
28
28
  private subscribeVoteRemoved;
29
29
  private subscribeMessageNew;
30
30
  }
31
- //# sourceMappingURL=poll_manager.d.ts.map
@@ -3,15 +3,15 @@ import { StateStore } from './store';
3
3
  import type { Channel } from './channel';
4
4
  import type { StreamChat } from './client';
5
5
  import type { ChannelFilters, ChannelOptions, ChannelSort, DefaultGenerics, ExtendableGenerics, MessageFilters, MessageResponse, SearchMessageSort, UserFilters, UserOptions, UserResponse, UserSort } from './types';
6
- export declare type SearchSourceType = 'channels' | 'users' | 'messages' | (string & {});
7
- export declare type QueryReturnValue<T> = {
6
+ export type SearchSourceType = 'channels' | 'users' | 'messages' | (string & {});
7
+ export type QueryReturnValue<T> = {
8
8
  items: T[];
9
9
  next?: string;
10
10
  };
11
- export declare type DebounceOptions = {
11
+ export type DebounceOptions = {
12
12
  debounceMs: number;
13
13
  };
14
- declare type DebouncedExecQueryFunction = DebouncedFunc<(searchString?: string) => Promise<void>>;
14
+ type DebouncedExecQueryFunction = DebouncedFunc<(searchString?: string) => Promise<void>>;
15
15
  export interface SearchSource<T = any> {
16
16
  activate(): void;
17
17
  deactivate(): void;
@@ -32,7 +32,7 @@ export interface SearchSource<T = any> {
32
32
  readonly state: StateStore<SearchSourceState<T>>;
33
33
  readonly type: SearchSourceType;
34
34
  }
35
- export declare type SearchSourceState<T = any> = {
35
+ export type SearchSourceState<T = any> = {
36
36
  hasNext: boolean;
37
37
  isActive: boolean;
38
38
  isLoading: boolean;
@@ -42,7 +42,7 @@ export declare type SearchSourceState<T = any> = {
42
42
  next?: string;
43
43
  offset?: number;
44
44
  };
45
- export declare type SearchSourceOptions = {
45
+ export type SearchSourceOptions = {
46
46
  /** The number of milliseconds to debounce the search query. The default interval is 300ms. */
47
47
  debounceMs?: number;
48
48
  pageSize?: number;
@@ -78,7 +78,7 @@ export declare abstract class BaseSearchSource<T> implements SearchSource<T> {
78
78
  activate: () => void;
79
79
  deactivate: () => void;
80
80
  executeQuery(newSearchString?: string): Promise<void>;
81
- search: (searchQuery?: string | undefined) => void;
81
+ search: (searchQuery?: string) => void;
82
82
  resetState(): void;
83
83
  }
84
84
  export declare class UserSearchSource<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> extends BaseSearchSource<UserResponse<StreamChatGenerics>> {
@@ -124,23 +124,23 @@ export declare class MessageSearchSource<StreamChatGenerics extends ExtendableGe
124
124
  }>;
125
125
  protected filterQueryResults(items: MessageResponse<StreamChatGenerics>[]): MessageResponse<StreamChatGenerics>[];
126
126
  }
127
- export declare type DefaultSearchSources<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = [
127
+ export type DefaultSearchSources<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = [
128
128
  UserSearchSource<StreamChatGenerics>,
129
129
  ChannelSearchSource<StreamChatGenerics>,
130
130
  MessageSearchSource<StreamChatGenerics>
131
131
  ];
132
- export declare type SearchControllerState = {
132
+ export type SearchControllerState = {
133
133
  isActive: boolean;
134
134
  searchQuery: string;
135
135
  sources: SearchSource[];
136
136
  };
137
- export declare type InternalSearchControllerState<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = {
137
+ export type InternalSearchControllerState<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = {
138
138
  focusedMessage?: MessageResponse<StreamChatGenerics>;
139
139
  };
140
- export declare type SearchControllerConfig = {
140
+ export type SearchControllerConfig = {
141
141
  keepSingleActiveSource: boolean;
142
142
  };
143
- export declare type SearchControllerOptions = {
143
+ export type SearchControllerOptions = {
144
144
  config?: Partial<SearchControllerConfig>;
145
145
  sources?: SearchSource[];
146
146
  };
@@ -160,15 +160,14 @@ export declare class SearchController<StreamChatGenerics extends ExtendableGener
160
160
  get searchQuery(): string;
161
161
  get searchSourceTypes(): Array<SearchSource['type']>;
162
162
  addSource: (source: SearchSource) => void;
163
- getSource: (sourceType: SearchSource['type']) => SearchSource<any> | undefined;
164
- removeSource: (sourceType: SearchSource['type']) => void;
165
- activateSource: (sourceType: SearchSource['type']) => void;
166
- deactivateSource: (sourceType: SearchSource['type']) => void;
163
+ getSource: (sourceType: SearchSource["type"]) => SearchSource<any> | undefined;
164
+ removeSource: (sourceType: SearchSource["type"]) => void;
165
+ activateSource: (sourceType: SearchSource["type"]) => void;
166
+ deactivateSource: (sourceType: SearchSource["type"]) => void;
167
167
  activate: () => void;
168
- search: (searchQuery?: string | undefined) => Promise<void>;
168
+ search: (searchQuery?: string) => Promise<void>;
169
169
  cancelSearchQueries: () => void;
170
170
  clear: () => void;
171
171
  exit: () => void;
172
172
  }
173
173
  export {};
174
- //# sourceMappingURL=search_controller.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { StreamChat } from './client';
2
2
  import { DefaultGenerics, ExtendableGenerics, QuerySegmentTargetsFilter, SegmentData, SegmentResponse, SortParam } from './types';
3
- declare type SegmentType = 'user' | 'channel';
4
- declare type SegmentUpdatableFields = {
3
+ type SegmentType = 'user' | 'channel';
4
+ type SegmentUpdatableFields = {
5
5
  description?: string;
6
6
  filter?: {};
7
7
  name?: string;
@@ -28,8 +28,7 @@ export declare class Segment<StreamChatGenerics extends ExtendableGenerics = Def
28
28
  targetExists(targetId: string): Promise<import("./types").APIResponse>;
29
29
  queryTargets(filter?: QuerySegmentTargetsFilter | null, sort?: SortParam[] | null | [], options?: {}): Promise<{
30
30
  targets: import("./types").SegmentTargetsResponse[];
31
- next?: string | undefined;
31
+ next?: string;
32
32
  } & import("./types").APIResponse>;
33
33
  }
34
34
  export {};
35
- //# sourceMappingURL=segment.d.ts.map
@@ -1,5 +1,4 @@
1
- /// <reference types="node" />
2
- import { Secret, SignOptions } from 'jsonwebtoken';
1
+ import jwt from 'jsonwebtoken';
3
2
  import { UR } from './types';
4
3
  /**
5
4
  * Creates the JWT token that can be used for a UserSession
@@ -12,8 +11,8 @@ import { UR } from './types';
12
11
  * @param {SignOptions} [jwtOptions] - Options that can be past to jwt.sign
13
12
  * @return {string} JWT Token
14
13
  */
15
- export declare function JWTUserToken(apiSecret: Secret, userId: string, extraData?: UR, jwtOptions?: SignOptions): string;
16
- export declare function JWTServerToken(apiSecret: Secret, jwtOptions?: SignOptions): string;
14
+ export declare function JWTUserToken(apiSecret: jwt.Secret, userId: string, extraData?: UR, jwtOptions?: jwt.SignOptions): string;
15
+ export declare function JWTServerToken(apiSecret: jwt.Secret, jwtOptions?: jwt.SignOptions): string;
17
16
  export declare function UserFromToken(token: string): string;
18
17
  /**
19
18
  *
@@ -29,4 +28,3 @@ export declare function DevToken(userId: string): string;
29
28
  * @return {boolean}
30
29
  */
31
30
  export declare function CheckSignature(body: string | Buffer, secret: string, signature: string): boolean;
32
- //# sourceMappingURL=signing.d.ts.map
@@ -1,7 +1,7 @@
1
- export declare type Patch<T> = (value: T) => T;
2
- export declare type ValueOrPatch<T> = T | Patch<T>;
3
- export declare type Handler<T> = (nextValue: T, previousValue: T | undefined) => void;
4
- export declare type Unsubscribe = () => void;
1
+ export type Patch<T> = (value: T) => T;
2
+ export type ValueOrPatch<T> = T | Patch<T>;
3
+ export type Handler<T> = (nextValue: T, previousValue: T | undefined) => void;
4
+ export type Unsubscribe = () => void;
5
5
  export declare const isPatch: <T>(value: ValueOrPatch<T>) => value is Patch<T>;
6
6
  export declare class StateStore<T extends Record<string, unknown>> {
7
7
  private value;
@@ -12,6 +12,5 @@ export declare class StateStore<T extends Record<string, unknown>> {
12
12
  partialNext: (partial: Partial<T>) => void;
13
13
  getLatestValue: () => T;
14
14
  subscribe: (handler: Handler<T>) => Unsubscribe;
15
- subscribeWithSelector: <O extends readonly unknown[] | Readonly<Record<string, unknown>>>(selector: (nextValue: T) => O, handler: Handler<O>) => Unsubscribe;
15
+ subscribeWithSelector: <O extends Readonly<Record<string, unknown>> | Readonly<unknown[]>>(selector: (nextValue: T) => O, handler: Handler<O>) => Unsubscribe;
16
16
  }
17
- //# sourceMappingURL=store.d.ts.map
@@ -2,7 +2,7 @@ import type { Channel } from './channel';
2
2
  import type { StreamChat } from './client';
3
3
  import { StateStore } from './store';
4
4
  import type { AscDesc, DefaultGenerics, ExtendableGenerics, FormatMessageResponse, MessagePaginationOptions, MessageResponse, ThreadResponse, ThreadResponseCustomData, UserResponse } from './types';
5
- declare type QueryRepliesOptions<SCG extends ExtendableGenerics> = {
5
+ type QueryRepliesOptions<SCG extends ExtendableGenerics> = {
6
6
  sort?: {
7
7
  created_at: AscDesc;
8
8
  }[];
@@ -10,7 +10,7 @@ declare type QueryRepliesOptions<SCG extends ExtendableGenerics> = {
10
10
  user?: UserResponse<SCG>;
11
11
  user_id?: string;
12
12
  };
13
- export declare type ThreadState<SCG extends ExtendableGenerics = DefaultGenerics> = {
13
+ export type ThreadState<SCG extends ExtendableGenerics = DefaultGenerics> = {
14
14
  /**
15
15
  * Determines if the thread is currently opened and on-screen. When the thread is active,
16
16
  * all new messages are immediately marked as read.
@@ -35,19 +35,19 @@ export declare type ThreadState<SCG extends ExtendableGenerics = DefaultGenerics
35
35
  title: string;
36
36
  updatedAt: Date | null;
37
37
  };
38
- export declare type ThreadRepliesPagination = {
38
+ export type ThreadRepliesPagination = {
39
39
  isLoadingNext: boolean;
40
40
  isLoadingPrev: boolean;
41
41
  nextCursor: string | null;
42
42
  prevCursor: string | null;
43
43
  };
44
- export declare type ThreadUserReadState<SCG extends ExtendableGenerics = DefaultGenerics> = {
44
+ export type ThreadUserReadState<SCG extends ExtendableGenerics = DefaultGenerics> = {
45
45
  lastReadAt: Date;
46
46
  unreadMessageCount: number;
47
47
  user: UserResponse<SCG>;
48
48
  lastReadMessageId?: string;
49
49
  };
50
- export declare type ThreadReadState<SCG extends ExtendableGenerics = DefaultGenerics> = Record<string, ThreadUserReadState<SCG> | undefined>;
50
+ export type ThreadReadState<SCG extends ExtendableGenerics = DefaultGenerics> = Record<string, ThreadUserReadState<SCG> | undefined>;
51
51
  export declare const THREAD_RESPONSE_RESERVED_KEYS: Record<keyof ThreadResponse, true>;
52
52
  export declare class Thread<SCG extends ExtendableGenerics = DefaultGenerics> {
53
53
  readonly state: StateStore<ThreadState<SCG>>;
@@ -81,24 +81,23 @@ export declare class Thread<SCG extends ExtendableGenerics = DefaultGenerics> {
81
81
  }) => void;
82
82
  upsertReplyLocally: ({ message, timestampChanged, }: {
83
83
  message: MessageResponse<SCG>;
84
- timestampChanged?: boolean | undefined;
84
+ timestampChanged?: boolean;
85
85
  }) => void;
86
86
  updateParentMessageLocally: ({ message }: {
87
87
  message: MessageResponse<SCG>;
88
88
  }) => void;
89
89
  updateParentMessageOrReplyLocally: (message: MessageResponse<SCG>) => void;
90
90
  markAsRead: ({ force }?: {
91
- force?: boolean | undefined;
91
+ force?: boolean;
92
92
  }) => Promise<import("./types").EventAPIResponse<SCG> | null>;
93
93
  private throttledMarkAsRead;
94
94
  queryReplies: ({ limit, sort, ...otherOptions }?: QueryRepliesOptions<SCG>) => Promise<import("./types").GetRepliesAPIResponse<SCG>>;
95
95
  loadNextPage: ({ limit }?: {
96
- limit?: number | undefined;
96
+ limit?: number;
97
97
  }) => Promise<void>;
98
98
  loadPrevPage: ({ limit }?: {
99
- limit?: number | undefined;
99
+ limit?: number;
100
100
  }) => Promise<void>;
101
101
  private loadPage;
102
102
  }
103
103
  export {};
104
- //# sourceMappingURL=thread.d.ts.map
@@ -16,7 +16,7 @@ export declare const THREAD_MANAGER_INITIAL_STATE: {
16
16
  };
17
17
  ready: boolean;
18
18
  };
19
- export declare type ThreadManagerState<SCG extends ExtendableGenerics = DefaultGenerics> = {
19
+ export type ThreadManagerState<SCG extends ExtendableGenerics = DefaultGenerics> = {
20
20
  active: boolean;
21
21
  isThreadOrderStale: boolean;
22
22
  lastConnectionDropAt: Date | null;
@@ -30,7 +30,7 @@ export declare type ThreadManagerState<SCG extends ExtendableGenerics = DefaultG
30
30
  */
31
31
  unseenThreadIds: string[];
32
32
  };
33
- export declare type ThreadManagerPagination = {
33
+ export type ThreadManagerPagination = {
34
34
  isLoading: boolean;
35
35
  isLoadingNext: boolean;
36
36
  nextCursor: string | null;
@@ -62,6 +62,5 @@ export declare class ThreadManager<SCG extends ExtendableGenerics = DefaultGener
62
62
  threads: Thread<SCG>[];
63
63
  next: string | undefined;
64
64
  }>;
65
- loadNextPage: (options?: Omit<QueryThreadsOptions, 'next'>) => Promise<void>;
65
+ loadNextPage: (options?: Omit<QueryThreadsOptions, "next">) => Promise<void>;
66
66
  }
67
- //# sourceMappingURL=thread_manager.d.ts.map
@@ -1,5 +1,5 @@
1
- import { Secret } from 'jsonwebtoken';
2
- import { TokenOrProvider, ExtendableGenerics, DefaultGenerics, UserResponse } from './types';
1
+ import jwt from 'jsonwebtoken';
2
+ import type { TokenOrProvider, ExtendableGenerics, DefaultGenerics, UserResponse } from './types';
3
3
  /**
4
4
  * TokenManager
5
5
  *
@@ -8,7 +8,7 @@ import { TokenOrProvider, ExtendableGenerics, DefaultGenerics, UserResponse } fr
8
8
  export declare class TokenManager<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> {
9
9
  loadTokenPromise: Promise<string> | null;
10
10
  type: 'static' | 'provider';
11
- secret?: Secret;
11
+ secret?: jwt.Secret;
12
12
  token?: string;
13
13
  tokenProvider?: TokenOrProvider;
14
14
  user?: UserResponse<StreamChatGenerics>;
@@ -17,7 +17,7 @@ export declare class TokenManager<StreamChatGenerics extends ExtendableGenerics
17
17
  *
18
18
  * @param {Secret} secret
19
19
  */
20
- constructor(secret?: Secret);
20
+ constructor(secret?: jwt.Secret);
21
21
  /**
22
22
  * Set the static string token or token provider.
23
23
  * Token provider should return a token string or a promise which resolves to string token.
@@ -37,4 +37,3 @@ export declare class TokenManager<StreamChatGenerics extends ExtendableGenerics
37
37
  getToken: () => string | undefined;
38
38
  isStatic: () => boolean;
39
39
  }
40
- //# sourceMappingURL=token_manager.d.ts.map