@bwi-mentorspaces/application-utils-npm 0.0.106 → 0.0.107

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.
@@ -211,6 +211,13 @@ export interface IEventTypesData {
211
211
  documentId: string;
212
212
  description: string;
213
213
  timestamp: string;
214
+ senderInfo?: {
215
+ id: string;
216
+ name: string;
217
+ picture: string;
218
+ ref: string;
219
+ type: string;
220
+ };
214
221
  };
215
222
  [CustomEventType.ProgramAnnouncementComment]: {
216
223
  id: number;
@@ -221,5 +228,12 @@ export interface IEventTypesData {
221
228
  title: string;
222
229
  description: string;
223
230
  recipients: string[];
231
+ senderInfo?: {
232
+ id: string;
233
+ name: string;
234
+ picture: string;
235
+ ref: string;
236
+ type: string;
237
+ };
224
238
  };
225
239
  }
@@ -34,6 +34,16 @@ export declare class StreamUser extends StreamBase implements IStreamUser {
34
34
  * @returns {Promise<APIResponse>} object response
35
35
  */
36
36
  sendUserEvent<T extends CustomEventType>(userId: string, eventType: T, data?: IEventTypesData[T]): Promise<APIResponse>;
37
+ /**
38
+ * Send event to user as a different user (system/admin account)
39
+ *
40
+ * @param {string} userId the user id to send to
41
+ * @param {string} senderId the user id sending the event (your account)
42
+ * @param {CustomEventType} eventType the event type
43
+ * @param {IEventTypesData} data the data to send with the event
44
+ * @returns {Promise<APIResponse>} object response
45
+ */
46
+ sendUserEventAsUser<T extends CustomEventType>(userId: string, senderId: string, eventType: T, data?: IEventTypesData[T]): Promise<APIResponse>;
37
47
  /**
38
48
  * Sync a user list
39
49
  *
@@ -42,6 +42,29 @@ class StreamUser extends stream_base_1.StreamBase {
42
42
  return yield _super.server.sendUserCustomEvent(userId, { type: eventType, customData: data });
43
43
  });
44
44
  }
45
+ /**
46
+ * Send event to user as a different user (system/admin account)
47
+ *
48
+ * @param {string} userId the user id to send to
49
+ * @param {string} senderId the user id sending the event (your account)
50
+ * @param {CustomEventType} eventType the event type
51
+ * @param {IEventTypesData} data the data to send with the event
52
+ * @returns {Promise<APIResponse>} object response
53
+ */
54
+ sendUserEventAsUser(userId, senderId, eventType, data) {
55
+ const _super = Object.create(null, {
56
+ server: { get: () => super.server }
57
+ });
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ // Create a custom event with sender information
60
+ const eventData = {
61
+ type: eventType,
62
+ customData: Object.assign(Object.assign({}, data), { _senderId: senderId, _sentFrom: 'system' // Mark as system message
63
+ })
64
+ };
65
+ return yield _super.server.sendUserCustomEvent(userId, eventData);
66
+ });
67
+ }
45
68
  /**
46
69
  * Sync a user list
47
70
  *
@@ -1 +1 @@
1
- {"version":3,"file":"stream.user.js","sourceRoot":"","sources":["../../../chat/stream/stream.user.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,+CAA2C;AAkB3C;;GAEG;AACH,MAAa,UAAW,SAAQ,wBAAU;IACtC,aAAa;IAEb;;;;OAIG;IACH,YAAY,MAAkB;QAC1B,KAAK,EAAE,CAAC;QACR,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED,UAAU;IAEV;;;;;;;OAOG;IACG,aAAa,CACf,MAAc,EACd,SAAY,EACZ,IAAyB;;;;;YAEzB,OAAO,MAAM,OAAM,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QACjG,CAAC;KAAA;IAED;;;;;OAKG;IACG,QAAQ,CAAC,KAAa;;;;;YACxB,kBAAkB;YAClB,MAAM,CAAC,GAAG,MAAM,OAAM,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAChD,kBAAkB;YAClB,IAAI,CAAC,EAAE;gBACH,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC;KAAA;IAED;;;;;OAKG;IACG,kBAAkB,CAAC,WAAgC;;;;;YACrD,kBAAkB;YAClB,MAAM,CAAC,GAAG,MAAM,OAAM,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;YAC7D,kBAAkB;YAClB,IAAI,CAAC,EAAE;gBACH,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC;KAAA;IAED;;;;;OAKG;IACG,UAAU,CAAC,QAAsB;;;;;YACnC,MAAM,CAAC,GAAG,MAAM,OAAM,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAClD,kBAAkB;YAClB,IAAI,CAAC,EAAE;gBACH,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC;KAAA;IAED;;;;;;;OAOG;IACG,UAAU,CAAC,IAAU,EAAE,MAAgB;;;;;YACzC,kBAAkB;YAClB,MAAM,CAAC,GAAG,MAAM,OAAM,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE;gBAC7C,WAAW,EAAE,MAAM;gBACnB,4BAA4B,EAAE,IAAI;aACrC,CAAC,CAAC;YACH,kBAAkB;YAClB,IAAI,CAAC,EAAE;gBACH,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC;KAAA;IAED;;;;;OAKG;IACG,UAAU,CAAC,IAAiB;;;;;YAC9B,wBAAwB;YACxB,MAAM,CAAC,GAAG,MAAM,OAAM,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAE9C,OAAO,CAAC,CAAC,KAAK,CAAC;QACnB,CAAC;KAAA;CACJ;AAnHD,gCAmHC"}
1
+ {"version":3,"file":"stream.user.js","sourceRoot":"","sources":["../../../chat/stream/stream.user.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,+CAA2C;AAkB3C;;GAEG;AACH,MAAa,UAAW,SAAQ,wBAAU;IACtC,aAAa;IAEb;;;;OAIG;IACH,YAAY,MAAkB;QAC1B,KAAK,EAAE,CAAC;QACR,KAAK,CAAC,MAAM,GAAG,MAA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C,QAAQ,CAAC,CAAC;YAClD,kBAAkB;YAClB,IAAI,CAAC,EAAE;gBACH,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC;KAAA;IAED;;;;;;;OAOG;IACG,UAAU,CAAC,IAAU,EAAE,MAAgB;;;;;YACzC,kBAAkB;YAClB,MAAM,CAAC,GAAG,MAAM,OAAM,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE;gBAC7C,WAAW,EAAE,MAAM;gBACnB,4BAA4B,EAAE,IAAI;aACrC,CAAC,CAAC;YACH,kBAAkB;YAClB,IAAI,CAAC,EAAE;gBACH,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC;KAAA;IAED;;;;;OAKG;IACG,UAAU,CAAC,IAAiB;;;;;YAC9B,wBAAwB;YACxB,MAAM,CAAC,GAAG,MAAM,OAAM,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAE9C,OAAO,CAAC,CAAC,KAAK,CAAC;QACnB,CAAC;KAAA;CACJ;AA/ID,gCA+IC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bwi-mentorspaces/application-utils-npm",
3
- "version": "0.0.106",
3
+ "version": "0.0.107",
4
4
  "description": "Mentor Spaces npm packages for reusable models, utils, and abstracted, commonly used processes for DB Repo, Logging, etc.",
5
5
  "author": {
6
6
  "name": "Mentor Spaces",