@messenger-box/property-ext-server 0.0.1-alpha.192 → 0.0.1-alpha.199

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/lib/index.js CHANGED
@@ -1,111 +1,38 @@
1
- module.exports =
2
- /******/ (function(modules) { // webpackBootstrap
3
- /******/ // The module cache
4
- /******/ var installedModules = {};
5
- /******/
6
- /******/ // The require function
7
- /******/ function __webpack_require__(moduleId) {
8
- /******/
9
- /******/ // Check if module is in cache
10
- /******/ if(installedModules[moduleId]) {
11
- /******/ return installedModules[moduleId].exports;
12
- /******/ }
13
- /******/ // Create a new module (and put it into the cache)
14
- /******/ var module = installedModules[moduleId] = {
15
- /******/ i: moduleId,
16
- /******/ l: false,
17
- /******/ exports: {}
18
- /******/ };
19
- /******/
20
- /******/ // Execute the module function
21
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
- /******/
23
- /******/ // Flag the module as loaded
24
- /******/ module.l = true;
25
- /******/
26
- /******/ // Return the exports of the module
27
- /******/ return module.exports;
28
- /******/ }
29
- /******/
30
- /******/
31
- /******/ // expose the modules object (__webpack_modules__)
32
- /******/ __webpack_require__.m = modules;
33
- /******/
34
- /******/ // expose the module cache
35
- /******/ __webpack_require__.c = installedModules;
36
- /******/
37
- /******/ // define getter function for harmony exports
38
- /******/ __webpack_require__.d = function(exports, name, getter) {
39
- /******/ if(!__webpack_require__.o(exports, name)) {
40
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
- /******/ }
42
- /******/ };
43
- /******/
44
- /******/ // define __esModule on exports
45
- /******/ __webpack_require__.r = function(exports) {
46
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
- /******/ }
49
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
- /******/ };
51
- /******/
52
- /******/ // create a fake namespace object
53
- /******/ // mode & 1: value is a module id, require it
54
- /******/ // mode & 2: merge all properties of value into the ns
55
- /******/ // mode & 4: return value when already ns object
56
- /******/ // mode & 8|1: behave like require
57
- /******/ __webpack_require__.t = function(value, mode) {
58
- /******/ if(mode & 1) value = __webpack_require__(value);
59
- /******/ if(mode & 8) return value;
60
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
- /******/ var ns = Object.create(null);
62
- /******/ __webpack_require__.r(ns);
63
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
- /******/ return ns;
66
- /******/ };
67
- /******/
68
- /******/ // getDefaultExport function for compatibility with non-harmony modules
69
- /******/ __webpack_require__.n = function(module) {
70
- /******/ var getter = module && module.__esModule ?
71
- /******/ function getDefault() { return module['default']; } :
72
- /******/ function getModuleExports() { return module; };
73
- /******/ __webpack_require__.d(getter, 'a', getter);
74
- /******/ return getter;
75
- /******/ };
76
- /******/
77
- /******/ // Object.prototype.hasOwnProperty.call
78
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
- /******/
80
- /******/ // __webpack_public_path__
81
- /******/ __webpack_require__.p = "";
82
- /******/
83
- /******/
84
- /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = "./src/index.ts");
86
- /******/ })
87
- /************************************************************************/
88
- /******/ ({
1
+ /******/ (() => { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ var __webpack_modules__ = ({
4
+
5
+ /***/ "./src/graphql/schema/post.graphql":
6
+ /*!*****************************************!*\
7
+ !*** ./src/graphql/schema/post.graphql ***!
8
+ \*****************************************/
9
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10
+
11
+ __webpack_require__.r(__webpack_exports__);
12
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
14
+ /* harmony export */ });
15
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("extend enum PostTypeEnum{\n ALERT\n CARD\n}\n");
16
+
17
+ /***/ }),
89
18
 
90
19
  /***/ "./src/config/config.ts":
91
20
  /*!******************************!*\
92
21
  !*** ./src/config/config.ts ***!
93
22
  \******************************/
94
- /*! no static exports found */
95
- /***/ (function(module, exports, __webpack_require__) {
23
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
96
24
 
97
- "use strict";
98
25
 
99
- Object.defineProperty(exports, "__esModule", { value: true });
26
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
100
27
  exports.config = void 0;
101
28
  const envalid_1 = __webpack_require__(/*! envalid */ "envalid");
102
29
  const env = process.APP_ENV || process.env;
103
- exports.config = envalid_1.cleanEnv(env, {
104
- NODE_ENV: envalid_1.str({ choices: ['production', 'test', 'staging', 'development'], default: 'production' }),
105
- POST_DATA_FILE_PATH: envalid_1.str({
30
+ exports.config = (0, envalid_1.cleanEnv)(env, {
31
+ NODE_ENV: (0, envalid_1.str)({ choices: ['production', 'test', 'staging', 'development'], default: 'production' }),
32
+ POST_DATA_FILE_PATH: (0, envalid_1.str)({
106
33
  default: 'node_modules/@messenger-box/property-ext-server/lib/mock/fixtures/post.json',
107
34
  }),
108
- CHANNEL_DATA_FILE_PATH: envalid_1.str({
35
+ CHANNEL_DATA_FILE_PATH: (0, envalid_1.str)({
109
36
  default: 'node_modules/@messenger-box/property-ext-server/lib/mock/fixtures/channel.json',
110
37
  }),
111
38
  });
@@ -117,14 +44,16 @@ exports.config = envalid_1.cleanEnv(env, {
117
44
  /*!*****************************!*\
118
45
  !*** ./src/config/index.ts ***!
119
46
  \*****************************/
120
- /*! no static exports found */
121
- /***/ (function(module, exports, __webpack_require__) {
47
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
122
48
 
123
- "use strict";
124
49
 
125
50
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
126
51
  if (k2 === undefined) k2 = k;
127
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
52
+ var desc = Object.getOwnPropertyDescriptor(m, k);
53
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
54
+ desc = { enumerable: true, get: function() { return m[k]; } };
55
+ }
56
+ Object.defineProperty(o, k2, desc);
128
57
  }) : (function(o, m, k, k2) {
129
58
  if (k2 === undefined) k2 = k;
130
59
  o[k2] = m[k];
@@ -132,7 +61,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
132
61
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
133
62
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
134
63
  };
135
- Object.defineProperty(exports, "__esModule", { value: true });
64
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
136
65
  __exportStar(__webpack_require__(/*! ./config */ "./src/config/config.ts"), exports);
137
66
 
138
67
 
@@ -142,17 +71,16 @@ __exportStar(__webpack_require__(/*! ./config */ "./src/config/config.ts"), expo
142
71
  /*!*************************************!*\
143
72
  !*** ./src/containers/container.ts ***!
144
73
  \*************************************/
145
- /*! no static exports found */
146
- /***/ (function(module, exports, __webpack_require__) {
74
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
147
75
 
148
- "use strict";
149
76
 
150
- Object.defineProperty(exports, "__esModule", { value: true });
77
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
151
78
  exports.propertyContainerModule = void 0;
152
79
  const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
153
- const bot_user_migration_1 = __webpack_require__(/*! ../migration/bot-user-migration */ "./src/migration/bot-user-migration.ts");
80
+ const migrations_1 = __webpack_require__(/*! ../migrations */ "./src/migrations/index.ts");
154
81
  const propertyContainerModule = () => new inversify_1.ContainerModule((bind) => {
155
- bind('MongodbMigration').to(bot_user_migration_1.BotUserMigration).whenTargetNamed(bot_user_migration_1.BotUserMigration.name);
82
+ bind('MongodbMigration').to(migrations_1.BotUserMigration).whenTargetNamed(migrations_1.BotUserMigration.name);
83
+ bind('MongodbMigration').to(migrations_1.PropertyExtMessagesMigration).whenTargetNamed(migrations_1.PropertyExtMessagesMigration.name);
156
84
  });
157
85
  exports.propertyContainerModule = propertyContainerModule;
158
86
 
@@ -163,14 +91,16 @@ exports.propertyContainerModule = propertyContainerModule;
163
91
  /*!*********************************!*\
164
92
  !*** ./src/containers/index.ts ***!
165
93
  \*********************************/
166
- /*! no static exports found */
167
- /***/ (function(module, exports, __webpack_require__) {
94
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
168
95
 
169
- "use strict";
170
96
 
171
97
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
172
98
  if (k2 === undefined) k2 = k;
173
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
99
+ var desc = Object.getOwnPropertyDescriptor(m, k);
100
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
101
+ desc = { enumerable: true, get: function() { return m[k]; } };
102
+ }
103
+ Object.defineProperty(o, k2, desc);
174
104
  }) : (function(o, m, k, k2) {
175
105
  if (k2 === undefined) k2 = k;
176
106
  o[k2] = m[k];
@@ -178,7 +108,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
178
108
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
179
109
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
180
110
  };
181
- Object.defineProperty(exports, "__esModule", { value: true });
111
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
182
112
  __exportStar(__webpack_require__(/*! ./container */ "./src/containers/container.ts"), exports);
183
113
 
184
114
 
@@ -188,15 +118,13 @@ __exportStar(__webpack_require__(/*! ./container */ "./src/containers/container.
188
118
  /*!******************************!*\
189
119
  !*** ./src/graphql/index.ts ***!
190
120
  \******************************/
191
- /*! no static exports found */
192
- /***/ (function(module, exports, __webpack_require__) {
121
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
193
122
 
194
- "use strict";
195
123
 
196
- Object.defineProperty(exports, "__esModule", { value: true });
124
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
197
125
  exports.schema = void 0;
198
126
  var schema_1 = __webpack_require__(/*! ./schema */ "./src/graphql/schema/index.ts");
199
- Object.defineProperty(exports, "schema", { enumerable: true, get: function () { return schema_1.schema; } });
127
+ Object.defineProperty(exports, "schema", ({ enumerable: true, get: function () { return schema_1.schema; } }));
200
128
 
201
129
 
202
130
  /***/ }),
@@ -205,15 +133,13 @@ Object.defineProperty(exports, "schema", { enumerable: true, get: function () {
205
133
  /*!*************************************!*\
206
134
  !*** ./src/graphql/schema/index.ts ***!
207
135
  \*************************************/
208
- /*! no static exports found */
209
- /***/ (function(module, exports, __webpack_require__) {
136
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
210
137
 
211
- "use strict";
212
138
 
213
139
  var __importDefault = (this && this.__importDefault) || function (mod) {
214
140
  return (mod && mod.__esModule) ? mod : { "default": mod };
215
141
  };
216
- Object.defineProperty(exports, "__esModule", { value: true });
142
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
217
143
  exports.schema = void 0;
218
144
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
219
145
  // @ts-nocheck
@@ -221,49 +147,32 @@ const post_graphql_1 = __importDefault(__webpack_require__(/*! ./post.graphql */
221
147
  exports.schema = [post_graphql_1.default].join('/n');
222
148
 
223
149
 
224
- /***/ }),
225
-
226
- /***/ "./src/graphql/schema/post.graphql":
227
- /*!*****************************************!*\
228
- !*** ./src/graphql/schema/post.graphql ***!
229
- \*****************************************/
230
- /*! exports provided: default */
231
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
232
-
233
- "use strict";
234
- __webpack_require__.r(__webpack_exports__);
235
- /* harmony default export */ __webpack_exports__["default"] = ("extend enum PostTypeEnum{\n ALERT\n CARD\n}\n");
236
-
237
150
  /***/ }),
238
151
 
239
152
  /***/ "./src/index.ts":
240
153
  /*!**********************!*\
241
154
  !*** ./src/index.ts ***!
242
155
  \**********************/
243
- /*! no static exports found */
244
- /***/ (function(module, exports, __webpack_require__) {
156
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
245
157
 
246
- "use strict";
247
158
 
248
159
  var __importDefault = (this && this.__importDefault) || function (mod) {
249
160
  return (mod && mod.__esModule) ? mod : { "default": mod };
250
161
  };
251
- Object.defineProperty(exports, "__esModule", { value: true });
252
- exports.default = void 0;
162
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
163
+ exports["default"] = void 0;
253
164
  var module_1 = __webpack_require__(/*! ./module */ "./src/module.ts");
254
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(module_1).default; } });
165
+ Object.defineProperty(exports, "default", ({ enumerable: true, get: function () { return __importDefault(module_1).default; } }));
255
166
 
256
167
 
257
168
  /***/ }),
258
169
 
259
- /***/ "./src/migration/bot-user-migration.ts":
260
- /*!*********************************************!*\
261
- !*** ./src/migration/bot-user-migration.ts ***!
262
- \*********************************************/
263
- /*! no static exports found */
264
- /***/ (function(module, exports, __webpack_require__) {
170
+ /***/ "./src/migrations/bot-user-migration.ts":
171
+ /*!**********************************************!*\
172
+ !*** ./src/migrations/bot-user-migration.ts ***!
173
+ \**********************************************/
174
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
265
175
 
266
- "use strict";
267
176
 
268
177
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
269
178
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -275,7 +184,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
275
184
  return function (target, key) { decorator(target, key, paramIndex); }
276
185
  };
277
186
  var BotUserMigration_1;
278
- Object.defineProperty(exports, "__esModule", { value: true });
187
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
279
188
  exports.BotUserMigration = void 0;
280
189
  const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
281
190
  const core_1 = __webpack_require__(/*! @common-stack/core */ "@common-stack/core");
@@ -323,29 +232,272 @@ let BotUserMigration = BotUserMigration_1 = class BotUserMigration {
323
232
  }
324
233
  };
325
234
  BotUserMigration = BotUserMigration_1 = __decorate([
326
- inversify_1.injectable(),
327
- __param(0, inversify_1.inject(core_1.CommonType.MOLECULER_BROKER)),
328
- __param(1, inversify_1.inject('Logger'))
235
+ (0, inversify_1.injectable)(),
236
+ __param(0, (0, inversify_1.inject)(core_1.CommonType.MOLECULER_BROKER)),
237
+ __param(1, (0, inversify_1.inject)('Logger'))
329
238
  ], BotUserMigration);
330
239
  exports.BotUserMigration = BotUserMigration;
331
240
 
332
241
 
242
+ /***/ }),
243
+
244
+ /***/ "./src/migrations/index.ts":
245
+ /*!*********************************!*\
246
+ !*** ./src/migrations/index.ts ***!
247
+ \*********************************/
248
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
249
+
250
+
251
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
252
+ exports.BotUserMigration = exports.PropertyExtMessagesMigration = void 0;
253
+ var property_ext_messages_migration_1 = __webpack_require__(/*! ./property-ext-messages-migration */ "./src/migrations/property-ext-messages-migration.ts");
254
+ Object.defineProperty(exports, "PropertyExtMessagesMigration", ({ enumerable: true, get: function () { return property_ext_messages_migration_1.PropertyExtMessagesMigration; } }));
255
+ var bot_user_migration_1 = __webpack_require__(/*! ./bot-user-migration */ "./src/migrations/bot-user-migration.ts");
256
+ Object.defineProperty(exports, "BotUserMigration", ({ enumerable: true, get: function () { return bot_user_migration_1.BotUserMigration; } }));
257
+
258
+
259
+ /***/ }),
260
+
261
+ /***/ "./src/migrations/property-ext-messages-migration.ts":
262
+ /*!***********************************************************!*\
263
+ !*** ./src/migrations/property-ext-messages-migration.ts ***!
264
+ \***********************************************************/
265
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
266
+
267
+
268
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
269
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
270
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
271
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
272
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
273
+ };
274
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
275
+ return function (target, key) { decorator(target, key, paramIndex); }
276
+ };
277
+ var PropertyExtMessagesMigration_1;
278
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
279
+ exports.PropertyExtMessagesMigration = void 0;
280
+ const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
281
+ const core_1 = __webpack_require__(/*! @common-stack/core */ "@common-stack/core");
282
+ const property_ext_core_1 = __webpack_require__(/*! @messenger-box/property-ext-core */ "@messenger-box/property-ext-core");
283
+ const core_2 = __webpack_require__(/*! @messenger-box/core */ "@messenger-box/core");
284
+ const config_1 = __webpack_require__(/*! ../config */ "./src/config/index.ts");
285
+ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class PropertyExtMessagesMigration {
286
+ constructor(broker, logger) {
287
+ this.broker = broker;
288
+ this.logger = logger;
289
+ this.name = 'PropertyExtMessagesMigration';
290
+ this.logger = logger.child({ className: PropertyExtMessagesMigration_1.name });
291
+ }
292
+ async createUsers() {
293
+ const userOne = this.broker.call(`AccountUser.createAccount`, {
294
+ account: {
295
+ username: 'propertyAutomatedUser',
296
+ email: 'property-automated-user@resortifi.com',
297
+ alias: 'auth0|62df21f9e8116e9fce8207cf',
298
+ familyName: 'property-fixure',
299
+ givenName: 'user1',
300
+ picture: 'https://lh3.googleusercontent.com/a/AATXAJxMARAgr96npkZGf4R2uGbahBP4tLh5SRbS9bVq=s96-c',
301
+ emailVerified: true,
302
+ notificationEmail: '',
303
+ },
304
+ });
305
+ const userTwo = this.broker.call(`AccountUser.createAccount`, {
306
+ account: {
307
+ username: 'propertyAutomatedUser2',
308
+ email: 'property-automated-user2@resortifi.com',
309
+ alias: 'auth0|62df22109b1f5f6077c1f57e',
310
+ familyName: 'property-fixure',
311
+ givenName: 'user2',
312
+ picture: 'https://lh3.googleusercontent.com/a/AATXAJxMARAgr96npkZGf4R2uGbahBP4tLh5SRbS9bVq=s96-c',
313
+ emailVerified: true,
314
+ notificationEmail: '',
315
+ },
316
+ });
317
+ return Promise.all([userOne, userTwo]);
318
+ }
319
+ createChannel(owner, guest) {
320
+ return this.broker.call(`${core_2.IMoleculerTopics.ChannelService}.${core_2.IBaseServiceCommands.create}`, {
321
+ data: {
322
+ topic: 'Fixtures',
323
+ title: `${owner.alias}:${guest.alias}`,
324
+ creator: guest.id,
325
+ displayName: `${owner.alias}:${guest.alias}`,
326
+ type: core_2.IRoomType.DIRECT,
327
+ members: [
328
+ {
329
+ id: undefined,
330
+ schemeAdmin: false,
331
+ roles: 'OWNER',
332
+ user: owner.id,
333
+ },
334
+ {
335
+ id: undefined,
336
+ schemeAdmin: true,
337
+ roles: 'GUEST',
338
+ user: guest.id,
339
+ },
340
+ ],
341
+ },
342
+ });
343
+ }
344
+ async createSimpleMessage(channelId, editedBy) {
345
+ return this.broker.call(`${core_2.IMoleculerTopics.PostService}.${core_2.IBaseServiceCommands.create}`, {
346
+ data: {
347
+ editedBy: editedBy,
348
+ channel: channelId,
349
+ message: 'Hello from the migrations',
350
+ type: property_ext_core_1.IPostTypeEnum.Simple,
351
+ files: [],
352
+ },
353
+ });
354
+ }
355
+ async createAlertMessage(channelId, editedBy) {
356
+ const message = 'This is a dummy alert!';
357
+ return this.broker.call(`${core_2.IMoleculerTopics.PostService}.${core_2.IBaseServiceCommands.create}`, {
358
+ data: {
359
+ editedBy: editedBy,
360
+ channel: channelId,
361
+ message,
362
+ type: property_ext_core_1.IPostTypeEnum.ALERT,
363
+ files: [],
364
+ props: {
365
+ ref: 'Dummy',
366
+ refId: 'some-ref',
367
+ attachment: {
368
+ title: message,
369
+ isTitleHtml: false,
370
+ icon: 'InfoIcon',
371
+ callToAction: {
372
+ title: 'View',
373
+ link: `/some-route/some-id`,
374
+ },
375
+ },
376
+ },
377
+ },
378
+ });
379
+ }
380
+ async createCardMessage(channelId, editedBy) {
381
+ const message = 'Inquiry for fixture property';
382
+ return this.broker.call(`${core_2.IMoleculerTopics.PostService}.${core_2.IBaseServiceCommands.create}`, {
383
+ data: {
384
+ editedBy: editedBy,
385
+ channel: channelId,
386
+ message,
387
+ type: property_ext_core_1.IPostTypeEnum.CARD,
388
+ files: [],
389
+ props: {
390
+ ref: 'Property',
391
+ refId: 'some-property-id',
392
+ attachment: {
393
+ image: 'https://placehold.co/300',
394
+ title: message,
395
+ isTitleHtml: false,
396
+ description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis interdum leo augue, non posuere sapien ullamcorper ac. Aliquam vitae ornare libero, ac vulputate elit. Aenean interdum, mi a viverra maximus, leo nibh maximus augue, vel ultrices leo ante et ex. Maecenas vel mi auctor, egestas tellus nec, placerat odio. Curabitur eget tortor sed ligula pharetra varius. Aliquam sit amet lacus ligula. Etiam vitae magna eros.',
397
+ isDescriptionHtml: false,
398
+ callToAction: {
399
+ title: 'View',
400
+ // Should come from frontend
401
+ link: `/property/some-id`,
402
+ },
403
+ property: {
404
+ price: 10,
405
+ priceType: 'Hourly',
406
+ type: 'Hotel',
407
+ totalStar: 5,
408
+ maxPeople: 500,
409
+ totalReview: 450,
410
+ },
411
+ },
412
+ },
413
+ },
414
+ });
415
+ }
416
+ async waitForServices() {
417
+ if (config_1.config.isDev) {
418
+ await this.broker.waitForServices('AccountUser');
419
+ await this.broker.waitForServices(`${core_2.IMoleculerTopics.ChannelService}`);
420
+ await this.broker.waitForServices(`${core_2.IMoleculerTopics.PostService}`);
421
+ }
422
+ }
423
+ async up() {
424
+ await this.waitForServices();
425
+ await this.down();
426
+ this.logger.debug(`(up) Starting up migration...`);
427
+ const users = await this.createUsers();
428
+ this.logger.debug('(up) users created...');
429
+ const channel = await this.createChannel(users[0], users[1]);
430
+ if (!channel) {
431
+ return;
432
+ }
433
+ this.logger.debug('(up) channel created...');
434
+ await Promise.all([
435
+ this.createSimpleMessage(channel.id, users[0].id),
436
+ this.createAlertMessage(channel.id, users[0].id),
437
+ this.createCardMessage(channel.id, users[0].id),
438
+ ]);
439
+ this.logger.debug('(up) messages created...');
440
+ }
441
+ async down() {
442
+ this.logger.debug(`(down) Starting down migration...`);
443
+ const users = await this.broker.call('AccountUser.getAll', {
444
+ options: {
445
+ criteria: {
446
+ email: { $in: ['property-automated-user@resortifi.com', 'property-automated-user2@resortifi.com'] },
447
+ },
448
+ },
449
+ });
450
+ console.log('--users--', JSON.stringify(users));
451
+ await Promise.all(users.map(({ id }) => this.broker.call(`AccountUser.deleteAccount`, {
452
+ account: {
453
+ id,
454
+ },
455
+ })));
456
+ const [channel] = await this.broker.call(`${core_2.IMoleculerTopics.ChannelService}.${core_2.IBaseServiceCommands.getAll}`, {
457
+ criteria: {
458
+ displayName: `propertyAutomatedUser:propertyAutomatedUser2`,
459
+ },
460
+ });
461
+ if (!(channel === null || channel === void 0 ? void 0 : channel.id)) {
462
+ this.logger.debug(`(down) No Channel found, skipping migration!`);
463
+ return;
464
+ }
465
+ const posts = await this.broker.call(`${core_2.IMoleculerTopics.PostService}.getAll`, {
466
+ criteria: {
467
+ channel: channel.id,
468
+ },
469
+ });
470
+ await Promise.all(posts.map(({ id }) => this.broker.call(`${core_2.IMoleculerTopics.PostService}.delete`, {
471
+ id,
472
+ })));
473
+ await this.broker.call(`${core_2.IMoleculerTopics.ChannelService}.${core_2.IBaseServiceCommands.delete}`, {
474
+ id: channel.id,
475
+ });
476
+ this.logger.debug(`(down) Successful`);
477
+ }
478
+ };
479
+ PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = __decorate([
480
+ (0, inversify_1.injectable)(),
481
+ __param(0, (0, inversify_1.inject)(core_1.CommonType.MOLECULER_BROKER)),
482
+ __param(1, (0, inversify_1.inject)('Logger'))
483
+ ], PropertyExtMessagesMigration);
484
+ exports.PropertyExtMessagesMigration = PropertyExtMessagesMigration;
485
+
486
+
333
487
  /***/ }),
334
488
 
335
489
  /***/ "./src/module.ts":
336
490
  /*!***********************!*\
337
491
  !*** ./src/module.ts ***!
338
492
  \***********************/
339
- /*! no static exports found */
340
- /***/ (function(module, exports, __webpack_require__) {
493
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
341
494
 
342
- "use strict";
343
495
 
344
- Object.defineProperty(exports, "__esModule", { value: true });
496
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
345
497
  const server_core_1 = __webpack_require__(/*! @common-stack/server-core */ "@common-stack/server-core");
346
498
  const containers_1 = __webpack_require__(/*! ./containers */ "./src/containers/index.ts");
347
499
  const graphql_1 = __webpack_require__(/*! ./graphql */ "./src/graphql/index.ts");
348
- exports.default = new server_core_1.Feature({
500
+ exports["default"] = new server_core_1.Feature({
349
501
  schema: graphql_1.schema,
350
502
  createContainerFunc: [containers_1.propertyContainerModule],
351
503
  });
@@ -357,8 +509,7 @@ exports.default = new server_core_1.Feature({
357
509
  /*!*************************************!*\
358
510
  !*** external "@common-stack/core" ***!
359
511
  \*************************************/
360
- /*! no static exports found */
361
- /***/ (function(module, exports) {
512
+ /***/ ((module) => {
362
513
 
363
514
  module.exports = require("@common-stack/core");
364
515
 
@@ -368,19 +519,37 @@ module.exports = require("@common-stack/core");
368
519
  /*!********************************************!*\
369
520
  !*** external "@common-stack/server-core" ***!
370
521
  \********************************************/
371
- /*! no static exports found */
372
- /***/ (function(module, exports) {
522
+ /***/ ((module) => {
373
523
 
374
524
  module.exports = require("@common-stack/server-core");
375
525
 
376
526
  /***/ }),
377
527
 
528
+ /***/ "@messenger-box/core":
529
+ /*!**************************************!*\
530
+ !*** external "@messenger-box/core" ***!
531
+ \**************************************/
532
+ /***/ ((module) => {
533
+
534
+ module.exports = require("@messenger-box/core");
535
+
536
+ /***/ }),
537
+
538
+ /***/ "@messenger-box/property-ext-core":
539
+ /*!***************************************************!*\
540
+ !*** external "@messenger-box/property-ext-core" ***!
541
+ \***************************************************/
542
+ /***/ ((module) => {
543
+
544
+ module.exports = require("@messenger-box/property-ext-core");
545
+
546
+ /***/ }),
547
+
378
548
  /***/ "envalid":
379
549
  /*!**************************!*\
380
550
  !*** external "envalid" ***!
381
551
  \**************************/
382
- /*! no static exports found */
383
- /***/ (function(module, exports) {
552
+ /***/ ((module) => {
384
553
 
385
554
  module.exports = require("envalid");
386
555
 
@@ -390,12 +559,75 @@ module.exports = require("envalid");
390
559
  /*!****************************!*\
391
560
  !*** external "inversify" ***!
392
561
  \****************************/
393
- /*! no static exports found */
394
- /***/ (function(module, exports) {
562
+ /***/ ((module) => {
395
563
 
396
564
  module.exports = require("inversify");
397
565
 
398
566
  /***/ })
399
567
 
400
- /******/ });
568
+ /******/ });
569
+ /************************************************************************/
570
+ /******/ // The module cache
571
+ /******/ var __webpack_module_cache__ = {};
572
+ /******/
573
+ /******/ // The require function
574
+ /******/ function __webpack_require__(moduleId) {
575
+ /******/ // Check if module is in cache
576
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
577
+ /******/ if (cachedModule !== undefined) {
578
+ /******/ return cachedModule.exports;
579
+ /******/ }
580
+ /******/ // Create a new module (and put it into the cache)
581
+ /******/ var module = __webpack_module_cache__[moduleId] = {
582
+ /******/ // no module.id needed
583
+ /******/ // no module.loaded needed
584
+ /******/ exports: {}
585
+ /******/ };
586
+ /******/
587
+ /******/ // Execute the module function
588
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
589
+ /******/
590
+ /******/ // Return the exports of the module
591
+ /******/ return module.exports;
592
+ /******/ }
593
+ /******/
594
+ /************************************************************************/
595
+ /******/ /* webpack/runtime/define property getters */
596
+ /******/ (() => {
597
+ /******/ // define getter functions for harmony exports
598
+ /******/ __webpack_require__.d = (exports, definition) => {
599
+ /******/ for(var key in definition) {
600
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
601
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
602
+ /******/ }
603
+ /******/ }
604
+ /******/ };
605
+ /******/ })();
606
+ /******/
607
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
608
+ /******/ (() => {
609
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
610
+ /******/ })();
611
+ /******/
612
+ /******/ /* webpack/runtime/make namespace object */
613
+ /******/ (() => {
614
+ /******/ // define __esModule on exports
615
+ /******/ __webpack_require__.r = (exports) => {
616
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
617
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
618
+ /******/ }
619
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
620
+ /******/ };
621
+ /******/ })();
622
+ /******/
623
+ /************************************************************************/
624
+ /******/
625
+ /******/ // startup
626
+ /******/ // Load entry module and return exports
627
+ /******/ // This entry module is referenced by other modules so it can't be inlined
628
+ /******/ var __webpack_exports__ = __webpack_require__("./src/index.ts");
629
+ /******/ module.exports = __webpack_exports__;
630
+ /******/
631
+ /******/ })()
632
+ ;
401
633
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/config/config.ts","webpack:///./src/config/index.ts","webpack:///./src/containers/container.ts","webpack:///./src/containers/index.ts","webpack:///./src/graphql/index.ts","webpack:///./src/graphql/schema/index.ts","webpack:///./src/graphql/schema/post.graphql","webpack:///./src/index.ts","webpack:///./src/migration/bot-user-migration.ts","webpack:///./src/module.ts","webpack:///external \"@common-stack/core\"","webpack:///external \"@common-stack/server-core\"","webpack:///external \"envalid\"","webpack:///external \"inversify\""],"names":[],"mappings":";;QAAA;QACA;;QAEA;QACA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AM,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,IAAI;QACN,IAAI,eAAM,CAAC,KAAK,EAAE;YACd,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;SACpD;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAoC,gCAAgC,EAAE;YACrG,KAAK,EAAE,6BAA6B;SACvC,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,EAAE;YACP,OAAO;SACV;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;QAC1D,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE;YAChD,OAAO,EAAE;gBACL,EAAE,EAAE,IAAI,CAAC,EAAE;aACd;SACJ,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAChD,CAAC;CACJ;AAhDY,gBAAgB;IAD5B,sBAAU,EAAE;IAGJ,6BAAM,CAAC,iBAAU,CAAC,gBAAgB,CAAC;IAEnC,6BAAM,CAAC,QAAQ,CAAC;GAJZ,gBAAgB,CAgD5B;AAhDY,4CAAgB;;;;;;;;;;;;;;;ACR7B,wGAAoD;AACpD,0FAAuD;AACvD,iFAAmC;AAEnC,kBAAe,IAAI,qBAAO,CAAC;IACvB,MAAM,EAAN,gBAAM;IACN,mBAAmB,EAAE,CAAC,oCAAuB,CAAC;CACjD,CAAC,CAAC;;;;;;;;;;;;ACPH,+C;;;;;;;;;;;ACAA,sD;;;;;;;;;;;ACAA,oC;;;;;;;;;;;ACAA,sC","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.ts\");\n","import { str, cleanEnv, json } from 'envalid';\nimport { IntegrationConnections, Integrations } from '@adminide-stack/core';\n\nconst env = (process as any).APP_ENV || process.env;\n\nexport const config = cleanEnv(env, {\n NODE_ENV: str({ choices: ['production', 'test', 'staging', 'development'], default: 'production' }),\n POST_DATA_FILE_PATH: str({\n default: 'node_modules/@messenger-box/property-ext-server/lib/mock/fixtures/post.json',\n }),\n CHANNEL_DATA_FILE_PATH: str({\n default: 'node_modules/@messenger-box/property-ext-server/lib/mock/fixtures/channel.json',\n }),\n});\n","export * from './config';\n","import { ContainerModule, interfaces } from 'inversify';\nimport { BotUserMigration } from '../migration/bot-user-migration';\n\nexport const propertyContainerModule: (settings) => interfaces.ContainerModule = () =>\n new ContainerModule((bind: interfaces.Bind) => {\n bind('MongodbMigration').to(BotUserMigration).whenTargetNamed(BotUserMigration.name);\n });\n","export * from './container';\n","export { schema } from './schema';\n","// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport post from './post.graphql';\n\nexport const schema = [post].join('/n');\n","export default \"extend enum PostTypeEnum{\\n ALERT\\n CARD\\n}\\n\";","export { default } from './module';\n","import { inject, injectable } from 'inversify';\nimport { CommonType } from '@common-stack/core';\nimport { ServiceBroker } from 'moleculer';\nimport { IDatabaseMigration } from '@adminide-stack/core';\nimport * as Logger from 'bunyan';\nimport { config } from '../config';\n\n@injectable()\nexport class BotUserMigration implements IDatabaseMigration {\n constructor(\n @inject(CommonType.MOLECULER_BROKER)\n private readonly broker: ServiceBroker,\n @inject('Logger')\n private logger: Logger,\n ) {\n this.logger = logger.child({ className: BotUserMigration.name });\n }\n\n protected name = 'BotUserMigration';\n\n id = `${this.constructor.name}_20220502`;\n\n async up(): Promise<void> {\n await this.down();\n this.logger.debug(`(up) Starting up migration...`);\n const user = await this.broker.call(`AccountUser.createAccount`, {\n account: {\n username: 'resortifi',\n email: 'resortifi-bot@resortifi.com',\n alias: 'resortifi',\n emailVerified: true,\n notificationEmail: '',\n },\n });\n this.logger.debug(`(up) done`, user);\n }\n\n async down(): Promise<void> {\n if (config.isDev) {\n await this.broker.waitForServices('AccountUser');\n }\n this.logger.debug(`(down) Starting down migration...`);\n const user = await this.broker.call<{ id: string }, { email: string }>(`AccountUser.findAccountByEmail`, {\n email: 'resortifi-bot@resortifi.com',\n });\n if (!user) {\n return;\n }\n this.logger.debug(`(down) User Found, dropping...`, user);\n await this.broker.call(`AccountUser.deleteAccount`, {\n account: {\n id: user.id,\n },\n });\n this.logger.debug(`(down) User drop done!`);\n }\n}\n","import { Feature } from '@common-stack/server-core';\nimport { propertyContainerModule } from './containers';\nimport { schema } from './graphql';\n\nexport default new Feature({\n schema,\n createContainerFunc: [propertyContainerModule],\n});\n","module.exports = require(\"@common-stack/core\");","module.exports = require(\"@common-stack/server-core\");","module.exports = require(\"envalid\");","module.exports = require(\"inversify\");"],"sourceRoot":""}
1
+ {"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;AAAA,iEAAe,0BAA0B,wBAAwB,GAAG;;;;;;;;;;;;;ACApE,gEAA8C;AAG9C,MAAM,GAAG,GAAI,OAAe,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;AAEvC,cAAM,GAAG,sBAAQ,EAAC,GAAG,EAAE;IAChC,QAAQ,EAAE,iBAAG,EAAC,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;IACnG,mBAAmB,EAAE,iBAAG,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ACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;UENA;UACA;UACA;UACA","sources":["webpack://@messenger-box/property-ext-server/./src/graphql/schema/post.graphql","webpack://@messenger-box/property-ext-server/./src/config/config.ts","webpack://@messenger-box/property-ext-server/./src/config/index.ts","webpack://@messenger-box/property-ext-server/./src/containers/container.ts","webpack://@messenger-box/property-ext-server/./src/containers/index.ts","webpack://@messenger-box/property-ext-server/./src/graphql/index.ts","webpack://@messenger-box/property-ext-server/./src/graphql/schema/index.ts","webpack://@messenger-box/property-ext-server/./src/index.ts","webpack://@messenger-box/property-ext-server/./src/migrations/bot-user-migration.ts","webpack://@messenger-box/property-ext-server/./src/migrations/index.ts","webpack://@messenger-box/property-ext-server/./src/migrations/property-ext-messages-migration.ts","webpack://@messenger-box/property-ext-server/./src/module.ts","webpack://@messenger-box/property-ext-server/external commonjs \"@common-stack/core\"","webpack://@messenger-box/property-ext-server/external commonjs \"@common-stack/server-core\"","webpack://@messenger-box/property-ext-server/external commonjs \"@messenger-box/core\"","webpack://@messenger-box/property-ext-server/external commonjs \"@messenger-box/property-ext-core\"","webpack://@messenger-box/property-ext-server/external commonjs \"envalid\"","webpack://@messenger-box/property-ext-server/external commonjs \"inversify\"","webpack://@messenger-box/property-ext-server/webpack/bootstrap","webpack://@messenger-box/property-ext-server/webpack/runtime/define property getters","webpack://@messenger-box/property-ext-server/webpack/runtime/hasOwnProperty shorthand","webpack://@messenger-box/property-ext-server/webpack/runtime/make namespace object","webpack://@messenger-box/property-ext-server/webpack/before-startup","webpack://@messenger-box/property-ext-server/webpack/startup","webpack://@messenger-box/property-ext-server/webpack/after-startup"],"sourcesContent":["export default \"extend enum PostTypeEnum{\\n ALERT\\n CARD\\n}\\n\";","import { str, cleanEnv, json } from 'envalid';\nimport { IntegrationConnections, Integrations } from '@adminide-stack/core';\n\nconst env = (process as any).APP_ENV || process.env;\n\nexport const config = cleanEnv(env, {\n NODE_ENV: str({ choices: ['production', 'test', 'staging', 'development'], default: 'production' }),\n POST_DATA_FILE_PATH: str({\n default: 'node_modules/@messenger-box/property-ext-server/lib/mock/fixtures/post.json',\n }),\n CHANNEL_DATA_FILE_PATH: str({\n default: 'node_modules/@messenger-box/property-ext-server/lib/mock/fixtures/channel.json',\n }),\n});\n","export * from './config';\n","import { ContainerModule, interfaces } from 'inversify';\nimport { BotUserMigration, PropertyExtMessagesMigration } from '../migrations';\n\nexport const propertyContainerModule: (settings) => interfaces.ContainerModule = () =>\n new ContainerModule((bind: interfaces.Bind) => {\n bind('MongodbMigration').to(BotUserMigration).whenTargetNamed(BotUserMigration.name);\n bind('MongodbMigration').to(PropertyExtMessagesMigration).whenTargetNamed(PropertyExtMessagesMigration.name);\n });\n","export * from './container';\n","export { schema } from './schema';\n","// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport post from './post.graphql';\n\nexport const schema = [post].join('/n');\n","export { default } from './module';\n","import { inject, injectable } from 'inversify';\nimport { CommonType } from '@common-stack/core';\nimport { ServiceBroker } from 'moleculer';\nimport { IDatabaseMigration } from '@adminide-stack/core';\nimport * as Logger from 'bunyan';\nimport { config } from '../config';\n\n@injectable()\nexport class BotUserMigration implements IDatabaseMigration {\n constructor(\n @inject(CommonType.MOLECULER_BROKER)\n private readonly broker: ServiceBroker,\n @inject('Logger')\n private logger: Logger,\n ) {\n this.logger = logger.child({ className: BotUserMigration.name });\n }\n\n protected name = 'BotUserMigration';\n\n id = `${this.constructor.name}_20220502`;\n\n async up(): Promise<void> {\n await this.down();\n this.logger.debug(`(up) Starting up migration...`);\n const user = await this.broker.call(`AccountUser.createAccount`, {\n account: {\n username: 'resortifi',\n email: 'resortifi-bot@resortifi.com',\n alias: 'resortifi',\n emailVerified: true,\n notificationEmail: '',\n },\n });\n this.logger.debug(`(up) done`, user);\n }\n\n async down(): Promise<void> {\n if (config.isDev) {\n await this.broker.waitForServices('AccountUser');\n }\n this.logger.debug(`(down) Starting down migration...`);\n const user = await this.broker.call<{ id: string }, { email: string }>(`AccountUser.findAccountByEmail`, {\n email: 'resortifi-bot@resortifi.com',\n });\n if (!user) {\n return;\n }\n this.logger.debug(`(down) User Found, dropping...`, user);\n await this.broker.call(`AccountUser.deleteAccount`, {\n account: {\n id: user.id,\n },\n });\n this.logger.debug(`(down) User drop done!`);\n }\n}\n","export { PropertyExtMessagesMigration } from './property-ext-messages-migration';\nexport { BotUserMigration } from './bot-user-migration';\n","import { inject, injectable } from 'inversify';\nimport { IDatabaseMigration, IUserAccount } from '@adminide-stack/core';\nimport { CommonType } from '@common-stack/core';\nimport { ServiceBroker } from 'moleculer';\nimport * as Logger from 'bunyan';\nimport { IChannel, IPost, IPostTypeEnum } from '@messenger-box/property-ext-core';\nimport { IBaseServiceCommands, IMoleculerTopics, IRoomType } from '@messenger-box/core';\nimport { config } from '../config';\n\n@injectable()\nexport class PropertyExtMessagesMigration implements IDatabaseMigration {\n constructor(\n @inject(CommonType.MOLECULER_BROKER)\n private readonly broker: ServiceBroker,\n @inject('Logger')\n private logger: Logger,\n ) {\n this.logger = logger.child({ className: PropertyExtMessagesMigration.name });\n }\n\n id: 'MessagesMigration_07312022';\n\n protected name = 'PropertyExtMessagesMigration';\n\n private async createUsers(): Promise<[IUserAccount, IUserAccount]> {\n const userOne = this.broker.call<IUserAccount, unknown>(`AccountUser.createAccount`, {\n account: {\n username: 'propertyAutomatedUser',\n email: 'property-automated-user@resortifi.com',\n alias: 'auth0|62df21f9e8116e9fce8207cf', // This need to match with auth0 id. Otherwise manually updatein the DB\n familyName: 'property-fixure',\n givenName: 'user1',\n picture: 'https://lh3.googleusercontent.com/a/AATXAJxMARAgr96npkZGf4R2uGbahBP4tLh5SRbS9bVq=s96-c',\n emailVerified: true,\n notificationEmail: '',\n },\n });\n const userTwo = this.broker.call<IUserAccount, unknown>(`AccountUser.createAccount`, {\n account: {\n username: 'propertyAutomatedUser2',\n email: 'property-automated-user2@resortifi.com',\n alias: 'auth0|62df22109b1f5f6077c1f57e', // This need to match with auth0 id. Otherwise manually updatein the DB\n familyName: 'property-fixure',\n givenName: 'user2',\n picture: 'https://lh3.googleusercontent.com/a/AATXAJxMARAgr96npkZGf4R2uGbahBP4tLh5SRbS9bVq=s96-c',\n emailVerified: true,\n notificationEmail: '',\n },\n });\n return Promise.all([userOne, userTwo]);\n }\n\n private createChannel(owner: IUserAccount, guest: IUserAccount): Promise<IChannel> {\n return this.broker.call(`${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.create}`, {\n data: {\n topic: 'Fixtures',\n title: `${owner.alias}:${guest.alias}`,\n creator: guest.id as never,\n displayName: `${owner.alias}:${guest.alias}`,\n type: IRoomType.DIRECT,\n members: [\n {\n id: undefined,\n schemeAdmin: false,\n roles: 'OWNER',\n user: owner.id as never,\n },\n {\n id: undefined,\n schemeAdmin: true,\n roles: 'GUEST',\n user: guest.id as never,\n },\n ],\n },\n });\n }\n\n private async createSimpleMessage(channelId: string, editedBy: string) {\n return this.broker.call(`${IMoleculerTopics.PostService}.${IBaseServiceCommands.create}`, {\n data: {\n editedBy: editedBy as never,\n channel: channelId as never,\n message: 'Hello from the migrations',\n type: IPostTypeEnum.Simple as never,\n files: [],\n },\n });\n }\n\n private async createAlertMessage(channelId: string, editedBy: string) {\n const message = 'This is a dummy alert!';\n return this.broker.call(`${IMoleculerTopics.PostService}.${IBaseServiceCommands.create}`, {\n data: {\n editedBy: editedBy as never,\n channel: channelId as never,\n message,\n type: IPostTypeEnum.ALERT as never,\n files: [],\n props: {\n ref: 'Dummy',\n refId: 'some-ref',\n attachment: {\n title: message,\n isTitleHtml: false,\n icon: 'InfoIcon',\n callToAction: {\n title: 'View',\n link: `/some-route/some-id`,\n },\n },\n },\n },\n });\n }\n\n private async createCardMessage(channelId: string, editedBy: string) {\n const message = 'Inquiry for fixture property';\n return this.broker.call(`${IMoleculerTopics.PostService}.${IBaseServiceCommands.create}`, {\n data: {\n editedBy: editedBy as never,\n channel: channelId as never,\n message,\n type: IPostTypeEnum.CARD as never,\n files: [],\n props: {\n ref: 'Property',\n refId: 'some-property-id',\n attachment: {\n image: 'https://placehold.co/300',\n title: message,\n isTitleHtml: false,\n description:\n 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis interdum leo augue, non posuere sapien ullamcorper ac. Aliquam vitae ornare libero, ac vulputate elit. Aenean interdum, mi a viverra maximus, leo nibh maximus augue, vel ultrices leo ante et ex. Maecenas vel mi auctor, egestas tellus nec, placerat odio. Curabitur eget tortor sed ligula pharetra varius. Aliquam sit amet lacus ligula. Etiam vitae magna eros.',\n isDescriptionHtml: false,\n callToAction: {\n title: 'View',\n // Should come from frontend\n link: `/property/some-id`,\n },\n property: {\n price: 10,\n priceType: 'Hourly',\n type: 'Hotel',\n totalStar: 5,\n maxPeople: 500,\n totalReview: 450,\n },\n },\n },\n },\n });\n }\n\n private async waitForServices() {\n if (config.isDev) {\n await this.broker.waitForServices('AccountUser');\n await this.broker.waitForServices(`${IMoleculerTopics.ChannelService}`);\n await this.broker.waitForServices(`${IMoleculerTopics.PostService}`);\n }\n }\n\n async up(): Promise<void> {\n await this.waitForServices();\n await this.down();\n this.logger.debug(`(up) Starting up migration...`);\n const users = await this.createUsers();\n this.logger.debug('(up) users created...');\n const channel = await this.createChannel(users[0], users[1]);\n if (!channel) {\n return;\n }\n this.logger.debug('(up) channel created...');\n await Promise.all([\n this.createSimpleMessage(channel.id, users[0].id),\n this.createAlertMessage(channel.id, users[0].id),\n this.createCardMessage(channel.id, users[0].id),\n ]);\n this.logger.debug('(up) messages created...');\n }\n\n async down(): Promise<void> {\n this.logger.debug(`(down) Starting down migration...`);\n const users = await this.broker.call<IUserAccount[], unknown>('AccountUser.getAll', {\n options: {\n criteria: {\n email: { $in: ['property-automated-user@resortifi.com', 'property-automated-user2@resortifi.com'] },\n },\n },\n });\n console.log('--users--', JSON.stringify(users));\n await Promise.all(\n users.map(({ id }) =>\n this.broker.call(`AccountUser.deleteAccount`, {\n account: {\n id,\n },\n }),\n ),\n );\n const [channel] = await this.broker.call(`${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.getAll}`, {\n criteria: {\n displayName: `propertyAutomatedUser:propertyAutomatedUser2`,\n },\n });\n if (!channel?.id) {\n this.logger.debug(`(down) No Channel found, skipping migration!`);\n return;\n }\n const posts = await this.broker.call<IPost[], unknown>(`${IMoleculerTopics.PostService}.getAll`, {\n criteria: {\n channel: channel.id,\n },\n });\n await Promise.all(\n posts.map(({ id }) =>\n this.broker.call(`${IMoleculerTopics.PostService}.delete`, {\n id,\n }),\n ),\n );\n await this.broker.call(`${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.delete}`, {\n id: channel.id,\n });\n this.logger.debug(`(down) Successful`);\n }\n}\n","import { Feature } from '@common-stack/server-core';\nimport { propertyContainerModule } from './containers';\nimport { schema } from './graphql';\n\nexport default new Feature({\n schema,\n createContainerFunc: [propertyContainerModule],\n});\n","module.exports = require(\"@common-stack/core\");","module.exports = require(\"@common-stack/server-core\");","module.exports = require(\"@messenger-box/core\");","module.exports = require(\"@messenger-box/property-ext-core\");","module.exports = require(\"envalid\");","module.exports = require(\"inversify\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/index.ts\");\n",""],"names":[],"sourceRoot":""}
@@ -0,0 +1,2 @@
1
+ export { PropertyExtMessagesMigration } from './property-ext-messages-migration';
2
+ export { BotUserMigration } from './bot-user-migration';
@@ -0,0 +1,18 @@
1
+ import { IDatabaseMigration } from '@adminide-stack/core';
2
+ import { ServiceBroker } from 'moleculer';
3
+ import * as Logger from 'bunyan';
4
+ export declare class PropertyExtMessagesMigration implements IDatabaseMigration {
5
+ private readonly broker;
6
+ private logger;
7
+ constructor(broker: ServiceBroker, logger: Logger);
8
+ id: 'MessagesMigration_07312022';
9
+ protected name: string;
10
+ private createUsers;
11
+ private createChannel;
12
+ private createSimpleMessage;
13
+ private createAlertMessage;
14
+ private createCardMessage;
15
+ private waitForServices;
16
+ up(): Promise<void>;
17
+ down(): Promise<void>;
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@messenger-box/property-ext-server",
3
- "version": "0.0.1-alpha.192",
3
+ "version": "0.0.1-alpha.199",
4
4
  "description": "Extension to Messenger to support property",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -37,8 +37,11 @@
37
37
  "\\.(ts|tsx)$": "<rootDir>/../../node_modules/ts-jest/preprocessor.js"
38
38
  }
39
39
  },
40
+ "dependencies": {
41
+ "@messenger-box/property-ext-core": "0.0.1-alpha.198"
42
+ },
40
43
  "peerDependencies": {
41
- "@adminide-stack/account-api-server": "1.1.3-alpha.35",
44
+ "@adminide-stack/account-api-server": "1.1.3-alpha.37",
42
45
  "@adminide-stack/core": "*",
43
46
  "@adminide-stack/platform-server": "*",
44
47
  "@cdm-logger/server": "*",
@@ -64,5 +67,5 @@
64
67
  "typescript": {
65
68
  "definition": "lib/index.d.ts"
66
69
  },
67
- "gitHead": "15646216bcda0a4fbe9b33f72ca1a50ce9a6da15"
70
+ "gitHead": "3ae3dd52bd21245e2ffcdfe3f068475aa528fc89"
68
71
  }