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

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
@@ -150,9 +150,10 @@ __exportStar(__webpack_require__(/*! ./config */ "./src/config/config.ts"), expo
150
150
  Object.defineProperty(exports, "__esModule", { value: true });
151
151
  exports.propertyContainerModule = void 0;
152
152
  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");
153
+ const migrations_1 = __webpack_require__(/*! ../migrations */ "./src/migrations/index.ts");
154
154
  const propertyContainerModule = () => new inversify_1.ContainerModule((bind) => {
155
- bind('MongodbMigration').to(bot_user_migration_1.BotUserMigration).whenTargetNamed(bot_user_migration_1.BotUserMigration.name);
155
+ bind('MongodbMigration').to(migrations_1.BotUserMigration).whenTargetNamed(migrations_1.BotUserMigration.name);
156
+ bind('MongodbMigration').to(migrations_1.PropertyExtMessagesMigration).whenTargetNamed(migrations_1.PropertyExtMessagesMigration.name);
156
157
  });
157
158
  exports.propertyContainerModule = propertyContainerModule;
158
159
 
@@ -256,10 +257,10 @@ Object.defineProperty(exports, "default", { enumerable: true, get: function () {
256
257
 
257
258
  /***/ }),
258
259
 
259
- /***/ "./src/migration/bot-user-migration.ts":
260
- /*!*********************************************!*\
261
- !*** ./src/migration/bot-user-migration.ts ***!
262
- \*********************************************/
260
+ /***/ "./src/migrations/bot-user-migration.ts":
261
+ /*!**********************************************!*\
262
+ !*** ./src/migrations/bot-user-migration.ts ***!
263
+ \**********************************************/
263
264
  /*! no static exports found */
264
265
  /***/ (function(module, exports, __webpack_require__) {
265
266
 
@@ -330,6 +331,246 @@ BotUserMigration = BotUserMigration_1 = __decorate([
330
331
  exports.BotUserMigration = BotUserMigration;
331
332
 
332
333
 
334
+ /***/ }),
335
+
336
+ /***/ "./src/migrations/index.ts":
337
+ /*!*********************************!*\
338
+ !*** ./src/migrations/index.ts ***!
339
+ \*********************************/
340
+ /*! no static exports found */
341
+ /***/ (function(module, exports, __webpack_require__) {
342
+
343
+ "use strict";
344
+
345
+ Object.defineProperty(exports, "__esModule", { value: true });
346
+ exports.BotUserMigration = exports.PropertyExtMessagesMigration = void 0;
347
+ var property_ext_messages_migration_1 = __webpack_require__(/*! ./property-ext-messages-migration */ "./src/migrations/property-ext-messages-migration.ts");
348
+ Object.defineProperty(exports, "PropertyExtMessagesMigration", { enumerable: true, get: function () { return property_ext_messages_migration_1.PropertyExtMessagesMigration; } });
349
+ var bot_user_migration_1 = __webpack_require__(/*! ./bot-user-migration */ "./src/migrations/bot-user-migration.ts");
350
+ Object.defineProperty(exports, "BotUserMigration", { enumerable: true, get: function () { return bot_user_migration_1.BotUserMigration; } });
351
+
352
+
353
+ /***/ }),
354
+
355
+ /***/ "./src/migrations/property-ext-messages-migration.ts":
356
+ /*!***********************************************************!*\
357
+ !*** ./src/migrations/property-ext-messages-migration.ts ***!
358
+ \***********************************************************/
359
+ /*! no static exports found */
360
+ /***/ (function(module, exports, __webpack_require__) {
361
+
362
+ "use strict";
363
+
364
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
365
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
366
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
367
+ 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;
368
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
369
+ };
370
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
371
+ return function (target, key) { decorator(target, key, paramIndex); }
372
+ };
373
+ var PropertyExtMessagesMigration_1;
374
+ Object.defineProperty(exports, "__esModule", { value: true });
375
+ exports.PropertyExtMessagesMigration = void 0;
376
+ const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
377
+ const core_1 = __webpack_require__(/*! @common-stack/core */ "@common-stack/core");
378
+ const property_ext_core_1 = __webpack_require__(/*! @messenger-box/property-ext-core */ "@messenger-box/property-ext-core");
379
+ const core_2 = __webpack_require__(/*! @messenger-box/core */ "@messenger-box/core");
380
+ const config_1 = __webpack_require__(/*! ../config */ "./src/config/index.ts");
381
+ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class PropertyExtMessagesMigration {
382
+ constructor(broker, logger) {
383
+ this.broker = broker;
384
+ this.logger = logger;
385
+ this.name = 'PropertyExtMessagesMigration';
386
+ this.logger = logger.child({ className: PropertyExtMessagesMigration_1.name });
387
+ }
388
+ async createUsers() {
389
+ const userOne = this.broker.call(`AccountUser.createAccount`, {
390
+ account: {
391
+ username: 'propertyAutomatedUser',
392
+ email: 'property-automated-user@resortifi.com',
393
+ alias: 'propertyAutomatedUser',
394
+ emailVerified: true,
395
+ notificationEmail: '',
396
+ },
397
+ });
398
+ const userTwo = this.broker.call(`AccountUser.createAccount`, {
399
+ account: {
400
+ username: 'propertyAutomatedUser2',
401
+ email: 'property-automated-user2@resortifi.com',
402
+ alias: 'propertyAutomatedUser2',
403
+ emailVerified: true,
404
+ notificationEmail: '',
405
+ },
406
+ });
407
+ return Promise.all([userOne, userTwo]);
408
+ }
409
+ createChannel(owner, guest) {
410
+ return this.broker.call(`${core_2.IMoleculerTopics.ChannelService}.${core_2.IBaseServiceCommands.create}`, {
411
+ data: {
412
+ topic: 'Fixtures',
413
+ title: `${owner.alias}:${guest.alias}`,
414
+ creator: guest.id,
415
+ displayName: `${owner.alias}:${guest.alias}`,
416
+ type: core_2.IRoomType.DIRECT,
417
+ members: [
418
+ {
419
+ id: undefined,
420
+ schemeAdmin: false,
421
+ roles: 'OWNER',
422
+ user: owner.id,
423
+ },
424
+ {
425
+ id: undefined,
426
+ schemeAdmin: true,
427
+ roles: 'GUEST',
428
+ user: guest.id,
429
+ },
430
+ ],
431
+ },
432
+ });
433
+ }
434
+ async createSimpleMessage(channelId, editedBy) {
435
+ return this.broker.call(`${core_2.IMoleculerTopics.PostService}.${core_2.IBaseServiceCommands.create}`, {
436
+ data: {
437
+ editedBy: editedBy,
438
+ channel: channelId,
439
+ message: 'Hello from the migrations',
440
+ type: property_ext_core_1.IPostTypeEnum.Simple,
441
+ files: [],
442
+ },
443
+ });
444
+ }
445
+ async createAlertMessage(channelId, editedBy) {
446
+ const message = 'This is a dummy alert!';
447
+ return this.broker.call(`${core_2.IMoleculerTopics.PostService}.${core_2.IBaseServiceCommands.create}`, {
448
+ data: {
449
+ editedBy: editedBy,
450
+ channel: channelId,
451
+ message,
452
+ type: property_ext_core_1.IPostTypeEnum.ALERT,
453
+ files: [],
454
+ props: {
455
+ ref: 'Dummy',
456
+ refId: 'some-ref',
457
+ attachment: {
458
+ title: message,
459
+ isTitleHtml: false,
460
+ icon: 'InfoIcon',
461
+ callToAction: {
462
+ title: 'View',
463
+ link: `/some-route/some-id`,
464
+ },
465
+ },
466
+ },
467
+ },
468
+ });
469
+ }
470
+ async createCardMessage(channelId, editedBy) {
471
+ const message = 'Inquiry for fixture property';
472
+ return this.broker.call(`${core_2.IMoleculerTopics.PostService}.${core_2.IBaseServiceCommands.create}`, {
473
+ data: {
474
+ editedBy: editedBy,
475
+ channel: channelId,
476
+ message,
477
+ type: property_ext_core_1.IPostTypeEnum.CARD,
478
+ files: [],
479
+ props: {
480
+ ref: 'Property',
481
+ refId: 'some-property-id',
482
+ attachment: {
483
+ image: 'https://placehold.co/300',
484
+ title: message,
485
+ isTitleHtml: false,
486
+ 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.',
487
+ isDescriptionHtml: false,
488
+ callToAction: {
489
+ title: 'View',
490
+ // Should come from frontend
491
+ link: `/property/some-id`,
492
+ },
493
+ property: {
494
+ price: 10,
495
+ priceType: 'Hourly',
496
+ type: 'Hotel',
497
+ totalStar: 5,
498
+ maxPeople: 500,
499
+ totalReview: 450,
500
+ },
501
+ },
502
+ },
503
+ },
504
+ });
505
+ }
506
+ async waitForServices() {
507
+ if (config_1.config.isDev) {
508
+ await this.broker.waitForServices('AccountUser');
509
+ await this.broker.waitForServices(`${core_2.IMoleculerTopics.ChannelService}`);
510
+ await this.broker.waitForServices(`${core_2.IMoleculerTopics.PostService}`);
511
+ }
512
+ }
513
+ async up() {
514
+ await this.waitForServices();
515
+ await this.down();
516
+ this.logger.debug(`(up) Starting up migration...`);
517
+ const users = await this.createUsers();
518
+ this.logger.debug('(up) users created...');
519
+ const channel = await this.createChannel(users[0], users[1]);
520
+ if (!channel) {
521
+ return;
522
+ }
523
+ this.logger.debug('(up) channel created...');
524
+ await Promise.all([
525
+ this.createSimpleMessage(channel.id, users[0].id),
526
+ this.createAlertMessage(channel.id, users[0].id),
527
+ this.createCardMessage(channel.id, users[0].id),
528
+ ]);
529
+ this.logger.debug('(up) messages created...');
530
+ }
531
+ async down() {
532
+ this.logger.debug(`(down) Starting down migration...`);
533
+ const users = await this.broker.call('AccountUser.getAll', {
534
+ options: {
535
+ email: ['property-automated-user@resortifi.com', 'property-automated-user2@resortifi.com'],
536
+ },
537
+ });
538
+ await Promise.all(users.map(({ id }) => this.broker.call(`AccountUser.deleteAccount`, {
539
+ account: {
540
+ id,
541
+ },
542
+ })));
543
+ const [channel] = await this.broker.call(`${core_2.IMoleculerTopics.ChannelService}.${core_2.IBaseServiceCommands.getAll}`, {
544
+ criteria: {
545
+ displayName: `propertyAutomatedUser:propertyAutomatedUser2`,
546
+ },
547
+ });
548
+ if (!(channel === null || channel === void 0 ? void 0 : channel.id)) {
549
+ this.logger.debug(`(down) No Channel found, skipping migration!`);
550
+ return;
551
+ }
552
+ const posts = await this.broker.call(`${core_2.IMoleculerTopics.PostService}.getAll`, {
553
+ criteria: {
554
+ channel: channel.id,
555
+ },
556
+ });
557
+ await Promise.all(posts.map(({ id }) => this.broker.call(`${core_2.IMoleculerTopics.PostService}.delete`, {
558
+ id,
559
+ })));
560
+ await this.broker.call(`${core_2.IMoleculerTopics.ChannelService}.${core_2.IBaseServiceCommands.delete}`, {
561
+ id: channel.id,
562
+ });
563
+ this.logger.debug(`(down) Successful`);
564
+ }
565
+ };
566
+ PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = __decorate([
567
+ inversify_1.injectable(),
568
+ __param(0, inversify_1.inject(core_1.CommonType.MOLECULER_BROKER)),
569
+ __param(1, inversify_1.inject('Logger'))
570
+ ], PropertyExtMessagesMigration);
571
+ exports.PropertyExtMessagesMigration = PropertyExtMessagesMigration;
572
+
573
+
333
574
  /***/ }),
334
575
 
335
576
  /***/ "./src/module.ts":
@@ -375,6 +616,28 @@ module.exports = require("@common-stack/server-core");
375
616
 
376
617
  /***/ }),
