@messenger-box/platform-server 0.0.1-alpha.136 → 0.0.1-alpha.142

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 +1 @@
1
- export declare const messengerResolvers: (() => import("../../../../../messenger-core/lib").IResolvers<import("../../interfaces").IContext>)[];
1
+ export declare const messengerResolvers: (() => import("../../../../../messenger-core/lib").IResolvers<import("../..").IContext>)[];
package/lib/index.d.ts CHANGED
@@ -2,3 +2,5 @@ import { Feature } from '@common-stack/server-core';
2
2
  export * from './constants';
3
3
  declare const _default: Feature<import("@common-stack/server-core").ConfigurationScope>;
4
4
  export default _default;
5
+ export { PostTypes } from './preferences';
6
+ export * from './interfaces';
package/lib/index.js CHANGED
@@ -560,6 +560,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
560
560
  exports.postResolvers = void 0;
561
561
  const core_1 = __webpack_require__(/*! @adminide-stack/core */ "@adminide-stack/core");
562
562
  const core_2 = __webpack_require__(/*! @messenger-box/core */ "@messenger-box/core");
563
+ const lodash_1 = __webpack_require__(/*! lodash */ "lodash");
564
+ const graphql_1 = __webpack_require__(/*! graphql */ "graphql");
563
565
  const postResolvers = () => ({
564
566
  // Temporary fix, until we have extension support in base module
565
567
  FileInfo: {
@@ -585,8 +587,20 @@ const postResolvers = () => ({
585
587
  channel(src, args, { channelService }) {
586
588
  return channelService.get(src.channel.toString());
587
589
  },
590
+ props(src, _, { userContext }) {
591
+ var _a;
592
+ return (_a = src === null || src === void 0 ? void 0 : src.props) === null || _a === void 0 ? void 0 : _a[`[${userContext.accountId}]`];
593
+ },
594
+ isRead(src, _, { userContext }) {
595
+ var _a;
596
+ return lodash_1.get((_a = src === null || src === void 0 ? void 0 : src.props) === null || _a === void 0 ? void 0 : _a[`[${userContext.accountId}]`], `messenger.posts.isRead`);
597
+ },
598
+ isDelivered(src, _, { userContext }) {
599
+ var _a;
600
+ return lodash_1.get((_a = src === null || src === void 0 ? void 0 : src.props) === null || _a === void 0 ? void 0 : _a[`[${userContext.accountId}]`], `messenger.posts.isDelivered`);
601
+ },
588
602
  propsConfiguration(src, args, { configurationService }) {
589
- const resource = core_1.generateUri('posts', { _id: src.id }, 'props');
603
+ const resource = core_1.generateUri('messenger', { _id: src.id }, 'props');
590
604
  let data = '{}';
591
605
  try {
592
606
  data = JSON.stringify(src.props);
@@ -662,6 +676,20 @@ const postResolvers = () => ({
662
676
  deleteMessageFile(_, { url }, { postService }) {
663
677
  return postService.deleteFile(url);
664
678
  },
679
+ async readMessage(src, { messageId }, { postService, userContext, channelService }) {
680
+ const member = await channelService.isMember(messageId.channelId, userContext.accountId);
681
+ if (!member) {
682
+ throw new graphql_1.GraphQLError('Message does not belong to user');
683
+ }
684
+ return postService.readMessage(messageId, userContext.accountId);
685
+ },
686
+ async deliverMessage(src, { messageId }, { postService, userContext, channelService }) {
687
+ const member = await channelService.isMember(messageId.channelId, userContext.accountId);
688
+ if (!member) {
689
+ throw new graphql_1.GraphQLError('Message does not belong to user');
690
+ }
691
+ return postService.deliverMessage(messageId, userContext.accountId);
692
+ },
665
693
  // uploadFile(src, { files, postId }, { fileInfoService, userContext }) {
666
694
  // const res = [];
667
695
  // files.map((file) =>
@@ -835,7 +863,7 @@ __webpack_require__.r(__webpack_exports__);
835
863
 
836
864
  "use strict";
837
865
  __webpack_require__.r(__webpack_exports__);
838
- /* harmony default export */ __webpack_exports__["default"] = ("type Post implements IBaseRepo & IFileRef {\n id: ID!\n author: UserAccount\n channel: Channel\n\n rootId: String\n parentId: String\n originalId: String\n\n \"\"\" Post sent by server e.g. User joined channel \"\"\"\n fromServer: Boolean\n\n message: String\n type: String\n props: AnyObject\n hashTags: String\n\n filenames: [String]\n fields: [String]\n reactions: [Reaction]\n files(criteria:AnyObject, limit:Int, skip:Int, sort:Sort):FilesInfo!\n editedBy: UserAccount\n deletedBy: UserAccount\n createdAt: DateTime\n updatedAt: DateTime\n deletedAt: DateTime\n\n propsConfiguration: MachineConfiguration\n}\n\ninput MessageInput {\n content: String!\n userRef: [String] #userId\n channelRef: [String] #channelId\n files: [ID!]\n}\n\ninput MessageIdentifier {\n channelId: String!\n messageId: String!\n}\n\ntype PostsWithCursor {\n cursor: String\n channel: Channel\n posts: [Post]\n}\n\ntype Messages{\n totalCount: Int,\n data:[Post]\n}\n\n\nextend type Query {\n messages(\n channelId: ID,\n # channelName: String,\n # directTo: ID,\n limit: Int,\n skip: Int,\n # searchRegex: String,\n # excludeServer: Boolean\n ): Messages! @isAuthenticated @addAccountContext\n}\n\nextend type Mutation {\n deleteMessage(messageId: MessageIdentifier!): Boolean @isAuthenticated\n editMessage(messageId: MessageIdentifier!, messageInput: MessageInput!): Post @isAuthenticated @addAccountContext\n sendMessage(channelId: String!, messageInput: MessageInput!): Post @isAuthenticated @addAccountContext\n \"\"\"\n Attach Post File\n \"\"\"\n createMessageFileUploadLink(postId:ID!, filename:String!): String! @isAuthenticated @addAccountContext\n attachUploadedFileToMessage(postId:ID!, file: UploadedFileInput!): FileInfo! @isAuthenticated @addAccountContext\n \"\"\"\n Detach Post File\n \"\"\"\n deleteMessageFile(url: String!): Boolean! @isAuthenticated @addAccountContext\n}\n\nextend type Subscription {\n chatMessageAdded(channelId: String, directTo: String): Post @isAuthenticated @addAccountContext\n}\n");
866
+ /* harmony default export */ __webpack_exports__["default"] = ("type Post implements IBaseRepo & IFileRef {\n id: ID!\n author: UserAccount\n channel: Channel\n\n rootId: String\n parentId: String\n originalId: String\n\n \"\"\" Post sent by server e.g. User joined channel \"\"\"\n fromServer: Boolean\n\n message: String\n type: String\n props: AnyObject\n hashTags: String\n\n filenames: [String]\n fields: [String]\n reactions: [Reaction]\n files(criteria:AnyObject, limit:Int, skip:Int, sort:Sort):FilesInfo!\n editedBy: UserAccount\n deletedBy: UserAccount\n createdAt: DateTime\n updatedAt: DateTime\n deletedAt: DateTime\n\n propsConfiguration: MachineConfiguration\n\n isRead: Boolean\n isDelivered: Boolean\n}\n\ninput MessageInput {\n content: String!\n userRef: [String] #userId\n channelRef: [String] #channelId\n files: [ID!]\n}\n\ninput MessageIdentifier {\n channelId: String!\n messageId: String!\n}\n\ntype PostsWithCursor {\n cursor: String\n channel: Channel\n posts: [Post]\n}\n\ntype Messages{\n totalCount: Int,\n data:[Post]\n}\n\n\nextend type Query {\n messages(\n channelId: ID,\n # channelName: String,\n # directTo: ID,\n limit: Int,\n skip: Int,\n # searchRegex: String,\n # excludeServer: Boolean\n ): Messages! @isAuthenticated @addAccountContext\n}\n\nextend type Mutation {\n deleteMessage(messageId: MessageIdentifier!): Boolean @isAuthenticated\n editMessage(messageId: MessageIdentifier!, messageInput: MessageInput!): Post @isAuthenticated @addAccountContext\n sendMessage(channelId: String!, messageInput: MessageInput!): Post @isAuthenticated @addAccountContext\n \"\"\"\n Attach Post File\n \"\"\"\n createMessageFileUploadLink(postId:ID!, filename:String!): String! @isAuthenticated @addAccountContext\n attachUploadedFileToMessage(postId:ID!, file: UploadedFileInput!): FileInfo! @isAuthenticated @addAccountContext\n \"\"\"\n Detach Post File\n \"\"\"\n deleteMessageFile(url: String!): Boolean! @isAuthenticated @addAccountContext\n\n readMessage(messageId: MessageIdentifier!): Boolean! @isAuthenticated @addAccountContext\n\n deliverMessage(messageId: MessageIdentifier!): Boolean! @isAuthenticated @addAccountContext\n}\n\nextend type Subscription {\n chatMessageAdded(channelId: String, directTo: String): Post @isAuthenticated @addAccountContext\n}\n");
839
867
 
840
868
  /***/ }),
841
869
 
@@ -901,11 +929,279 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
901
929
  return (mod && mod.__esModule) ? mod : { "default": mod };
902
930
  };
903
931
  Object.defineProperty(exports, "__esModule", { value: true });
932
+ exports.PostTypes = void 0;
904
933
  /* eslint-disable import/no-extraneous-dependencies */
905
934
  const server_core_1 = __webpack_require__(/*! @common-stack/server-core */ "@common-stack/server-core");
906
935
  const module_1 = __importDefault(__webpack_require__(/*! ./module */ "./src/module.ts"));
907
936
  __exportStar(__webpack_require__(/*! ./constants */ "./src/constants/index.ts"), exports);
908
937
  exports.default = new server_core_1.Feature(module_1.default);
938
+ var preferences_1 = __webpack_require__(/*! ./preferences */ "./src/preferences/index.ts");
939
+ Object.defineProperty(exports, "PostTypes", { enumerable: true, get: function () { return preferences_1.PostTypes; } });
940
+ __exportStar(__webpack_require__(/*! ./interfaces */ "./src/interfaces/index.ts"), exports);
941
+
942
+
943
+ /***/ }),
944
+
945
+ /***/ "./src/interfaces/base-repositories.ts":
946
+ /*!*********************************************!*\
947
+ !*** ./src/interfaces/base-repositories.ts ***!
948
+ \*********************************************/
949
+ /*! no static exports found */
950
+ /***/ (function(module, exports, __webpack_require__) {
951
+
952
+ "use strict";
953
+
954
+ Object.defineProperty(exports, "__esModule", { value: true });
955
+
956
+
957
+ /***/ }),
958
+
959
+ /***/ "./src/interfaces/base-service.ts":
960
+ /*!****************************************!*\
961
+ !*** ./src/interfaces/base-service.ts ***!
962
+ \****************************************/
963
+ /*! no static exports found */
964
+ /***/ (function(module, exports, __webpack_require__) {
965
+
966
+ "use strict";
967
+
968
+ Object.defineProperty(exports, "__esModule", { value: true });
969
+
970
+
971
+ /***/ }),
972
+
973
+ /***/ "./src/interfaces/channel-member.ts":
974
+ /*!******************************************!*\
975
+ !*** ./src/interfaces/channel-member.ts ***!
976
+ \******************************************/
977
+ /*! no static exports found */
978
+ /***/ (function(module, exports, __webpack_require__) {
979
+
980
+ "use strict";
981
+
982
+ Object.defineProperty(exports, "__esModule", { value: true });
983
+
984
+
985
+ /***/ }),
986
+
987
+ /***/ "./src/interfaces/channel-model.ts":
988
+ /*!*****************************************!*\
989
+ !*** ./src/interfaces/channel-model.ts ***!
990
+ \*****************************************/
991
+ /*! no static exports found */
992
+ /***/ (function(module, exports, __webpack_require__) {
993
+
994
+ "use strict";
995
+
996
+ Object.defineProperty(exports, "__esModule", { value: true });
997
+
998
+
999
+ /***/ }),
1000
+
1001
+ /***/ "./src/interfaces/channel-repository.ts":
1002
+ /*!**********************************************!*\
1003
+ !*** ./src/interfaces/channel-repository.ts ***!
1004
+ \**********************************************/
1005
+ /*! no static exports found */
1006
+ /***/ (function(module, exports, __webpack_require__) {
1007
+
1008
+ "use strict";
1009
+
1010
+ Object.defineProperty(exports, "__esModule", { value: true });
1011
+
1012
+
1013
+ /***/ }),
1014
+
1015
+ /***/ "./src/interfaces/channel-service.ts":
1016
+ /*!*******************************************!*\
1017
+ !*** ./src/interfaces/channel-service.ts ***!
1018
+ \*******************************************/
1019
+ /*! no static exports found */
1020
+ /***/ (function(module, exports, __webpack_require__) {
1021
+
1022
+ "use strict";
1023
+
1024
+ Object.defineProperty(exports, "__esModule", { value: true });
1025
+
1026
+
1027
+ /***/ }),
1028
+
1029
+ /***/ "./src/interfaces/context.ts":
1030
+ /*!***********************************!*\
1031
+ !*** ./src/interfaces/context.ts ***!
1032
+ \***********************************/
1033
+ /*! no static exports found */
1034
+ /***/ (function(module, exports, __webpack_require__) {
1035
+
1036
+ "use strict";
1037
+
1038
+ Object.defineProperty(exports, "__esModule", { value: true });
1039
+
1040
+
1041
+ /***/ }),
1042
+
1043
+ /***/ "./src/interfaces/get-all-args.ts":
1044
+ /*!****************************************!*\
1045
+ !*** ./src/interfaces/get-all-args.ts ***!
1046
+ \****************************************/
1047
+ /*! no static exports found */
1048
+ /***/ (function(module, exports, __webpack_require__) {
1049
+
1050
+ "use strict";
1051
+
1052
+ Object.defineProperty(exports, "__esModule", { value: true });
1053
+
1054
+
1055
+ /***/ }),
1056
+
1057
+ /***/ "./src/interfaces/index.ts":
1058
+ /*!*********************************!*\
1059
+ !*** ./src/interfaces/index.ts ***!
1060
+ \*********************************/
1061
+ /*! no static exports found */
1062
+ /***/ (function(module, exports, __webpack_require__) {
1063
+
1064
+ "use strict";
1065
+
1066
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1067
+ if (k2 === undefined) k2 = k;
1068
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
1069
+ }) : (function(o, m, k, k2) {
1070
+ if (k2 === undefined) k2 = k;
1071
+ o[k2] = m[k];
1072
+ }));
1073
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
1074
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1075
+ };
1076
+ Object.defineProperty(exports, "__esModule", { value: true });
1077
+ __exportStar(__webpack_require__(/*! ./base-repositories */ "./src/interfaces/base-repositories.ts"), exports);
1078
+ __exportStar(__webpack_require__(/*! ./get-all-args */ "./src/interfaces/get-all-args.ts"), exports);
1079
+ __exportStar(__webpack_require__(/*! ./base-service */ "./src/interfaces/base-service.ts"), exports);
1080
+ __exportStar(__webpack_require__(/*! ./channel-model */ "./src/interfaces/channel-model.ts"), exports);
1081
+ __exportStar(__webpack_require__(/*! ./channel-member */ "./src/interfaces/channel-member.ts"), exports);
1082
+ __exportStar(__webpack_require__(/*! ./notifications */ "./src/interfaces/notifications.ts"), exports);
1083
+ __exportStar(__webpack_require__(/*! ./channel-repository */ "./src/interfaces/channel-repository.ts"), exports);
1084
+ __exportStar(__webpack_require__(/*! ./channel-service */ "./src/interfaces/channel-service.ts"), exports);
1085
+ __exportStar(__webpack_require__(/*! ./post-service */ "./src/interfaces/post-service.ts"), exports);
1086
+ __exportStar(__webpack_require__(/*! ./post-repository */ "./src/interfaces/post-repository.ts"), exports);
1087
+ __exportStar(__webpack_require__(/*! ./post-thread-service */ "./src/interfaces/post-thread-service.ts"), exports);
1088
+ __exportStar(__webpack_require__(/*! ./post-thread-repository */ "./src/interfaces/post-thread-repository.ts"), exports);
1089
+ __exportStar(__webpack_require__(/*! ./reaction-repository */ "./src/interfaces/reaction-repository.ts"), exports);
1090
+ __exportStar(__webpack_require__(/*! ./reaction-service */ "./src/interfaces/reaction-service.ts"), exports);
1091
+ __exportStar(__webpack_require__(/*! ./services */ "./src/interfaces/services.ts"), exports);
1092
+ __exportStar(__webpack_require__(/*! ./context */ "./src/interfaces/context.ts"), exports);
1093
+
1094
+
1095
+ /***/ }),
1096
+
1097
+ /***/ "./src/interfaces/notifications.ts":
1098
+ /*!*****************************************!*\
1099
+ !*** ./src/interfaces/notifications.ts ***!
1100
+ \*****************************************/
1101
+ /*! no static exports found */
1102
+ /***/ (function(module, exports, __webpack_require__) {
1103
+
1104
+ "use strict";
1105
+
1106
+ Object.defineProperty(exports, "__esModule", { value: true });
1107
+
1108
+
1109
+ /***/ }),
1110
+
1111
+ /***/ "./src/interfaces/post-repository.ts":
1112
+ /*!*******************************************!*\
1113
+ !*** ./src/interfaces/post-repository.ts ***!
1114
+ \*******************************************/
1115
+ /*! no static exports found */
1116
+ /***/ (function(module, exports, __webpack_require__) {
1117
+
1118
+ "use strict";
1119
+
1120
+ Object.defineProperty(exports, "__esModule", { value: true });
1121
+
1122
+
1123
+ /***/ }),
1124
+
1125
+ /***/ "./src/interfaces/post-service.ts":
1126
+ /*!****************************************!*\
1127
+ !*** ./src/interfaces/post-service.ts ***!
1128
+ \****************************************/
1129
+ /*! no static exports found */
1130
+ /***/ (function(module, exports, __webpack_require__) {
1131
+
1132
+ "use strict";
1133
+
1134
+ Object.defineProperty(exports, "__esModule", { value: true });
1135
+
1136
+
1137
+ /***/ }),
1138
+
1139
+ /***/ "./src/interfaces/post-thread-repository.ts":
1140
+ /*!**************************************************!*\
1141
+ !*** ./src/interfaces/post-thread-repository.ts ***!
1142
+ \**************************************************/
1143
+ /*! no static exports found */
1144
+ /***/ (function(module, exports, __webpack_require__) {
1145
+
1146
+ "use strict";
1147
+
1148
+ Object.defineProperty(exports, "__esModule", { value: true });
1149
+
1150
+
1151
+ /***/ }),
1152
+
1153
+ /***/ "./src/interfaces/post-thread-service.ts":
1154
+ /*!***********************************************!*\
1155
+ !*** ./src/interfaces/post-thread-service.ts ***!
1156
+ \***********************************************/
1157
+ /*! no static exports found */
1158
+ /***/ (function(module, exports, __webpack_require__) {
1159
+
1160
+ "use strict";
1161
+
1162
+ Object.defineProperty(exports, "__esModule", { value: true });
1163
+
1164
+
1165
+ /***/ }),
1166
+
1167
+ /***/ "./src/interfaces/reaction-repository.ts":
1168
+ /*!***********************************************!*\
1169
+ !*** ./src/interfaces/reaction-repository.ts ***!
1170
+ \***********************************************/
1171
+ /*! no static exports found */
1172
+ /***/ (function(module, exports, __webpack_require__) {
1173
+
1174
+ "use strict";
1175
+
1176
+ Object.defineProperty(exports, "__esModule", { value: true });
1177
+
1178
+
1179
+ /***/ }),
1180
+
1181
+ /***/ "./src/interfaces/reaction-service.ts":
1182
+ /*!********************************************!*\
1183
+ !*** ./src/interfaces/reaction-service.ts ***!
1184
+ \********************************************/
1185
+ /*! no static exports found */
1186
+ /***/ (function(module, exports, __webpack_require__) {
1187
+
1188
+ "use strict";
1189
+
1190
+ Object.defineProperty(exports, "__esModule", { value: true });
1191
+
1192
+
1193
+ /***/ }),
1194
+
1195
+ /***/ "./src/interfaces/services.ts":
1196
+ /*!************************************!*\
1197
+ !*** ./src/interfaces/services.ts ***!
1198
+ \************************************/
1199
+ /*! no static exports found */
1200
+ /***/ (function(module, exports, __webpack_require__) {
1201
+
1202
+ "use strict";
1203
+
1204
+ Object.defineProperty(exports, "__esModule", { value: true });
909
1205
 
910
1206
 
911
1207
  /***/ }),
