@messenger-box/property-ext-server 0.0.1-alpha.364 → 0.0.1-alpha.365

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
@@ -286,7 +286,7 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
286
286
  this.broker = broker;
287
287
  this.logger = logger;
288
288
  this.name = this.constructor.name;
289
- this.id = `${this.name}_20220814`;
289
+ this.id = `${this.name}_20230714`;
290
290
  this.logger = logger.child({ className: PropertyExtMessagesMigration_1.name });
291
291
  }
292
292
  async createUsers() {
@@ -304,18 +304,46 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
304
304
  });
305
305
  const userTwo = this.broker.call(`AccountUser.createAccount`, {
306
306
  account: {
307
- username: 'propertyAutomatedUser2',
307
+ // username: 'propertyAutomatedUser2',
308
+ // email: 'property-automated-user2@resortifi.com',
309
+ // alias: 'auth0|62df22109b1f5f6077c1f57e', // This need to match with auth0 id. Otherwise manually updatein the DB
310
+ // familyName: 'property-fixure',
311
+ // givenName: 'user2',
312
+ // picture: 'https://lh3.googleusercontent.com/a/AATXAJxMARAgr96npkZGf4R2uGbahBP4tLh5SRbS9bVq=s96-c',
313
+ // emailVerified: true,
314
+ // notificationEmail: '',
315
+ username: 'followupchatsubadmin',
308
316
  email: 'property-automated-user2@resortifi.com',
309
317
  alias: 'auth0|62df22109b1f5f6077c1f57e',
310
- familyName: 'property-fixure',
311
- givenName: 'user2',
312
- picture: 'https://lh3.googleusercontent.com/a/AATXAJxMARAgr96npkZGf4R2uGbahBP4tLh5SRbS9bVq=s96-c',
318
+ familyName: 'Admin',
319
+ givenName: 'Folloup Chat',
320
+ picture: 'https://play-lh.googleusercontent.com/btIgzqAzlb3OYTag94wYOyO-exTx4qkGZFfwopOydrJBWn4YbgdpNb2otjmBSRsgTA0=w240-h480',
313
321
  emailVerified: true,
314
322
  notificationEmail: '',
315
323
  },
316
324
  });
317
325
  return Promise.all([userOne, userTwo]);
318
326
  }
