@messenger-box/property-ext-server 0.0.1-alpha.199 → 0.0.1-alpha.212
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
|
@@ -280,7 +280,6 @@ exports.PropertyExtMessagesMigration = void 0;
|
|
|
280
280
|
const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
|
|
281
281
|
const core_1 = __webpack_require__(/*! @common-stack/core */ "@common-stack/core");
|
|
282
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
283
|
const config_1 = __webpack_require__(/*! ../config */ "./src/config/index.ts");
|
|
285
284
|
let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class PropertyExtMessagesMigration {
|
|
286
285
|
constructor(broker, logger) {
|
|
@@ -317,13 +316,13 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
|
|
|
317
316
|
return Promise.all([userOne, userTwo]);
|
|
318
317
|
}
|
|
319
318
|
createChannel(owner, guest) {
|
|
320
|
-
return this.broker.call(`${
|
|
319
|
+
return this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"create" /* IBaseServiceCommands.create */}`, {
|
|
321
320
|
data: {
|
|
322
321
|
topic: 'Fixtures',
|
|
323
322
|
title: `${owner.alias}:${guest.alias}`,
|
|
324
323
|
creator: guest.id,
|
|
325
|
-
displayName: `${owner.
|
|
326
|
-
type:
|
|
324
|
+
displayName: `${owner.id}:${guest.id}`,
|
|
325
|
+
type: "DIRECT" /* IRoomType.DIRECT */,
|
|
327
326
|
members: [
|
|
328
327
|
{
|
|
329
328
|
id: undefined,
|
|
@@ -342,7 +341,7 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
|
|
|
342
341
|
});
|
|
343
342
|
}
|
|
344
343
|
async createSimpleMessage(channelId, editedBy) {
|
|
345
|
-
return this.broker.call(`${
|
|
344
|
+
return this.broker.call(`${"PostService" /* IMoleculerTopics.PostService */}.${"create" /* IBaseServiceCommands.create */}`, {
|
|
346
345
|
data: {
|
|
347
346
|
editedBy: editedBy,
|
|
348
347
|
channel: channelId,
|
|
@@ -354,7 +353,7 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
|
|
|
354
353
|
}
|
|
355
354
|
async createAlertMessage(channelId, editedBy) {
|
|
356
355
|
const message = 'This is a dummy alert!';
|
|
357
|
-
return this.broker.call(`${
|
|
356
|
+
return this.broker.call(`${"PostService" /* IMoleculerTopics.PostService */}.${"create" /* IBaseServiceCommands.create */}`, {
|
|
358
357
|
data: {
|
|
359
358
|
editedBy: editedBy,
|
|
360
359
|
channel: channelId,
|
|
@@ -379,7 +378,7 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
|
|
|
379
378
|
}
|
|
380
379
|
async createCardMessage(channelId, editedBy) {
|
|
381
380
|
const message = 'Inquiry for fixture property';
|
|
382
|
-
return this.broker.call(`${
|
|
381
|
+
return this.broker.call(`${"PostService" /* IMoleculerTopics.PostService */}.${"create" /* IBaseServiceCommands.create */}`, {
|
|
383
382
|
data: {
|
|
384
383
|
editedBy: editedBy,
|
|
385
384
|
channel: channelId,
|
|
@@ -416,8 +415,8 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
|
|
|
416
415
|
async waitForServices() {
|
|
417
416
|
if (config_1.config.isDev) {
|
|
418
417
|
await this.broker.waitForServices('AccountUser');
|
|
419
|
-
await this.broker.waitForServices(`${
|
|
420
|
-
await this.broker.waitForServices(`${
|
|
418
|
+
await this.broker.waitForServices(`${"ChannelService" /* IMoleculerTopics.ChannelService */}`);
|
|
419
|
+
await this.broker.waitForServices(`${"PostService" /* IMoleculerTopics.PostService */}`);
|
|
421
420
|
}
|
|
422
421
|
}
|
|
423
422
|
async up() {
|
|
@@ -447,32 +446,37 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
|
|
|
447
446
|
},
|
|
448
447
|
},
|
|
449
448
|
});
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
const [channel] = await this.broker.call(`${core_2.IMoleculerTopics.ChannelService}.${core_2.IBaseServiceCommands.getAll}`, {
|
|
449
|
+
if (!users.length) {
|
|
450
|
+
this.logger.debug(`(down) No Users found, skipping migrations!`);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
const [userOne, userTwo] = users;
|
|
454
|
+
const [channel] = await this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"getAll" /* IBaseServiceCommands.getAll */}`, {
|
|
457
455
|
criteria: {
|
|
458
|
-
displayName:
|
|
456
|
+
displayName: `${userTwo.id}:${userOne.id}`,
|
|
459
457
|
},
|
|
460
458
|
});
|
|
461
459
|
if (!(channel === null || channel === void 0 ? void 0 : channel.id)) {
|
|
462
|
-
this.logger.debug(`(down) No Channel found, skipping
|
|
463
|
-
return;
|
|
460
|
+
this.logger.debug(`(down) No Channel found, skipping channel delete!`);
|
|
464
461
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
462
|
+
else {
|
|
463
|
+
const posts = await this.broker.call(`${"PostService" /* IMoleculerTopics.PostService */}.getAll`, {
|
|
464
|
+
criteria: {
|
|
465
|
+
channel: channel.id,
|
|
466
|
+
},
|
|
467
|
+
});
|
|
468
|
+
await Promise.all(posts.map(({ id }) => this.broker.call(`${"PostService" /* IMoleculerTopics.PostService */}.delete`, {
|
|
469
|
+
id,
|
|
470
|
+
})));
|
|
471
|
+
await this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"delete" /* IBaseServiceCommands.delete */}`, {
|
|
472
|
+
id: channel.id,
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
await Promise.all(users.map(({ id }) => this.broker.call(`AccountUser.deleteAccount`, {
|
|
476
|
+
account: {
|
|
477
|
+
id,
|
|
468
478
|
},
|
|
469
|
-
});
|
|
470
|
-
await Promise.all(posts.map(({ id }) => this.broker.call(`${core_2.IMoleculerTopics.PostService}.delete`, {
|
|
471
|
-
id,
|
|
472
479
|
})));
|
|
473
|
-
await this.broker.call(`${core_2.IMoleculerTopics.ChannelService}.${core_2.IBaseServiceCommands.delete}`, {
|
|
474
|
-
id: channel.id,
|
|
475
|
-
});
|
|
476
480
|
this.logger.debug(`(down) Successful`);
|
|
477
481
|
}
|
|
478
482
|
};
|
|
@@ -525,16 +529,6 @@ module.exports = require("@common-stack/server-core");
|
|
|
525
529
|
|
|
526
530
|
/***/ }),
|
|
527
531
|
|
|
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
532
|
/***/ "@messenger-box/property-ext-core":
|
|
539
533
|
/*!***************************************************!*\
|
|
540
534
|
!*** external "@messenger-box/property-ext-core" ***!
|
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,iB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ACA;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/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":""}
|
|
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,qFAAyB;;;;;;;;;;;;;;ACAzB,sEAAwD;AACxD,2FAA+E;AAExE,MAAM,uBAAuB,GAA6C,GAAG,EAAE,CAClF,IAAI,2BAAe,CAAC,CAAC,IAAqB,EAAE,EAAE;IAC1C,IAAI,CAAC,kBA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CAAC,EAAE;aACjB,CAAC,CAAC;SACN;QACD,MAAM,OAAO,CAAC,GAAG,CACb,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE;YAC1C,OAAO,EAAE;gBACL,EAAE;aACL;SACJ,CAAC,CACL,CACJ,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC3C,CAAC;CACJ;AA5NY,4BAA4B;IADxC,0BAAU,GAAE;IAGJ,iCAAM,EAAC,iBAAU,CAAC,gBAAgB,CAAC;IAEnC,iCAAM,EAAC,QAAQ,CAAC;GAJZ,4BAA4B,CA4NxC;AA5NY,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/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 './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_20220813';\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.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 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 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(`${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.getAll}`, {\n criteria: {\n displayName: `${userTwo.id}:${userOne.id}`,\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":""}
|
|
@@ -5,7 +5,7 @@ export declare class PropertyExtMessagesMigration implements IDatabaseMigration
|
|
|
5
5
|
private readonly broker;
|
|
6
6
|
private logger;
|
|
7
7
|
constructor(broker: ServiceBroker, logger: Logger);
|
|
8
|
-
id: '
|
|
8
|
+
id: 'MessagesMigration_20220813';
|
|
9
9
|
protected name: string;
|
|
10
10
|
private createUsers;
|
|
11
11
|
private createChannel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@messenger-box/property-ext-server",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.212",
|
|
4
4
|
"description": "Extension to Messenger to support property",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -38,12 +38,13 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@messenger-box/property-ext-core": "0.0.1-alpha.
|
|
41
|
+
"@messenger-box/property-ext-core": "0.0.1-alpha.206"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@adminide-stack/account-api-server": "1.1.3-alpha.
|
|
44
|
+
"@adminide-stack/account-api-server": "1.1.3-alpha.40",
|
|
45
45
|
"@adminide-stack/core": "*",
|
|
46
46
|
"@adminide-stack/platform-server": "*",
|
|
47
|
+
"@cdm-logger/core": "*",
|
|
47
48
|
"@cdm-logger/server": "*",
|
|
48
49
|
"@common-stack/core": "*",
|
|
49
50
|
"@common-stack/server-core": "*",
|
|
@@ -59,7 +60,9 @@
|
|
|
59
60
|
"inversify": "*",
|
|
60
61
|
"lodash": "*",
|
|
61
62
|
"moleculer": "*",
|
|
62
|
-
"mongoose": "*"
|
|
63
|
+
"mongoose": "*",
|
|
64
|
+
"stream-chain": "*",
|
|
65
|
+
"stream-json": "*"
|
|
63
66
|
},
|
|
64
67
|
"publishConfig": {
|
|
65
68
|
"access": "public"
|
|
@@ -67,5 +70,5 @@
|
|
|
67
70
|
"typescript": {
|
|
68
71
|
"definition": "lib/index.d.ts"
|
|
69
72
|
},
|
|
70
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "a7d0428df8f037cea29fd0f06bad999358bf9951"
|
|
71
74
|
}
|