@@ -1165,6 +1461,13 @@ class ChannelMoleculerService extends moleculer_1.Service {
1165
1461
  [core_1.IChannelServiceCommands.deleteChannel]: {
1166
1462
  handler: async (ctx) => this.channelService.deleteChannel(ctx.params.id),
1167
1463
  },
1464
+ [core_1.IChannelServiceCommands.isMember]: {
1465
+ params: {
1466
+ id: 'string',
1467
+ user: 'string',
1468
+ },
1469
+ handler: async ({ params }) => this.channelService.isMember(params.id, params.user),
1470
+ },
1168
1471
  },
1169
1472
  });
1170
1473
  }
@@ -1276,6 +1579,28 @@ class PostMoleculerService extends moleculer_1.Service {
1276
1579
  return this.postService.deleteFile(url);
1277
1580
  },
1278
1581
  },
1582
+ readMessage: {
1583
+ params: {
1584
+ channelId: 'string',
1585
+ messageId: 'string',
1586
+ user: 'string',
1587
+ },
1588
+ handler(ctx) {
1589
+ const _a = ctx.params, { user } = _a, rest = __rest(_a, ["user"]);
1590
+ return this.postService.readMessage(rest, user);
1591
+ },
1592
+ },
1593
+ deliverMessage: {
1594
+ params: {
1595
+ channelId: 'string',
1596
+ messageId: 'string',
1597
+ user: 'string',
1598
+ },
1599
+ handler(ctx) {
1600
+ const _a = ctx.params, { user } = _a, rest = __rest(_a, ["user"]);
1601
+ return this.postService.deliverMessage(rest, user);
1602
+ },
1603
+ },
1279
1604
  },
