@memberjunction/communication-types 2.123.1 → 2.125.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.
@@ -1,5 +1,7 @@
1
+ /// <reference types="node" />
1
2
  import { UserInfo } from "@memberjunction/core";
2
3
  import { CommunicationProviderEntity, CommunicationProviderMessageTypeEntity, CommunicationRunEntity, TemplateEntityExtended } from "@memberjunction/core-entities";
4
+ import { ProviderCredentialsBase } from "./CredentialUtils";
3
5
  /**
4
6
  * Information about a single recipient
5
7
  */
@@ -229,34 +231,516 @@ export type CreateDraftResult<T = Record<string, any>> = BaseMessageResult & {
229
231
  */
230
232
  Result?: T;
231
233
  };
234
+ /**
235
+ * Parameters for getting a single message by ID
236
+ */
237
+ export type GetSingleMessageParams<T = Record<string, any>> = {
238
+ /**
239
+ * The ID of the message to retrieve
240
+ */
241
+ MessageID: string;
242
+ /**
243
+ * Optional, include the headers in the response (defaults to false)
244
+ */
245
+ IncludeHeaders?: boolean;
246
+ /**
247
+ * Optional, include attachments metadata in the response (defaults to false)
248
+ */
249
+ IncludeAttachments?: boolean;
250
+ /**
251
+ * Optional, provider-specific context data
252
+ */
253
+ ContextData?: T;
254
+ };
255
+ /**
256
+ * Result of getting a single message
257
+ */
258
+ export type GetSingleMessageResult<T = Record<string, any>> = BaseMessageResult & {
259
+ /**
260
+ * The retrieved message in standardized format
261
+ */
262
+ Message?: GetMessageMessage;
263
+ /**
264
+ * If populated, holds provider-specific data that is returned from the provider
265
+ */
266
+ SourceData?: T;
267
+ };
268
+ /**
269
+ * Parameters for deleting a message
270
+ */
271
+ export type DeleteMessageParams<T = Record<string, any>> = {
272
+ /**
273
+ * The ID of the message to delete
274
+ */
275
+ MessageID: string;
276
+ /**
277
+ * If true, permanently delete the message. If false, move to trash (if supported).
278
+ * Defaults to false.
279
+ */
280
+ PermanentDelete?: boolean;
281
+ /**
282
+ * Optional, provider-specific context data
283
+ */
284
+ ContextData?: T;
285
+ };
286
+ /**
287
+ * Result of deleting a message
288
+ */
289
+ export type DeleteMessageResult<T = Record<string, any>> = BaseMessageResult & {
290
+ /**
291
+ * If populated, holds provider-specific result data
292
+ */
293
+ Result?: T;
294
+ };
295
+ /**
296
+ * Parameters for moving a message to a different folder
297
+ */
298
+ export type MoveMessageParams<T = Record<string, any>> = {
299
+ /**
300
+ * The ID of the message to move
301
+ */
302
+ MessageID: string;
303
+ /**
304
+ * The ID of the destination folder
305
+ */
306
+ DestinationFolderID: string;
307
+ /**
308
+ * Optional, provider-specific context data
309
+ */
310
+ ContextData?: T;
311
+ };
312
+ /**
313
+ * Result of moving a message
314
+ */
315
+ export type MoveMessageResult<T = Record<string, any>> = BaseMessageResult & {
316
+ /**
317
+ * The new message ID after moving (some providers assign new IDs)
318
+ */
319
+ NewMessageID?: string;
320
+ /**
321
+ * If populated, holds provider-specific result data
322
+ */
323
+ Result?: T;
324
+ };
325
+ /**
326
+ * Represents a folder/mailbox in the provider's system
327
+ */
328
+ export type MessageFolder = {
329
+ /**
330
+ * The unique ID of the folder
331
+ */
332
+ ID: string;
333
+ /**
334
+ * The display name of the folder
335
+ */
336
+ Name: string;
337
+ /**
338
+ * The ID of the parent folder, if any
339
+ */
340
+ ParentFolderID?: string;
341
+ /**
342
+ * The number of messages in the folder (if available)
343
+ */
344
+ MessageCount?: number;
345
+ /**
346
+ * The number of unread messages in the folder (if available)
347
+ */
348
+ UnreadCount?: number;
349
+ /**
350
+ * Whether this is a system folder (Inbox, Sent, Drafts, etc.)
351
+ */
352
+ IsSystemFolder?: boolean;
353
+ /**
354
+ * The type of system folder if IsSystemFolder is true
355
+ */
356
+ SystemFolderType?: 'inbox' | 'sent' | 'drafts' | 'trash' | 'spam' | 'archive' | 'other';
357
+ };
358
+ /**
359
+ * Parameters for listing folders
360
+ */
361
+ export type ListFoldersParams<T = Record<string, any>> = {
362
+ /**
363
+ * Optional, the ID of the parent folder to list children of.
364
+ * If not provided, lists root-level folders.
365
+ */
366
+ ParentFolderID?: string;
367
+ /**
368
+ * Optional, include message counts in the response (defaults to false)
369
+ */
370
+ IncludeCounts?: boolean;
371
+ /**
372
+ * Optional, provider-specific context data
373
+ */
374
+ ContextData?: T;
375
+ };
376
+ /**
377
+ * Result of listing folders
378
+ */
379
+ export type ListFoldersResult<T = Record<string, any>> = BaseMessageResult & {
380
+ /**
381
+ * The list of folders
382
+ */
383
+ Folders?: MessageFolder[];
384
+ /**
385
+ * If populated, holds provider-specific result data
386
+ */
387
+ Result?: T;
388
+ };
389
+ /**
390
+ * Parameters for marking message(s) as read or unread
391
+ */
392
+ export type MarkAsReadParams<T = Record<string, any>> = {
393
+ /**
394
+ * The ID(s) of the message(s) to mark
395
+ */
396
+ MessageIDs: string[];
397
+ /**
398
+ * Whether to mark as read (true) or unread (false)
399
+ */
400
+ IsRead: boolean;
401
+ /**
402
+ * Optional, provider-specific context data
403
+ */
404
+ ContextData?: T;
405
+ };
406
+ /**
407
+ * Result of marking message(s) as read/unread
408
+ */
409
+ export type MarkAsReadResult<T = Record<string, any>> = BaseMessageResult & {
410
+ /**
411
+ * If populated, holds provider-specific result data
412
+ */
413
+ Result?: T;
414
+ };
415
+ /**
416
+ * Parameters for archiving a message
417
+ */
418
+ export type ArchiveMessageParams<T = Record<string, any>> = {
419
+ /**
420
+ * The ID of the message to archive
421
+ */
422
+ MessageID: string;
423
+ /**
424
+ * Optional, provider-specific context data
425
+ */
426
+ ContextData?: T;
427
+ };
428
+ /**
429
+ * Result of archiving a message
430
+ */
431
+ export type ArchiveMessageResult<T = Record<string, any>> = BaseMessageResult & {
432
+ /**
433
+ * If populated, holds provider-specific result data
434
+ */
435
+ Result?: T;
436
+ };
437
+ /**
438
+ * Parameters for searching messages
439
+ */
440
+ export type SearchMessagesParams<T = Record<string, any>> = {
441
+ /**
442
+ * The search query string
443
+ */
444
+ Query: string;
445
+ /**
446
+ * Maximum number of results to return
447
+ */
448
+ MaxResults?: number;
449
+ /**
450
+ * Optional folder ID to limit search scope
451
+ */
452
+ FolderID?: string;
453
+ /**
454
+ * Optional date range start
455
+ */
456
+ FromDate?: Date;
457
+ /**
458
+ * Optional date range end
459
+ */
460
+ ToDate?: Date;
461
+ /**
462
+ * Optional, search only in specific fields
463
+ */
464
+ SearchIn?: ('subject' | 'body' | 'from' | 'to' | 'all')[];
465
+ /**
466
+ * Optional, provider-specific context data
467
+ */
468
+ ContextData?: T;
469
+ };
470
+ /**
471
+ * Result of searching messages
472
+ */
473
+ export type SearchMessagesResult<T = Record<string, any>> = BaseMessageResult & {
474
+ /**
475
+ * Messages matching the search criteria
476
+ */
477
+ Messages?: GetMessageMessage[];
478
+ /**
479
+ * Total number of matches (may be greater than returned results)
480
+ */
481
+ TotalCount?: number;
482
+ /**
483
+ * If populated, holds provider-specific result data
484
+ */
485
+ SourceData?: T[];
486
+ };
487
+ /**
488
+ * Represents an attachment on a message
489
+ */
490
+ export type MessageAttachment = {
491
+ /**
492
+ * The unique ID of the attachment
493
+ */
494
+ ID: string;
495
+ /**
496
+ * The filename of the attachment
497
+ */
498
+ Filename: string;
499
+ /**
500
+ * The MIME type of the attachment
501
+ */
502
+ ContentType: string;
503
+ /**
504
+ * The size of the attachment in bytes
505
+ */
506
+ Size: number;
507
+ /**
508
+ * Whether this is an inline attachment (embedded in message body)
509
+ */
510
+ IsInline?: boolean;
511
+ /**
512
+ * Content ID for inline attachments
513
+ */
514
+ ContentID?: string;
515
+ };
516
+ /**
517
+ * Parameters for listing attachments on a message
518
+ */
519
+ export type ListAttachmentsParams<T = Record<string, any>> = {
520
+ /**
521
+ * The ID of the message to list attachments for
522
+ */
523
+ MessageID: string;
524
+ /**
525
+ * Optional, provider-specific context data
526
+ */
527
+ ContextData?: T;
528
+ };
529
+ /**
530
+ * Result of listing attachments
531
+ */
532
+ export type ListAttachmentsResult<T = Record<string, any>> = BaseMessageResult & {
533
+ /**
534
+ * The list of attachments
535
+ */
536
+ Attachments?: MessageAttachment[];
537
+ /**
538
+ * If populated, holds provider-specific result data
539
+ */
540
+ Result?: T;
541
+ };
542
+ /**
543
+ * Parameters for downloading an attachment
544
+ */
545
+ export type DownloadAttachmentParams<T = Record<string, any>> = {
546
+ /**
547
+ * The ID of the message containing the attachment
548
+ */
549
+ MessageID: string;
550
+ /**
551
+ * The ID of the attachment to download
552
+ */
553
+ AttachmentID: string;
554
+ /**
555
+ * Optional, provider-specific context data
556
+ */
557
+ ContextData?: T;
558
+ };
559
+ /**
560
+ * Result of downloading an attachment
561
+ */
562
+ export type DownloadAttachmentResult<T = Record<string, any>> = BaseMessageResult & {
563
+ /**
564
+ * The attachment content as a Buffer
565
+ */
566
+ Content?: Buffer;
567
+ /**
568
+ * The attachment content as a base64-encoded string
569
+ */
570
+ ContentBase64?: string;
571
+ /**
572
+ * The filename of the attachment
573
+ */
574
+ Filename?: string;
575
+ /**
576
+ * The MIME type of the attachment
577
+ */
578
+ ContentType?: string;
579
+ /**
580
+ * If populated, holds provider-specific result data
581
+ */
582
+ Result?: T;
583
+ };
584
+ /**
585
+ * Enumeration of all supported provider operations.
586
+ * Use with getSupportedOperations() to discover provider capabilities.
587
+ */
588
+ export type ProviderOperation = 'SendSingleMessage' | 'GetMessages' | 'GetSingleMessage' | 'ForwardMessage' | 'ReplyToMessage' | 'CreateDraft' | 'DeleteMessage' | 'MoveMessage' | 'ListFolders' | 'MarkAsRead' | 'ArchiveMessage' | 'SearchMessages' | 'ListAttachments' | 'DownloadAttachment';
232
589
  /**
233
590
  * Base class for all communication providers. Each provider sub-classes this base class and implements functionality specific to the provider.
591
+ *
592
+ * @remarks
593
+ * All methods accept an optional `credentials` parameter that allows per-request credential overrides.
594
+ * When credentials are provided, they take precedence over environment variables.
595
+ * Set `credentials.disableEnvironmentFallback = true` to disable environment variable fallback.
596
+ *
597
+ * Each provider defines its own credential interface that extends `ProviderCredentialsBase`.
598
+ * For example, `SendGridCredentials`, `MSGraphCredentials`, etc.
599
+ *
600
+ * @example
601
+ * ```typescript
602
+ * // Use environment credentials (default behavior)
603
+ * await provider.SendSingleMessage(message);
604
+ *
605
+ * // Override with request credentials
606
+ * await provider.SendSingleMessage(message, { apiKey: 'SG.xxx' });
607
+ *
608
+ * // Require explicit credentials (no env fallback)
609
+ * await provider.SendSingleMessage(message, {
610
+ * apiKey: 'SG.xxx',
611
+ * disableEnvironmentFallback: true
612
+ * });
613
+ * ```
234
614
  */