377
618
 
619
+ /***/ "@messenger-box/core":
620
+ /*!**************************************!*\
621
+ !*** external "@messenger-box/core" ***!
622
+ \**************************************/
623
+ /*! no static exports found */
624
+ /***/ (function(module, exports) {
625
+
626
+ module.exports = require("@messenger-box/core");
627
+
628
+ /***/ }),
629
+
630
+ /***/ "@messenger-box/property-ext-core":
631
+ /*!***************************************************!*\
632
+ !*** external "@messenger-box/property-ext-core" ***!
633
+ \***************************************************/
634
+ /*! no static exports found */
635
+ /***/ (function(module, exports) {
636
+
637
+ module.exports = require("@messenger-box/property-ext-core");
638
+
639
+ /***/ }),
640
+
378
641
  /***/ "envalid":
379
642
  /*!**************************!*\
380
643
  !*** external "envalid" ***!
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;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;;;;AClFA,gEAA8C;AAG9C,MAAM,GAAG,GAAI,OAAe,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;AAEvC,cAAM,GAAG,kBAAQ,CAAC,GAAG,EAAE;IAChC,QAAQ,EAAE,aAAG,CAAC,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;IACnG,mBAAmB,EAAE,aAAG,CAAC;QACrB,OAAO,EAAE,6EAA6E;KACzF,CAAC;IACF,sBAAsB,EAAE,aAAG,CAAC;QACxB,OAAO,EAAE,gFAAgF;KAC5F,CAAC;CACL,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;ACbH,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AAM,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,"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/migrations/bot-user-migration.ts","webpack:///./src/migrations/index.ts","webpack:///./src/migrations/property-ext-messages-migration.ts","webpack:///./src/module.ts","webpack:///external \"@common-stack/core\"","webpack:///external \"@common-stack/server-core\"","webpack:///external \"@messenger-box/core\"","webpack:///external \"@messenger-box/property-ext-core\"","webpack:///external \"envalid\"","webpack:///external \"inversify\""],"names":[],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;;;;AClFA,gEAA8C;AAG9C,MAAM,GAAG,GAAI,OAAe,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;AAEvC,cAAM,GAAG,kBAAQ,CAAC,GAAG,EAAE;IAChC,QAAQ,EAAE,aAAG,CAAC,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;IACnG,mBAAmB,EAAE,aAAG,CAAC;QACrB,OAAO,EAAE,6EAA6E;KACzF,CAAC;IACF,sBAAsB,EAAE,aAAG,CAAC;QACxB,OAAO,EAAE,gFAAgF;KA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CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,uBAAgB,CAAC,WAAW,SAAS,EAAE;YACvD,EAAE;SACL,CAAC,CACL,CACJ,CAAC;QACF,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,uBAAgB,CAAC,cAAc,IAAI,2BAAoB,CAAC,MAAM,EAAE,EAAE;YACxF,EAAE,EAAE,OAAO,CAAC,EAAE;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC3C,CAAC;CACJ;AA/MY,4BAA4B;IADxC,sBAAU,EAAE;IAGJ,6BAAM,CAAC,iBAAU,CAAC,gBAAgB,CAAC;IAEnC,6BAAM,CAAC,QAAQ,CAAC;GAJZ,4BAA4B,CA+MxC;AA/MY,oEAA4B;;;;;;;;;;;;;;;ACVzC,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,gD;;;;;;;;;;;ACAA,6D;;;;;;;;;;;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, 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 \"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","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_07202022';\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: 'propertyAutomatedUser',\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: 'propertyAutomatedUser2',\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 email: ['property-automated-user@resortifi.com', 'property-automated-user2@resortifi.com'],\n },\n });\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\");"],"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_07202022';
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.195",
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.192"
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": "24872b58431cc4f8861c952af50cb9560883b00a"
68
71
  }