1280
1605
  });
1281
1606
  }
@@ -1385,6 +1710,98 @@ class ReactionMoleculerService extends moleculer_1.Service {
1385
1710
  exports.ReactionMoleculerService = ReactionMoleculerService;
1386
1711
 
1387
1712
 
1713
+ /***/ }),
1714
+
1715
+ /***/ "./src/preferences/index.ts":
1716
+ /*!**********************************!*\
1717
+ !*** ./src/preferences/index.ts ***!
1718
+ \**********************************/
1719
+ /*! no static exports found */
1720
+ /***/ (function(module, exports, __webpack_require__) {
1721
+
1722
+ "use strict";
1723
+
1724
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1725
+ if (k2 === undefined) k2 = k;
1726
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
1727
+ }) : (function(o, m, k, k2) {
1728
+ if (k2 === undefined) k2 = k;
1729
+ o[k2] = m[k];
1730
+ }));
1731
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
1732
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1733
+ };
1734
+ Object.defineProperty(exports, "__esModule", { value: true });
1735
+ __exportStar(__webpack_require__(/*! ./settings */ "./src/preferences/settings/index.ts"), exports);
1736
+
1737
+
1738
+ /***/ }),
1739
+
1740
+ /***/ "./src/preferences/settings/index.ts":
1741
+ /*!*******************************************!*\
1742
+ !*** ./src/preferences/settings/index.ts ***!
1743
+ \*******************************************/
1744
+ /*! no static exports found */
1745
+ /***/ (function(module, exports, __webpack_require__) {
1746
+
1747
+ "use strict";
1748
+
1749
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1750
+ if (k2 === undefined) k2 = k;
1751
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
1752
+ }) : (function(o, m, k, k2) {
1753
+ if (k2 === undefined) k2 = k;
1754
+ o[k2] = m[k];
1755
+ }));
1756
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
1757
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1758
+ };
1759
+ Object.defineProperty(exports, "__esModule", { value: true });
1760
+ __exportStar(__webpack_require__(/*! ./post-settings */ "./src/preferences/settings/post-settings.ts"), exports);
1761
+
1762
+
1763
+ /***/ }),
1764
+
1765
+ /***/ "./src/preferences/settings/post-settings.ts":
1766
+ /*!***************************************************!*\
1767
+ !*** ./src/preferences/settings/post-settings.ts ***!
1768
+ \***************************************************/
1769
+ /*! no static exports found */
1770
+ /***/ (function(module, exports, __webpack_require__) {
1771
+
1772
+ "use strict";
1773
+
1774
+ Object.defineProperty(exports, "__esModule", { value: true });
1775
+ exports.PostSettings = exports.PostTypes = exports.POST_SETTINGS_PREFIX = void 0;
1776
+ const nls_1 = __webpack_require__(/*! @vscode-alt/monaco-editor/esm/vs/nls */ "@vscode-alt/monaco-editor/esm/vs/nls");
1777
+ exports.POST_SETTINGS_PREFIX = 'messenger.posts';
1778
+ exports.PostTypes = {
1779
+ isPinned: `${exports.POST_SETTINGS_PREFIX}.isPinned`,
1780
+ isDelivered: `${exports.POST_SETTINGS_PREFIX}.isDelivered`,
1781
+ isRead: `${exports.POST_SETTINGS_PREFIX}.isRead`,
1782
+ };
1783
+ exports.PostSettings = {
1784
+ [exports.PostTypes.isPinned]: {
1785
+ type: 'boolean',
1786
+ default: false,
1787
+ description: nls_1.localize(exports.PostTypes.isPinned, 'Message is Pinned'),
1788
+ scope: 2 /* MACHINE */,
1789
+ },
1790
+ [exports.PostTypes.isDelivered]: {
1791
+ type: 'boolean',
1792
+ default: [],
1793
+ description: nls_1.localize(exports.PostTypes.isDelivered, 'Message is Delivered'),
1794
+ scope: 2 /* MACHINE */,
1795
+ },
1796
+ [exports.PostTypes.isRead]: {
1797
+ type: 'boolean',
1798
+ default: [],
1799
+ description: nls_1.localize(exports.PostTypes.isRead, 'Message has been read'),
1800
+ scope: 2 /* MACHINE */,
1801
+ },
1802
+ };
1803
+
1804
+
1388
1805
  /***/ }),
