opensips-js 0.1.52 → 0.1.53

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.ts CHANGED
@@ -600,6 +600,9 @@ declare const MODULES: {
600
600
 
601
601
  declare type Modules = AudioModuleName | VideoModuleName | MSRPModuleName
602
602
 
603
+ /** Max caption length after trim, matching server-side `m.upload.request` contract. */
604
+ export declare const MSRP_CAPTION_MAX_LENGTH = 1024;
605
+
603
606
  export declare const MSRP_EVT: {
604
607
  readonly CREATE: "m.conversation.create";
605
608
  readonly MESSAGE: "m.conversation.message";
@@ -607,6 +610,10 @@ export declare const MSRP_EVT: {
607
610
  readonly CLOSED: "m.conversation.closed";
608
611
  readonly REOPEN: "m.conversation.reopen";
609
612
  readonly DELETE: "m.conversation.delete";
613
+ readonly MESSAGE_HIDE: "m.message.hide";
614
+ readonly CONVERSATION_TAG: "m.conversation.tag";
615
+ readonly MESSAGE_TAG: "m.message.tag";
616
+ readonly ERROR: "m.error";
610
617
  readonly SYNC: "m.sync";
611
618
  readonly UPLOAD_REQUEST: "m.upload.request";
612
619
  readonly UPLOAD_RESPONSE: "m.upload.response";
@@ -660,6 +667,11 @@ export declare interface MSRPConversationState {
660
667
  created_at: number
661
668
  updated_at: number
662
669
  status?: string
670
+ /**
671
+ * Shared conversation tags from `m.sync` / `m.conversation.tag`.
672
+ * Compared by normalized (lowercase, trimmed) `name`.
673
+ */
674
+ tags?: MSRPTag[]
663
675
  }
664
676
 
665
677
  declare interface MSRPConversationState_2 {
@@ -685,13 +697,32 @@ declare interface MSRPConversationState_2 {
685
697
  created_at: number
686
698
  updated_at: number
687
699
  status?: string
700
+ /**
701
+ * Shared conversation tags from `m.sync` / `m.conversation.tag`.
702
+ * Compared by normalized (lowercase, trimmed) `name`.
703
+ */
704
+ tags?: MSRPTag_2[]
688
705
  }
689
706
 
707
+ declare type msrpConversationTaggedListener = (payload: {
708
+ conversation_id?: number
709
+ action: 'add' | 'remove'
710
+ tag: MSRPTag_2
711
+ actorUri: string
712
+ updatedAt: number
713
+ }) => void
714
+
690
715
  declare type msrpConversationUpdatedListener = (payload: {
691
716
  conversation_id?: number
692
717
  patch: Partial<MSRPConversationState_2>
693
718
  }) => void
694
719
 
720
+ declare type msrpErrorListener = (payload: {
721
+ conversation_id?: number
722
+ error: string
723
+ event: unknown
724
+ }) => void
725
+
695
726
  declare type MSRPInitializingListener = (value: boolean) => void
696
727
 
697
728
  export declare type MSRPMemberRole = 'in_charge' | 'manager' | 'assigned'
@@ -742,12 +773,27 @@ export declare type MSRPMessageEventType = {
742
773
  session: MSRPSessionExtended_2
743
774
  }
744
775
 
776
+ declare type msrpMessageHiddenListener = (payload: {
777
+ conversation_id?: number
778
+ eventId: string
779
+ updatedAt: number
780
+ }) => void
781
+
745
782
  declare type MSRPMessageListener = (event: MSRPMessageEventType) => void;
746
783
 
747
784
  export declare type MSRPMessageStatus = 'pending' | 'sent' | 'delivered' | 'read' | 'failed'
748
785
 
749
786
  declare type MSRPMessageStatus_2 = 'pending' | 'sent' | 'delivered' | 'read' | 'failed'
750
787
 
788
+ declare type msrpMessageTaggedListener = (payload: {
789
+ conversation_id?: number
790
+ eventId: string
791
+ action: 'add' | 'remove'
792
+ tag: MSRPTag_2
793
+ actorUri: string
794
+ updatedAt: number
795
+ }) => void
796
+
751
797
  declare class MSRPModule {
752
798
  private context;
753
799
  private msrpSession;
@@ -792,6 +838,9 @@ declare class MSRPModule {
792
838
  private buildTextMessageEvent;
793
839
  private buildEditMessageEvent;
794
840
  private buildDeleteMessageEvent;
841
+ private buildHideMessageEvent;
842
+ private buildConversationTagEvent;
843
+ private buildMessageTagEvent;
795
844
  private buildMediaMessageEvent;
796
845
  private buildMemberEvent;
797
846
  private buildCloseConversationEvent;
@@ -818,12 +867,37 @@ declare class MSRPModule {
818
867
  * may delete; the backend marks it `is_deleted` and fans out the deletion.
819
868
  */
820
869
  deleteMessage(conversationRef: MSRPConversationRef, targetEventId: string): boolean;
870
+ /**
871
+ * Hide a message from the current agent's timeline only. Any joined
872
+ * SIP/assistant member may hide any `m.conversation.message` (own,
873
+ * others', or internal_note). There is no undo in V1.
874
+ */
875
+ hideMessage(conversationRef: MSRPConversationRef, targetEventId: string): boolean;
876
+ /**
877
+ * Add a shared free-text tag to a conversation. Duplicate names on the
878
+ * same conversation are ignored by the server.
879
+ */
880
+ tagConversation(conversationRef: MSRPConversationRef, name: string, color?: string): boolean;
881
+ /** Remove a conversation tag by name (compared case-insensitively). */
882
+ untagConversation(conversationRef: MSRPConversationRef, name: string): boolean;
883
+ /**
884
+ * Add a shared free-text tag to a specific message. Duplicate names on
885
+ * the same message are ignored by the server.
886
+ */
887
+ tagMessage(conversationRef: MSRPConversationRef, targetEventId: string, name: string, color?: string): boolean;
888
+ /** Remove a message tag by name (compared case-insensitively). */
889
+ untagMessage(conversationRef: MSRPConversationRef, targetEventId: string, name: string): boolean;
821
890
  /**
822
891
  * Forward the text of an existing message into another conversation.
823
892
  * The caller owns `forwardedFromLabel`; when omitted the raw sender URI
824
893
  * of the source message is used. The SDK never invents a display name.
825
894
  */
826
895
  forwardMessage(sourceMessage: any, targetConversationRef: MSRPConversationRef, forwardedFromLabel?: string): boolean;
896
+ /**
897
+ * Emit a client-side media `m.conversation.message`. Prefer
898
+ * {@link uploadFile} — with server-side media commit the server
899
+ * creates the timeline event after the file POST.
900
+ */
827
901
  sendMediaMessage(conversationRef: MSRPConversationRef, uploadResult: MSRPUploadResult, caption?: string): boolean;
828
902
  sendReaction(conversationRef: MSRPConversationRef, targetEventId: string, emoji: string, action?: MSRPReactionAction): boolean;
829
903
  /** Convenience wrapper to remove a previously added reaction. */
@@ -865,16 +939,20 @@ declare class MSRPModule {
865
939
  * Ask the server for a presigned upload URL. Resolves with the upload
866
940
  * metadata once the matching `m.upload.response` arrives, or rejects
867
941
  * after `uploadRequestTimeoutMs`.
942
+ *
943
+ * Optional `caption` is stored on the upload token (server-side media
944
+ * commit). Whitespace-only is treated as absent. Max 1024 chars after trim.
868
945
  */
869
- requestUploadUrl(conversationRef: MSRPConversationRef, filename: string, mimeType: string, fileSize: number): Promise<MSRPUploadResult>;
946
+ requestUploadUrl(conversationRef: MSRPConversationRef, filename: string, mimeType: string, fileSize: number, caption?: string): Promise<MSRPUploadResult>;
870
947
  /**
871
948
  * Ask the server for a one-shot download URL. Resolves with the URL,
872
949
  * rejects on timeout or explicit server error.
873
950
  */
874
951
  requestFileAccess(conversationRef: MSRPConversationRef, eventId: string): Promise<string>;
875
952
  /**
876
- * High-level helper: request a presigned URL, POST the file to it, then
877
- * send the resulting media message into the conversation in one go.
953
+ * High-level helper: request a presigned URL and POST the file to it.
954
+ * The server commits the media (and optional caption) as a single
955
+ * `m.conversation.message` — do not send a separate text event.
878
956
  */
879
957
  uploadFile(conversationRef: MSRPConversationRef, file: File, caption?: string): Promise<MSRPUploadResult>;
880
958
  private processIncomingMSRPMessage;
@@ -883,6 +961,10 @@ declare class MSRPModule {
883
961
  private handleIncomingConversationCreate;
884
962
  private handleIncomingConversationMessage;
885
963
  private handleIncomingMessageDelete;
964
+ private handleIncomingMessageHide;
965
+ private handleIncomingConversationTag;
966
+ private handleIncomingMessageTag;
967
+ private handleIncomingError;
886
968
  private handleIncomingConversationReopen;
887
969
  private handleIncomingPresence;
888
970
  private handleIncomingConversationClosed;
@@ -1155,6 +1237,22 @@ declare type msrpSyncCompletedListener = (payload: {
1155
1237
  messagesByConversation: { [key: string]: any[] }
1156
1238
  }) => void
1157
1239
 
1240
+ export declare interface MSRPTag {
1241
+ name: string
1242
+ color?: string
1243
+ added_by?: string
1244
+ added_at?: number
1245
+ }
1246
+
1247
+ declare interface MSRPTag_2 {
1248
+ name: string
1249
+ color?: string
1250
+ added_by?: string
1251
+ added_at?: number
1252
+ }
1253
+
1254
+ export declare type MSRPTagAction = 'add' | 'remove';
1255
+
1158
1256
  declare type msrpTypingListener = (payload: {
1159
1257
  conversation_id?: number
1160
1258
  sender: string
@@ -1244,6 +1342,10 @@ export declare interface OpenSIPSEventMap extends UAEventMap {
1244
1342
  msrpTyping: msrpTypingListener
1245
1343
  msrpMessageEdited: msrpMessageEditedListener
1246
1344
  msrpMessageDeleted: msrpMessageDeletedListener
1345
+ msrpMessageHidden: msrpMessageHiddenListener
1346
+ msrpConversationTagged: msrpConversationTaggedListener
1347
+ msrpMessageTagged: msrpMessageTaggedListener
1348
+ msrpError: msrpErrorListener
1247
1349
  msrpPresence: msrpPresenceListener
1248
1350
  // JANUS
1249
1351
  conferenceStart: conferenceStartListener
@@ -1285,9 +1387,9 @@ declare class OpenSIPSJS extends UAExtended {
1285
1387
  isWaitingForSessionHangup(): boolean;
1286
1388
  stopSessionAfterWaiting(): void;
1287
1389
  private get hasActiveSessions();
1288
- on<T extends ListenersKeyType>(type: T, listener: ListenerCallbackFnType<T>): this;
1289
- off<T extends ListenersKeyType>(type: T, listener: ListenerCallbackFnType<T>): this;
1290
- emit(type: ListenersKeyType, args: any): boolean;
1390
+ on<T extends ListenersKeyType>(type: T, listener: ListenerCallbackFnType<T>): any;
1391
+ off<T extends ListenersKeyType>(type: T, listener: ListenerCallbackFnType<T>): any;
1392
+ emit(type: ListenersKeyType, args: any): any;
1291
1393
  get sipDomain(): string;
1292
1394
  use(plugin: BaseNewStreamPlugin | BaseProcessStreamPlugin): void;
1293
1395
  getPlugin(name: string): BaseNewStreamPlugin | BaseProcessStreamPlugin;