327
+ createServiceChannel(owner) {
328
+ return this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"create" /* IBaseServiceCommands.Create */}`, {
329
+ data: {
330
+ topic: 'FollowupChatSupport',
331
+ title: 'FOLLOWUP CHAT SUPPORT',
332
+ description: 'FOLLOWUP CHAT SUPPORT SERVICE',
333
+ creator: owner.id,
334
+ displayName: `followup-support-${owner.id}`,
335
+ type: "SERVICE" /* IRoomType.Service */,
336
+ members: [
337
+ {
338
+ id: undefined,
339
+ schemeAdmin: false,
340
+ roles: 'OWNER',
341
+ user: owner.id,
342
+ },
343
+ ],
344
+ },
345
+ });
346
+ }
319
347
  createChannel(owner, guest) {
320
348
  return this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"create" /* IBaseServiceCommands.Create */}`, {
321
349
  data: {
@@ -433,6 +461,11 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
433
461
  return;
434
462
  }
435
463
  this.logger.debug('(up) channel created...');
464
+ const serviceChannel = await this.createServiceChannel(users[1]);
465
+ if (!serviceChannel) {
466
+ return;
467
+ }
468
+ this.logger.debug('(up) service channel created...', serviceChannel);
436
469
  await Promise.all([
437
470
  this.createSimpleMessage(channel.id, users[0].id),
438
471
  this.createAlertMessage(channel.id, users[0].id),
@@ -454,6 +487,37 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
454
487
  return;
455
488
  }
456
489
  const [userOne, userTwo] = users;
490
+ /////////////////////////....Service Channel....//////////////////////////////////
491
+ const [servicehannel] = await this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"getAll" /* IBaseServiceCommands.GetAll */}`, {
492
+ criteria: {
493
+ displayName: `followup-support-${userTwo}`,
494
+ },
495
+ });
496
+ if (!(servicehannel === null || servicehannel === void 0 ? void 0 : servicehannel.id)) {
497
+ this.logger.debug(`(down) No Channel found, skipping channel delete!`);
498
+ }
499
+ else {
500
+ const posts = await this.broker.call(`${"PostService" /* IMoleculerTopics.PostService */}.getAll`, {
501
+ criteria: {
502
+ channel: servicehannel.id,
503
+ },
504
+ });
505
+ await Promise.all(posts.map(({ id }) => this.broker.call(`${"PostService" /* IMoleculerTopics.PostService */}.delete`, {
506
+ id,
507
+ })));
508
+ const postsThreads = await this.broker.call(`${"PostThreadService" /* IMoleculerTopics.PostThreadService */}.getAll`, {
509
+ criteria: {
510
+ channel: servicehannel.id,
511
+ },
512
+ });
513
+ await Promise.all(postsThreads.map(({ id }) => this.broker.call(`${"PostThreadService" /* IMoleculerTopics.PostThreadService */}.delete`, {
514
+ id,
515
+ })));
516
+ await this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"delete" /* IBaseServiceCommands.Delete */}`, {
517
+ id: servicehannel.id,
518
+ });
519
+ }
520
+ /////////////////////////....Service Channel.... end//////////////////////////////////
457
521
  const [channel] = await this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"getAll" /* IBaseServiceCommands.GetAll */}`, {
458
522
  criteria: {
459
523
  displayName: `${userTwo.id}:${userOne.id}`,
package/lib/index.js.map CHANGED
@@ -1 +1 @@
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,EAAC;QACrB,OAAO,EAAE,6EAA6E;KACzF,CAAC;IACF,sBAAsB,EAAE,iBAAG,EAAC;QACxB,OAAO,EAAE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AyC,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/env-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/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 './env-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 protected name = this.constructor.name;\n\n id = `${this.name}_20220814`;\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.id}:${guest.id}`,\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 Promise.all([\n this.broker.waitForServices(`${IMoleculerTopics.ChannelService}`),\n this.broker.waitForServices('AccountUser'),\n this.broker.waitForServices(`${IMoleculerTopics.PostService}`),\n ]);\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 if (!users.length) {\n this.logger.debug(`(down) No Users found, skipping migrations!`);\n return;\n }\n const [userOne, userTwo] = users;\n const [channel] = await this.broker.call<any, any>(\n `${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.GetAll}`,\n {\n criteria: {\n displayName: `${userTwo.id}:${userOne.id}`,\n },\n },\n );\n if (!channel?.id) {\n this.logger.debug(`(down) No Channel found, skipping channel delete!`);\n } else {\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 }\n await Promise.all(\n users.map(({ id }) =>\n this.broker.call(`AccountUser.deleteAccount`, {\n account: {\n id,\n },\n }),\n ),\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/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":""}
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,EAAC;QACrB,OAAO,EAAE,6EAA6E;KACzF,CAAC;IACF,sBAAsB,EAAE,iBAAG,EAAC;QACxB,OAAO,EAAE,gFAAgF;KAC5F,CAAC;CACL,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;ACbH,6FAA6B;;;;;;;;;;;;;;ACA7B,sEAAwD;AACxD,2FAA+E;AAExE,MAAM,uBAAuB,GAA6C,GAAG,EAAE,CAClF,IAAI,2BAAe,CAAC,CAAC,IAAqB,EAAE,EAAE;IAC1C,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,6BAAgB,CAAC,CAAC,eAAe,CAAC,6BAAgB,CAAC,IAAI,CAAC,CAAC;IACrF,IAAI,CAAC,k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C,0BAAU,GAAE;IAGJ,iCAAM,EAAC,iBAAU,CAAC,gBAAgB,CAAC;IAEnC,iCAAM,EAAC,QAAQ,CAAC;GAJZ,4BAA4B,CAkTxC;AAlTY,oEAA4B;;;;;;;;;;;;;ACVzC,wGAAoD;AACpD,0FAAuD;AACvD,iFAAmC;AAEnC,qBAAe,IAAI,qBAAO,CAAC;IACvB,MAAM,EAAN,gBAAM;IACN,mBAAmB,EAAE,CAAC,oCAAuB,CAAC;CACjD,CAAC,CAAC;;;;;;;;;;;ACPH;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;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/env-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/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 './env-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, IPostThread, 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 protected name = this.constructor.name;\n\n id = `${this.name}_20230714`;\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 username: 'followupchatsubadmin',\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: 'Admin',\n givenName: 'Folloup Chat',\n picture:\n 'https://play-lh.googleusercontent.com/btIgzqAzlb3OYTag94wYOyO-exTx4qkGZFfwopOydrJBWn4YbgdpNb2otjmBSRsgTA0=w240-h480',\n emailVerified: true,\n notificationEmail: '',\n },\n });\n return Promise.all([userOne, userTwo]);\n }\n\n private createServiceChannel(owner: IUserAccount): Promise<IChannel> {\n return this.broker.call(`${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.Create}`, {\n data: {\n topic: 'FollowupChatSupport',\n title: 'FOLLOWUP CHAT SUPPORT',\n description: 'FOLLOWUP CHAT SUPPORT SERVICE',\n creator: owner.id as never,\n displayName: `followup-support-${owner.id}`,\n type: IRoomType.Service,\n members: [\n {\n id: undefined,\n schemeAdmin: false,\n roles: 'OWNER',\n user: owner.id as never,\n },\n ],\n },\n });\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.id}:${guest.id}`,\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 Promise.all([\n this.broker.waitForServices(`${IMoleculerTopics.ChannelService}`),\n this.broker.waitForServices('AccountUser'),\n this.broker.waitForServices(`${IMoleculerTopics.PostService}`),\n ]);\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\n const serviceChannel = await this.createServiceChannel(users[1]);\n if (!serviceChannel) {\n return;\n }\n this.logger.debug('(up) service channel created...', serviceChannel);\n\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 if (!users.length) {\n this.logger.debug(`(down) No Users found, skipping migrations!`);\n return;\n }\n const [userOne, userTwo] = users;\n /////////////////////////....Service Channel....//////////////////////////////////\n const [servicehannel] = await this.broker.call<any, any>(\n `${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.GetAll}`,\n {\n criteria: {\n displayName: `followup-support-${userTwo}`,\n },\n },\n );\n if (!servicehannel?.id) {\n this.logger.debug(`(down) No Channel found, skipping channel delete!`);\n } else {\n const posts = await this.broker.call<IPost[], unknown>(`${IMoleculerTopics.PostService}.getAll`, {\n criteria: {\n channel: servicehannel.id,\n },\n });\n await Promise.all(\n posts.map(({ id }) =>\n this.broker.call(`${IMoleculerTopics.PostService}.delete`, {\n id,\n }),\n ),\n );\n const postsThreads = await this.broker.call<IPostThread[], unknown>(\n `${IMoleculerTopics.PostThreadService}.getAll`,\n {\n criteria: {\n channel: servicehannel.id,\n },\n },\n );\n await Promise.all(\n postsThreads.map(({ id }) =>\n this.broker.call(`${IMoleculerTopics.PostThreadService}.delete`, {\n id,\n }),\n ),\n );\n await this.broker.call(`${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.Delete}`, {\n id: servicehannel.id,\n });\n }\n /////////////////////////....Service Channel.... end//////////////////////////////////\n const [channel] = await this.broker.call<any, any>(\n `${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.GetAll}`,\n {\n criteria: {\n displayName: `${userTwo.id}:${userOne.id}`,\n },\n },\n );\n if (!channel?.id) {\n this.logger.debug(`(down) No Channel found, skipping channel delete!`);\n } else {\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 }\n await Promise.all(\n users.map(({ id }) =>\n this.broker.call(`AccountUser.deleteAccount`, {\n account: {\n id,\n },\n }),\n ),\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/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":""}
@@ -8,6 +8,7 @@ export declare class PropertyExtMessagesMigration implements IDatabaseMigration
8
8
  protected name: string;
9
9
  id: string;
10
10
  private createUsers;
11
+ private createServiceChannel;
11
12
  private createChannel;
12
13
  private createSimpleMessage;
13
14
  private createAlertMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@messenger-box/property-ext-server",
3
- "version": "0.0.1-alpha.364",
3
+ "version": "0.0.1-alpha.365",
4
4
  "description": "Extension to Messenger to support property",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -38,9 +38,9 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@messenger-box/core": "0.0.1-alpha.363",
42
- "@messenger-box/platform-server": "0.0.1-alpha.364",
43
- "@messenger-box/property-ext-core": "0.0.1-alpha.363"
41
+ "@messenger-box/core": "0.0.1-alpha.365",
42
+ "@messenger-box/platform-server": "0.0.1-alpha.365",
43
+ "@messenger-box/property-ext-core": "0.0.1-alpha.365"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@adminide-stack/account-api-server": "3.1.2-alpha.109",
@@ -72,5 +72,5 @@
72
72
  "typescript": {
73
73
  "definition": "lib/index.d.ts"
74
74
  },
75
- "gitHead": "78a3d8e73667fbe7ba53c1a8496c197f8522ce9e"
75
+ "gitHead": "52c2335b1abc0d3317a5a4a821963becf5509c70"
76
76
  }