1389
1806
 
1390
1807
  /***/ "./src/services/base-service.ts":
@@ -1508,6 +1925,11 @@ let ChannelService = class ChannelService extends base_service_1.BaseService {
1508
1925
  this.repository = repository;
1509
1926
  this.postService = postService;
1510
1927
  }
1928
+ async isMember(channelId, user) {
1929
+ var _a;
1930
+ const channel = await this.get(channelId);
1931
+ return !!((_a = channel === null || channel === void 0 ? void 0 : channel.members) === null || _a === void 0 ? void 0 : _a.find((member) => member.user.toString() === user.toString()));
1932
+ }
1511
1933
  static getDmNameFromIds(senderId, receiverId) {
1512
1934
  return `${senderId}__${receiverId}`;
1513
1935
  }
@@ -1787,10 +2209,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
1787
2209
  exports.PostService = void 0;
1788
2210
  /* eslint-disable no-useless-constructor */
1789
2211
  const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
2212
+ const lodash_1 = __webpack_require__(/*! lodash */ "lodash");
1790
2213
  const core_1 = __webpack_require__(/*! @messenger-box/core */ "@messenger-box/core");
1791
2214
  const file_info_core_1 = __webpack_require__(/*! @container-stack/file-info-core */ "@container-stack/file-info-core");