235
615
  export declare abstract class BaseCommunicationProvider {
236
616
  /**
237
- *
617
+ * Sends a single message using the provider
618
+ * @param message - The processed message to send
619
+ * @param credentials - Optional credentials override for this request.
620
+ * Provider-specific credential interface (e.g., SendGridCredentials).
621
+ * If not provided, uses environment variables.
622
+ * @returns Promise<MessageResult> - Result of the send operation
238
623
  */
239
- abstract SendSingleMessage(message: ProcessedMessage): Promise<MessageResult>;
624
+ abstract SendSingleMessage(message: ProcessedMessage, credentials?: ProviderCredentialsBase): Promise<MessageResult>;
240
625
  /**
241
626
  * Fetches messages using the provider
627
+ * @param params - Parameters for fetching messages
628
+ * @param credentials - Optional credentials override for this request
629
+ * @returns Promise<GetMessagesResult> - Retrieved messages
242
630
  */
243
- abstract GetMessages(params: GetMessagesParams): Promise<GetMessagesResult>;
631
+ abstract GetMessages(params: GetMessagesParams, credentials?: ProviderCredentialsBase): Promise<GetMessagesResult>;
244
632
  /**
245
633
  * Forwards a message to another client using the provider
634
+ * @param params - Parameters for forwarding the message
635
+ * @param credentials - Optional credentials override for this request
636
+ * @returns Promise<ForwardMessageResult> - Result of the forward operation
246
637
  */
247
- abstract ForwardMessage(params: ForwardMessageParams): Promise<ForwardMessageResult>;
638
+ abstract ForwardMessage(params: ForwardMessageParams, credentials?: ProviderCredentialsBase): Promise<ForwardMessageResult>;
248
639
  /**
249
640
  * Replies to a message using the provider
641
+ * @param params - Parameters for replying to the message
642
+ * @param credentials - Optional credentials override for this request
643
+ * @returns Promise<ReplyToMessageResult> - Result of the reply operation
250
644
  */
251
- abstract ReplyToMessage(params: ReplyToMessageParams): Promise<ReplyToMessageResult>;
645
+ abstract ReplyToMessage(params: ReplyToMessageParams, credentials?: ProviderCredentialsBase): Promise<ReplyToMessageResult>;
252
646
  /**
253
647
  * Creates a draft message using the provider.
254
648
  * Providers that don't support drafts should return Success: false
255
649
  * with an appropriate error message.
256
650
  * @param params - Parameters for creating the draft
651
+ * @param credentials - Optional credentials override for this request
257
652
  * @returns Promise<CreateDraftResult> - Result containing draft ID if successful
258
653
  */
259
- abstract CreateDraft(params: CreateDraftParams): Promise<CreateDraftResult>;
654
+ abstract CreateDraft(params: CreateDraftParams, credentials?: ProviderCredentialsBase): Promise<CreateDraftResult>;
655
+ /**
656
+ * Returns the name of this provider for use in error messages.
657
+ * Override in subclasses to provide a more descriptive name.
658
+ */
659
+ protected get ProviderName(): string;
660
+ /**
661
+ * Returns the list of operations supported by this provider.
662
+ * Override in subclasses to accurately reflect capabilities.
663
+ * Default implementation returns only the core abstract methods.
664
+ */
665
+ getSupportedOperations(): ProviderOperation[];
666
+ /**
667
+ * Checks if this provider supports a specific operation.
668
+ * @param operation - The operation to check
669
+ * @returns true if the operation is supported
670
+ */
671
+ supportsOperation(operation: ProviderOperation): boolean;
672
+ /**
673
+ * Gets a single message by ID.
674
+ * Override in subclasses that support this operation.
675
+ * @param params - Parameters for retrieving the message
676
+ * @param credentials - Optional credentials override for this request
677
+ * @returns Promise<GetSingleMessageResult> - The retrieved message
678
+ */
679
+ GetSingleMessage(params: GetSingleMessageParams, credentials?: ProviderCredentialsBase): Promise<GetSingleMessageResult>;
680
+ /**
681
+ * Deletes a message.
682
+ * Override in subclasses that support this operation.
683
+ * @param params - Parameters for deleting the message
684
+ * @param credentials - Optional credentials override for this request
685
+ * @returns Promise<DeleteMessageResult> - Result of the delete operation
686
+ */
687
+ DeleteMessage(params: DeleteMessageParams, credentials?: ProviderCredentialsBase): Promise<DeleteMessageResult>;
688
+ /**
689
+ * Moves a message to a different folder.
690
+ * Override in subclasses that support this operation.
691
+ * @param params - Parameters for moving the message
692
+ * @param credentials - Optional credentials override for this request
693
+ * @returns Promise<MoveMessageResult> - Result of the move operation
694
+ */
695
+ MoveMessage(params: MoveMessageParams, credentials?: ProviderCredentialsBase): Promise<MoveMessageResult>;
696
+ /**
697
+ * Lists folders/mailboxes available in the provider.
698
+ * Override in subclasses that support this operation.
699
+ * @param params - Parameters for listing folders
700
+ * @param credentials - Optional credentials override for this request
701
+ * @returns Promise<ListFoldersResult> - The list of folders
702
+ */
703
+ ListFolders(params: ListFoldersParams, credentials?: ProviderCredentialsBase): Promise<ListFoldersResult>;
704
+ /**
705
+ * Marks message(s) as read or unread.
706
+ * Override in subclasses that support this operation.
707
+ * @param params - Parameters for marking messages
708
+ * @param credentials - Optional credentials override for this request
709
+ * @returns Promise<MarkAsReadResult> - Result of the operation
710
+ */
711
+ MarkAsRead(params: MarkAsReadParams, credentials?: ProviderCredentialsBase): Promise<MarkAsReadResult>;
712
+ /**
713
+ * Archives a message.
714
+ * Override in subclasses that support this operation.
715
+ * @param params - Parameters for archiving the message
716
+ * @param credentials - Optional credentials override for this request
717
+ * @returns Promise<ArchiveMessageResult> - Result of the archive operation
718
+ */
719
+ ArchiveMessage(params: ArchiveMessageParams, credentials?: ProviderCredentialsBase): Promise<ArchiveMessageResult>;
720
+ /**
721
+ * Searches messages using a query string.
722
+ * Override in subclasses that support this operation.
723
+ * @param params - Parameters for searching messages
724
+ * @param credentials - Optional credentials override for this request
725
+ * @returns Promise<SearchMessagesResult> - Messages matching the search criteria
726
+ */
727
+ SearchMessages(params: SearchMessagesParams, credentials?: ProviderCredentialsBase): Promise<SearchMessagesResult>;
728
+ /**
729
+ * Lists attachments on a message.
730
+ * Override in subclasses that support this operation.
731
+ * @param params - Parameters for listing attachments
732
+ * @param credentials - Optional credentials override for this request
733
+ * @returns Promise<ListAttachmentsResult> - The list of attachments
734
+ */
735
+ ListAttachments(params: ListAttachmentsParams, credentials?: ProviderCredentialsBase): Promise<ListAttachmentsResult>;
736
+ /**
737
+ * Downloads an attachment from a message.
738
+ * Override in subclasses that support this operation.
739
+ * @param params - Parameters for downloading the attachment
740
+ * @param credentials - Optional credentials override for this request
741
+ * @returns Promise<DownloadAttachmentResult> - The attachment content
742
+ */
743
+ DownloadAttachment(params: DownloadAttachmentParams, credentials?: ProviderCredentialsBase): Promise<DownloadAttachmentResult>;
260
744
  }