1792
2215
  const base_service_1 = __webpack_require__(/*! ./base-service */ "./src/services/base-service.ts");
1793
2216
  const constants_1 = __webpack_require__(/*! ../constants */ "./src/constants/index.ts");
2217
+ const post_settings_1 = __webpack_require__(/*! ../preferences/settings/post-settings */ "./src/preferences/settings/post-settings.ts");
1794
2218
  let PostService = class PostService extends base_service_1.BaseService {
1795
2219
  constructor(repository, fileInfoService) {
1796
2220
  super(repository);
@@ -1810,6 +2234,22 @@ let PostService = class PostService extends base_service_1.BaseService {
1810
2234
  deleteFile(url) {
1811
2235
  return this.fileInfoService.deleteByUrl(url);
1812
2236
  }
2237
+ async readMessage(messageId, user) {
2238
+ await this.update(messageId.messageId, {
2239
+ props: {
2240
+ [`[${user}]`]: lodash_1.set({}, post_settings_1.PostTypes.isRead, true),
2241
+ },
2242
+ });
2243
+ return true;
2244
+ }
2245
+ async deliverMessage(messageId, user) {
2246
+ await this.update(messageId.messageId, {
2247
+ props: {
2248
+ [`[${user}]`]: lodash_1.set({}, post_settings_1.PostTypes.isDelivered, true),
2249
+ },
2250
+ });
2251
+ return true;
2252
+ }
1813
2253
  };
1814
2254
  PostService = __decorate([
1815
2255
  __param(0, inversify_1.inject(constants_1.TYPES.PostRepository)),
@@ -2042,6 +2482,9 @@ let ChannelProxyService = class ChannelProxyService extends base_proxy_service_1
2042
2482
  saveMultipleMembers(members) {
2043
2483
  return this.callAction(core_2.IChannelServiceCommands.saveMultipleMembers, { members });
2044
2484
  }
2485
+ isMember(channelId, user) {
2486
+ return this.callAction(core_2.IChannelServiceCommands.isMember, { id: channelId, user });
2487
+ }
2045
2488
  };
2046
2489
  ChannelProxyService = __decorate([
2047
2490
  inversify_1.injectable(),
@@ -2120,6 +2563,12 @@ let PostProxyService = class PostProxyService extends base_proxy_service_1.BaseP
2120
2563
  deleteFile(url) {
2121
2564
  return this.callAction(core_2.IPostServiceCommands.deleteFile, { url });
2122
2565
  }
2566
+ readMessage(messageId, user) {
2567
+ return this.callAction(core_2.IPostServiceCommands.readMessage, Object.assign(Object.assign({}, messageId), { user }));
2568
+ }
2569
+ deliverMessage(messageId, user) {
2570
+ return this.callAction(core_2.IPostServiceCommands.deliverMessage, Object.assign(Object.assign({}, messageId), { user }));
2571
+ }
2123
2572
  };
2124
2573
  PostProxyService = __decorate([
2125
2574
  inversify_1.injectable(),
@@ -2908,6 +3357,17 @@ module.exports = require("@messenger-box/core");
2908
3357
 
2909
3358
  /***/ }),
2910
3359
 
3360
+ /***/ "@vscode-alt/monaco-editor/esm/vs/nls":
3361
+ /*!*******************************************************!*\
3362
+ !*** external "@vscode-alt/monaco-editor/esm/vs/nls" ***!
3363
+ \*******************************************************/
3364
+ /*! no static exports found */
3365
+ /***/ (function(module, exports) {
3366
+
3367
+ module.exports = require("@vscode-alt/monaco-editor/esm/vs/nls");
3368
+
3369
+ /***/ }),
3370
+
2911
3371
  /***/ "envalid":
2912
3372
  /*!**************************!*\
2913
3373
  !*** external "envalid" ***!
@@ -2919,6 +3379,17 @@ module.exports = require("envalid");
2919
3379
 
2920
3380
  /***/ }),
2921
3381
 
3382
+ /***/ "graphql":
3383
+ /*!**************************!*\
3384
+ !*** external "graphql" ***!
3385
+ \**************************/
3386
+ /*! no static exports found */
3387
+ /***/ (function(module, exports) {
3388
+
3389
+ module.exports = require("graphql");
3390
+
3391
+ /***/ }),
3392
+
2922
3393
  /***/ "inversify":
2923
3394
  /*!****************************!*\
2924
3395
  !*** external "inversify" ***!