261
745
  export declare class CommunicationProviderEntityExtended extends CommunicationProviderEntity {
262
746
  private _ProviderMessageTypes;
@@ -1 +1 @@
1
- {"version":3,"file":"BaseProvider.d.ts","sourceRoot":"","sources":["../src/BaseProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,2BAA2B,EAAE,sCAAsC,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEpK;;GAEG;AACH,qBAAa,gBAAgB;IACzB;;;OAGG;IACI,EAAE,EAAE,MAAM,CAAC;IAClB;;OAEG;IACI,QAAQ,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACI,WAAW,EAAE,GAAG,CAAC;CAC3B;AAGD;;GAEG;AACH,qBAAa,OAAO;IAChB;;OAEG;IACI,WAAW,EAAE,sCAAsC,CAAC;IAE3D;;;OAGG;IACI,IAAI,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACI,QAAQ,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACI,EAAE,EAAE,MAAM,CAAC;IAElB;;OAEG;IACI,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/B;;OAEG;IACI,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhC;;OAEG;IACI,MAAM,CAAC,EAAE,IAAI,CAAC;IAErB;;OAEG;IACI,IAAI,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACI,YAAY,CAAC,EAAE,sBAAsB,CAAC;IAE7C;;OAEG;IACI,QAAQ,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACI,gBAAgB,CAAC,EAAE,sBAAsB,CA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C,gBAAgB,CAAC;IAO5B;;;;;;OAMG;IACU,cAAc,CACvB,MAAM,EAAE,oBAAoB,EAC5B,WAAW,CAAC,EAAE,uBAAuB,GACtC,OAAO,CAAC,oBAAoB,CAAC;IAOhC;;;;;;OAMG;IACU,cAAc,CACvB,MAAM,EAAE,oBAAoB,EAC5B,WAAW,CAAC,EAAE,uBAAuB,GACtC,OAAO,CAAC,oBAAoB,CAAC;IAOhC;;;;;;OAMG;IACU,eAAe,CACxB,MAAM,EAAE,qBAAqB,EAC7B,WAAW,CAAC,EAAE,uBAAuB,GACtC,OAAO,CAAC,qBAAqB,CAAC;IAOjC;;;;;;OAMG;IACU,kBAAkB,CAC3B,MAAM,EAAE,wBAAwB,EAChC,WAAW,CAAC,EAAE,uBAAuB,GACtC,OAAO,CAAC,wBAAwB,CAAC;CAOvC;AAED,qBACa,mCAAoC,SAAQ,2BAA2B;IAChF,OAAO,CAAC,qBAAqB,CAA2C;IACxE,IAAW,YAAY,IAAI,sCAAsC,EAAE,CAElE;IACD,IAAW,YAAY,CAAC,KAAK,EAAE,sCAAsC,EAAE,EAEtE;CACJ"}
@@ -43,8 +43,175 @@ exports.MessageResult = MessageResult;
43
43
  ;
44
44
  /**
45
45
  * Base class for all communication providers. Each provider sub-classes this base class and implements functionality specific to the provider.
46
+ *
47
+ * @remarks
48
+ * All methods accept an optional `credentials` parameter that allows per-request credential overrides.
49
+ * When credentials are provided, they take precedence over environment variables.
50
+ * Set `credentials.disableEnvironmentFallback = true` to disable environment variable fallback.
51
+ *
52
+ * Each provider defines its own credential interface that extends `ProviderCredentialsBase`.
53
+ * For example, `SendGridCredentials`, `MSGraphCredentials`, etc.
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * // Use environment credentials (default behavior)
58
+ * await provider.SendSingleMessage(message);
59
+ *
60
+ * // Override with request credentials
61
+ * await provider.SendSingleMessage(message, { apiKey: 'SG.xxx' });
62
+ *
63
+ * // Require explicit credentials (no env fallback)
64
+ * await provider.SendSingleMessage(message, {
65
+ * apiKey: 'SG.xxx',
66
+ * disableEnvironmentFallback: true
67
+ * });
68
+ * ```
46
69
  */
47
70
  class BaseCommunicationProvider {
71
+ // ========================================================================
72
+ // OPTIONAL OPERATIONS - Override in subclasses to provide implementation
73
+ // Default implementations return "not supported" error
74
+ // ========================================================================
75
+ /**
76
+ * Returns the name of this provider for use in error messages.
77
+ * Override in subclasses to provide a more descriptive name.
78
+ */
79
+ get ProviderName() {
80
+ return this.constructor.name;
81
+ }
82
+ /**
83
+ * Returns the list of operations supported by this provider.
84
+ * Override in subclasses to accurately reflect capabilities.
85
+ * Default implementation returns only the core abstract methods.
86
+ */
87
+ getSupportedOperations() {
88
+ return ['SendSingleMessage', 'GetMessages', 'ForwardMessage', 'ReplyToMessage', 'CreateDraft'];
89
+ }
90
+ /**
91
+ * Checks if this provider supports a specific operation.
92
+ * @param operation - The operation to check
93
+ * @returns true if the operation is supported
94
+ */
95
+ supportsOperation(operation) {
96
+ return this.getSupportedOperations().includes(operation);
97
+ }
98
+ /**
99
+ * Gets a single message by ID.
100
+ * Override in subclasses that support this operation.
101
+ * @param params - Parameters for retrieving the message
102
+ * @param credentials - Optional credentials override for this request
103
+ * @returns Promise<GetSingleMessageResult> - The retrieved message
104
+ */
105
+ async GetSingleMessage(params, credentials) {
106
+ return {
107
+ Success: false,
108
+ ErrorMessage: `${this.ProviderName} does not support GetSingleMessage (MessageID: ${params.MessageID}, credentials provided: ${!!credentials})`
109
+ };
110
+ }
111
+ /**
112
+ * Deletes a message.
113
+ * Override in subclasses that support this operation.
114
+ * @param params - Parameters for deleting the message
115
+ * @param credentials - Optional credentials override for this request
116
+ * @returns Promise<DeleteMessageResult> - Result of the delete operation
117
+ */
118
+ async DeleteMessage(params, credentials) {
119
+ return {
120
+ Success: false,
121
+ ErrorMessage: `${this.ProviderName} does not support DeleteMessage (MessageID: ${params.MessageID}, credentials provided: ${!!credentials})`
122
+ };
123
+ }
124
+ /**
125
+ * Moves a message to a different folder.
126
+ * Override in subclasses that support this operation.
127
+ * @param params - Parameters for moving the message
128
+ * @param credentials - Optional credentials override for this request
129
+ * @returns Promise<MoveMessageResult> - Result of the move operation
130
+ */
131
+ async MoveMessage(params, credentials) {
132
+ return {
133
+ Success: false,
134
+ ErrorMessage: `${this.ProviderName} does not support MoveMessage (MessageID: ${params.MessageID}, DestinationFolderID: ${params.DestinationFolderID}, credentials provided: ${!!credentials})`
135
+ };
136
+ }
137
+ /**
138
+ * Lists folders/mailboxes available in the provider.
139
+ * Override in subclasses that support this operation.
140
+ * @param params - Parameters for listing folders
141
+ * @param credentials - Optional credentials override for this request
142
+ * @returns Promise<ListFoldersResult> - The list of folders
143
+ */
144
+ async ListFolders(params, credentials) {
145
+ return {
146
+ Success: false,
147
+ ErrorMessage: `${this.ProviderName} does not support ListFolders (ParentFolderID: ${params.ParentFolderID || 'root'}, credentials provided: ${!!credentials})`
148
+ };
149
+ }
150
+ /**
151
+ * Marks message(s) as read or unread.
152
+ * Override in subclasses that support this operation.
153
+ * @param params - Parameters for marking messages
154
+ * @param credentials - Optional credentials override for this request
155
+ * @returns Promise<MarkAsReadResult> - Result of the operation
156
+ */
157
+ async MarkAsRead(params, credentials) {
158
+ return {
159
+ Success: false,
160
+ ErrorMessage: `${this.ProviderName} does not support MarkAsRead (MessageIDs: ${params.MessageIDs.length} message(s), IsRead: ${params.IsRead}, credentials provided: ${!!credentials})`
161
+ };
162
+ }
163
+ /**
164
+ * Archives a message.
165
+ * Override in subclasses that support this operation.
166
+ * @param params - Parameters for archiving the message
167
+ * @param credentials - Optional credentials override for this request
168
+ * @returns Promise<ArchiveMessageResult> - Result of the archive operation
169
+ */
170
+ async ArchiveMessage(params, credentials) {
171
+ return {
172
+ Success: false,
173
+ ErrorMessage: `${this.ProviderName} does not support ArchiveMessage (MessageID: ${params.MessageID}, credentials provided: ${!!credentials})`
174
+ };
175
+ }
176
+ /**
177
+ * Searches messages using a query string.
178
+ * Override in subclasses that support this operation.
179
+ * @param params - Parameters for searching messages
180
+ * @param credentials - Optional credentials override for this request
181
+ * @returns Promise<SearchMessagesResult> - Messages matching the search criteria
182
+ */
183
+ async SearchMessages(params, credentials) {
184
+ return {
185
+ Success: false,
186
+ ErrorMessage: `${this.ProviderName} does not support SearchMessages (Query: ${params.Query}, credentials provided: ${!!credentials})`
187
+ };
188
+ }
189
+ /**
190
+ * Lists attachments on a message.
191
+ * Override in subclasses that support this operation.
192
+ * @param params - Parameters for listing attachments
193
+ * @param credentials - Optional credentials override for this request
194
+ * @returns Promise<ListAttachmentsResult> - The list of attachments
195
+ */
196
+ async ListAttachments(params, credentials) {
197
+ return {
198
+ Success: false,
199
+ ErrorMessage: `${this.ProviderName} does not support ListAttachments (MessageID: ${params.MessageID}, credentials provided: ${!!credentials})`
200
+ };
201
+ }
202
+ /**
203
+ * Downloads an attachment from a message.
204
+ * Override in subclasses that support this operation.
205
+ * @param params - Parameters for downloading the attachment
206
+ * @param credentials - Optional credentials override for this request
207
+ * @returns Promise<DownloadAttachmentResult> - The attachment content
208
+ */
209
+ async DownloadAttachment(params, credentials) {
210
+ return {
211
+ Success: false,
212
+ ErrorMessage: `${this.ProviderName} does not support DownloadAttachment (MessageID: ${params.MessageID}, AttachmentID: ${params.AttachmentID}, credentials provided: ${!!credentials})`
213
+ };
214
+ }
48
215
  }
49
216
  exports.BaseCommunicationProvider = BaseCommunicationProvider;
50
217
  let CommunicationProviderEntityExtended = class CommunicationProviderEntityExtended extends core_entities_1.CommunicationProviderEntity {
@@ -1 +1 @@
1
- {"version":3,"file":"BaseProvider.js","sourceRoot":"","sources":["../src/BaseProvider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAA4D;AAC5D,mDAAuD;AACvD,iEAAoK;AAEpK;;GAEG;AACH,MAAa,gBAAgB;CAe5B;AAfD,4CAeC;AAGD;;GAEG;AACH,MAAa,OAAO;IAgFhB,YAAY,QAAkB;QAC1B,yEAAyE;QACzE,IAAI,QAAQ,EAAC,CAAC;YACV,MAAM,CAAC,MA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AAY,2BAA2B,CAAC,CAAC,WAAW,GAAG;SAC1L,CAAC;IACN,CAAC;CAEJ;AApPD,8DAoPC;AAGM,IAAM,mCAAmC,GAAzC,MAAM,mCAAoC,SAAQ,2CAA2B;IAEhF,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACtC,CAAC;IACD,IAAW,YAAY,CAAC,KAA+C;QACnE,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;IACvC,CAAC;CACJ,CAAA;AARY,kFAAmC;8CAAnC,mCAAmC;IAD/C,IAAA,sBAAa,EAAC,iBAAU,EAAE,yBAAyB,CAAC,CAAC,wDAAwD;GACjG,mCAAmC,CAQ/C"}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Credential utilities for MemberJunction Communication providers.
3
+ *
4
+ * This module provides interim credential management functionality that allows
5
+ * per-request credential overrides while maintaining backward compatibility
6
+ * with environment variable-based configuration.
7
+ *
8
+ * @module CredentialUtils
9
+ */
10
+ /**
11
+ * Base interface for provider credentials.
12
+ * Each provider extends this with their specific credential fields.
13
+ *
14
+ * @remarks
15
+ * **TEMPORARY INTERFACE**: This interface is an interim solution for the 2.x patch release.
16
+ * In MemberJunction 3.0, this will be replaced by a more comprehensive credential management
17
+ * system with database storage, encryption, and multi-tenancy support. The replacement
18
+ * interface will be located in `@memberjunction/credentials` or `@memberjunction/core`.
19
+ *
20
+ * This interface is designed to be forward-compatible with the 3.0 `CredentialResolutionOptions`
21
+ * system. When migrating to 3.0, credential objects passed using this interface will work
22
+ * with the new system's `directValues` parameter.
23
+ *
24
+ * @see plans/3_0_credentials_design.md for the full 3.0 credential system design
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * // Provider-specific credentials extend this base
29
+ * interface SendGridCredentials extends ProviderCredentialsBase {
30
+ * apiKey?: string;
31
+ * }
32
+ *
33
+ * // Usage with fallback enabled (default)
34
+ * await provider.SendSingleMessage(message, { apiKey: 'SG.xxx' });
35
+ *
36
+ * // Usage with fallback disabled
37
+ * await provider.SendSingleMessage(message, {
38
+ * apiKey: 'SG.xxx',
39
+ * disableEnvironmentFallback: true
40
+ * });
41
+ * ```
42
+ */
43
+ export interface ProviderCredentialsBase {
44
+ /**
45
+ * When true, environment variable fallback is DISABLED for this request.
46
+ * If credentials are incomplete and this is true, the request will fail
47
+ * rather than falling back to environment variables.
48
+ *
49
+ * @default false (fallback enabled for backward compatibility)
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * // With fallback (default) - uses env var if apiKey not provided
54
+ * await provider.SendSingleMessage(message, {});
55
+ *
56
+ * // Without fallback - fails if apiKey not provided
57
+ * await provider.SendSingleMessage(message, {
58
+ * disableEnvironmentFallback: true
59
+ * });
60
+ * ```
61
+ */
62
+ disableEnvironmentFallback?: boolean;
63
+ }
64
+ /**
65
+ * Resolves a single credential value by checking the request value first,
66
+ * then falling back to the environment value if allowed.
67
+ *
68
+ * @param requestValue - Value provided in the request (takes precedence)
69
+ * @param envValue - Value from environment variable (fallback)
70
+ * @param disableFallback - If true, don't use the environment value
71
+ * @returns The resolved value, or undefined if not available
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const apiKey = resolveCredentialValue(
76
+ * credentials?.apiKey, // From request
77
+ * process.env.SENDGRID_API_KEY, // From environment
78
+ * credentials?.disableEnvironmentFallback ?? false
79
+ * );
80
+ * ```
81
+ */
82
+ export declare function resolveCredentialValue<T>(requestValue: T | undefined, envValue: T | undefined, disableFallback: boolean): T | undefined;
83
+ /**
84
+ * Validates that all required credential fields are present in the resolved credentials.
85
+ * Throws an error if any required fields are missing.
86
+ *
87
+ * @param resolved - Object containing resolved credential values
88
+ * @param requiredFields - Array of field names that must be present
89
+ * @param providerName - Name of the provider (for error messages)
90
+ * @throws Error if any required fields are missing
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * const resolved = {
95
+ * apiKey: resolveCredentialValue(creds?.apiKey, envApiKey, disableFallback)
96
+ * };
97
+ *
98
+ * validateRequiredCredentials(resolved, ['apiKey'], 'SendGrid');
99
+ * // Throws: "Missing required credentials for SendGrid: apiKey. Provide in request or set environment variables."
100
+ * ```
101
+ */
102
+ export declare function validateRequiredCredentials(resolved: Record<string, unknown>, requiredFields: string[], providerName: string): void;
103
+ /**
104
+ * Result of credential resolution, tracking where each value came from.
105
+ * Useful for debugging and audit logging.
106
+ *
107
+ * @remarks
108
+ * This interface is designed to be forward-compatible with the 3.0 credential
109
+ * system's `ResolvedCredential` interface.
110
+ */
111
+ export interface CredentialResolutionResult<T extends Record<string, unknown>> {
112
+ /**
113
+ * The resolved credential values
114
+ */
115
+ values: T;
116
+ /**
117
+ * Source of the credentials: 'request', 'environment', or 'mixed'
118
+ */
119
+ source: 'request' | 'environment' | 'mixed';
120
+ /**
121
+ * Which fields came from request vs environment (for debugging)
122
+ */
123
+ fieldSources: Record<keyof T, 'request' | 'environment'>;
124
+ }
125
+ /**
126
+ * Resolves multiple credential fields at once, tracking the source of each value.
127
+ *
128
+ * @param requestCredentials - Credentials provided in the request
129
+ * @param envCredentials - Credentials from environment variables
130
+ * @param fieldNames - Array of field names to resolve
131
+ * @param disableFallback - If true, don't use environment values
132
+ * @returns Resolution result with values and source tracking
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * const result = resolveCredentials(
137
+ * credentials,
138
+ * { tenantId: process.env.AZURE_TENANT_ID, clientId: process.env.AZURE_CLIENT_ID },
139
+ * ['tenantId', 'clientId', 'clientSecret'],
140
+ * credentials?.disableEnvironmentFallback ?? false
141
+ * );
142
+ *
143
+ * console.log(result.source); // 'mixed' if some from request, some from env
144
+ * console.log(result.fieldSources); // { tenantId: 'request', clientId: 'environment', ... }
145
+ * ```
146
+ */
147
+ export declare function resolveCredentials<T extends Record<string, unknown>>(requestCredentials: Partial<T> | undefined, envCredentials: Partial<T>, fieldNames: (keyof T)[], disableFallback: boolean): CredentialResolutionResult<Partial<T>>;
148
+ //# sourceMappingURL=CredentialUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Credential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,CAAC,CAAC,CAkCxC"}
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ /**
3
+ * Credential utilities for MemberJunction Communication providers.
4
+ *
5
+ * This module provides interim credential management functionality that allows
6
+ * per-request credential overrides while maintaining backward compatibility
7
+ * with environment variable-based configuration.
8
+ *
9
+ * @module CredentialUtils
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.resolveCredentials = exports.validateRequiredCredentials = exports.resolveCredentialValue = void 0;
13
+ /**
14
+ * Resolves a single credential value by checking the request value first,
15
+ * then falling back to the environment value if allowed.
16
+ *
17
+ * @param requestValue - Value provided in the request (takes precedence)
18
+ * @param envValue - Value from environment variable (fallback)
19
+ * @param disableFallback - If true, don't use the environment value
20
+ * @returns The resolved value, or undefined if not available
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const apiKey = resolveCredentialValue(
25
+ * credentials?.apiKey, // From request
26
+ * process.env.SENDGRID_API_KEY, // From environment
27
+ * credentials?.disableEnvironmentFallback ?? false
28
+ * );
29
+ * ```
30
+ */
31
+ function resolveCredentialValue(requestValue, envValue, disableFallback) {
32
+ // Request value takes precedence if it's a non-empty value
33
+ if (requestValue !== undefined && requestValue !== null && requestValue !== '') {
34
+ return requestValue;
35
+ }
36
+ // Fall back to environment value if allowed
37
+ if (!disableFallback) {
38
+ return envValue;
39
+ }
40
+ return undefined;
41
+ }
42
+ exports.resolveCredentialValue = resolveCredentialValue;
43
+ /**
44
+ * Validates that all required credential fields are present in the resolved credentials.
45
+ * Throws an error if any required fields are missing.
46
+ *
47
+ * @param resolved - Object containing resolved credential values
48
+ * @param requiredFields - Array of field names that must be present
49
+ * @param providerName - Name of the provider (for error messages)
50
+ * @throws Error if any required fields are missing
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * const resolved = {
55
+ * apiKey: resolveCredentialValue(creds?.apiKey, envApiKey, disableFallback)
56
+ * };
57
+ *
58
+ * validateRequiredCredentials(resolved, ['apiKey'], 'SendGrid');
59
+ * // Throws: "Missing required credentials for SendGrid: apiKey. Provide in request or set environment variables."
60
+ * ```
61
+ */
62
+ function validateRequiredCredentials(resolved, requiredFields, providerName) {
63
+ const missing = requiredFields.filter(field => resolved[field] === undefined || resolved[field] === null || resolved[field] === '');
64
+ if (missing.length > 0) {
65
+ throw new Error(`Missing required credentials for ${providerName}: ${missing.join(', ')}. ` +
66
+ `Provide in request or set environment variables.`);
67
+ }
68
+ }
69
+ exports.validateRequiredCredentials = validateRequiredCredentials;
70
+ /**
71
+ * Resolves multiple credential fields at once, tracking the source of each value.
72
+ *
73
+ * @param requestCredentials - Credentials provided in the request
74
+ * @param envCredentials - Credentials from environment variables
75
+ * @param fieldNames - Array of field names to resolve
76
+ * @param disableFallback - If true, don't use environment values
77
+ * @returns Resolution result with values and source tracking
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * const result = resolveCredentials(
82
+ * credentials,
83
+ * { tenantId: process.env.AZURE_TENANT_ID, clientId: process.env.AZURE_CLIENT_ID },
84
+ * ['tenantId', 'clientId', 'clientSecret'],
85
+ * credentials?.disableEnvironmentFallback ?? false
86
+ * );
87
+ *
88
+ * console.log(result.source); // 'mixed' if some from request, some from env
89
+ * console.log(result.fieldSources); // { tenantId: 'request', clientId: 'environment', ... }
90
+ * ```
91
+ */
92
+ function resolveCredentials(requestCredentials, envCredentials, fieldNames, disableFallback) {
93
+ const values = {};
94
+ const fieldSources = {};
95
+ let hasRequest = false;
96
+ let hasEnv = false;
97
+ for (const field of fieldNames) {
98
+ const requestValue = requestCredentials?.[field];
99
+ const envValue = envCredentials[field];
100
+ // Check if request has a valid value
101
+ const requestHasValue = requestValue !== undefined && requestValue !== null && requestValue !== '';
102
+ const envHasValue = envValue !== undefined && envValue !== null && envValue !== '';
103
+ if (requestHasValue) {
104
+ values[field] = requestValue;
105
+ fieldSources[field] = 'request';
106
+ hasRequest = true;
107
+ }
108
+ else if (envHasValue && !disableFallback) {
109
+ values[field] = envValue;
110
+ fieldSources[field] = 'environment';
111
+ hasEnv = true;
112
+ }
113
+ }
114
+ const source = hasRequest && hasEnv ? 'mixed' :
115
+ hasRequest ? 'request' : 'environment';
116
+ return {
117
+ values,
118
+ source,
119
+ fieldSources: fieldSources
120
+ };
121
+ }
122
+ exports.resolveCredentials = resolveCredentials;
123
+ //# sourceMappingURL=CredentialUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CredentialUtils.js","sourceRoot":"","sources":["../src/CredentialUtils.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAyDH;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,sBAAsB,CAClC,YAA2B,EAC3B,QAAuB,EACvB,eAAwB;IAExB,2DAA2D;IAC3D,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,KAAK,IAAI,IAAI,YAAY,KAAK,EAAE,EAAE,CAAC;QAC7E,OAAO,YAAY,CAAC;IACxB,CAAC;IAED,4CAA4C;IAC5C,IAAI,CAAC,eAAe,EAAE,CAAC;QACnB,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAhBD,wDAgBC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,2BAA2B,CACvC,QAAiC,EACjC,cAAwB,EACxB,YAAoB;IAEpB,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CACjC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,CAC/F,CAAC;IAEF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CACX,oCAAoC,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAC3E,kDAAkD,CACrD,CAAC;IACN,CAAC;AACL,CAAC;AAfD,kEAeC;AA2BD;;;;;;;;;;;;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AuCC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './BaseEngine';
2
2
  export * from './BaseProvider';
3
+ export * from './CredentialUtils';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  // PUBLIC API SURFACE AREA
18
18
  __exportStar(require("./BaseEngine"), exports);
19
19
  __exportStar(require("./BaseProvider"), exports);
20
+ __exportStar(require("./CredentialUtils"), exports);
20
21
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0BAA0B;AAC1B,+CAA6B;AAC7B,iDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0BAA0B;AAC1B,+CAA6B;AAC7B,iDAA+B;AAC/B,oDAAkC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/communication-types",
3
- "version": "2.123.1",
3
+ "version": "2.125.0",
4
4
  "description": "MemberJunction: Communication Framework Library Generic Types",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,10 +19,10 @@
19
19
  "typescript": "^5.4.5"
20
20
  },
21
21
  "dependencies": {
22
- "@memberjunction/global": "2.123.1",
23
- "@memberjunction/core": "2.123.1",
24
- "@memberjunction/templates-base-types": "2.123.1",
25
- "@memberjunction/core-entities": "2.123.1",
22
+ "@memberjunction/global": "2.125.0",
23
+ "@memberjunction/core": "2.125.0",
24
+ "@memberjunction/templates-base-types": "2.125.0",
25
+ "@memberjunction/core-entities": "2.125.0",
26
26
  "rxjs": "^7.8.1"
27
27
  },
28
28
  "repository": {